copy default_tracking migration from devel
This commit is contained in:
parent
b35cd58a76
commit
c16f7bd1ba
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -3330,7 +3330,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "migration"
|
name = "migration"
|
||||||
version = "0.31.0"
|
version = "0.32.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"sea-orm-migration",
|
"sea-orm-migration",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "migration"
|
name = "migration"
|
||||||
version = "0.31.0"
|
version = "0.32.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ mod m20230514_114803_admin_add_credits;
|
|||||||
mod m20230607_221917_total_deposits;
|
mod m20230607_221917_total_deposits;
|
||||||
mod m20230615_221201_handle_payment_uncles;
|
mod m20230615_221201_handle_payment_uncles;
|
||||||
mod m20230618_230611_longer_payload;
|
mod m20230618_230611_longer_payload;
|
||||||
|
mod m20230619_172237_default_tracking;
|
||||||
|
|
||||||
pub struct Migrator;
|
pub struct Migrator;
|
||||||
|
|
||||||
@ -69,6 +70,7 @@ impl MigratorTrait for Migrator {
|
|||||||
Box::new(m20230607_221917_total_deposits::Migration),
|
Box::new(m20230607_221917_total_deposits::Migration),
|
||||||
Box::new(m20230615_221201_handle_payment_uncles::Migration),
|
Box::new(m20230615_221201_handle_payment_uncles::Migration),
|
||||||
Box::new(m20230618_230611_longer_payload::Migration),
|
Box::new(m20230618_230611_longer_payload::Migration),
|
||||||
|
Box::new(m20230619_172237_default_tracking::Migraiton),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
63
migration/src/m20230619_172237_default_tracking.rs
Normal file
63
migration/src/m20230619_172237_default_tracking.rs
Normal file
@ -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,
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user