copy default_tracking migration from devel

This commit is contained in:
Bryan Stitt 2023-06-20 19:12:20 -07:00
parent b35cd58a76
commit c16f7bd1ba
4 changed files with 67 additions and 2 deletions

2
Cargo.lock generated

@ -3330,7 +3330,7 @@ dependencies = [
[[package]]
name = "migration"
version = "0.31.0"
version = "0.32.0"
dependencies = [
"sea-orm-migration",
"tokio",

@ -1,6 +1,6 @@
[package]
name = "migration"
version = "0.31.0"
version = "0.32.0"
edition = "2021"
publish = false

@ -31,6 +31,7 @@ mod m20230514_114803_admin_add_credits;
mod m20230607_221917_total_deposits;
mod m20230615_221201_handle_payment_uncles;
mod m20230618_230611_longer_payload;
mod m20230619_172237_default_tracking;
pub struct Migrator;
@ -69,6 +70,7 @@ impl MigratorTrait for Migrator {
Box::new(m20230607_221917_total_deposits::Migration),
Box::new(m20230615_221201_handle_payment_uncles::Migration),
Box::new(m20230618_230611_longer_payload::Migration),
Box::new(m20230619_172237_default_tracking::Migraiton),
]
}
}

@ -0,0 +1,63 @@
use sea_orm_migration::prelude::*;
#[derive(DeriveMigrationName)]
pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
// new keys get set to aggregated logging
// TODO: rename "none" to "minimal"
manager
.alter_table(
Table::alter()
.table(RpcKey::Table)
.modify_column(
ColumnDef::new(RpcKey::LogLevel)
.enumeration(
Alias::new("log_level"),
[
Alias::new("none"),
Alias::new("aggregated"),
Alias::new("detailed"),
],
)
.not_null()
.default("detailed"),
)
.to_owned(),
)
.await
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
// new keys get set to none logging
manager
.alter_table(
Table::alter()
.table(RpcKey::Table)
.modify_column(
ColumnDef::new(RpcKey::LogLevel)
.enumeration(
Alias::new("log_level"),
[
Alias::new("none"),
Alias::new("aggregated"),
Alias::new("detailed"),
],
)
.not_null()
.default("none"),
)
.to_owned(),
)
.await
}
}
/// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)]
enum RpcKey {
Table,
LogLevel,
}