diff --git a/packages/backend/native-utils/migration/src/lib.rs b/packages/backend/native-utils/migration/src/lib.rs index 476db3306..a18c1e5dc 100644 --- a/packages/backend/native-utils/migration/src/lib.rs +++ b/packages/backend/native-utils/migration/src/lib.rs @@ -5,6 +5,7 @@ mod m20230627_185451_index_note_url; mod m20230709_000510_move_antenna_to_cache; mod m20230726_213530_drop_ads; mod m20230801_160334_add_instance_account_domain; +mod m20230802_190415_fix_instance_account_domain; pub struct Migrator; @@ -17,6 +18,7 @@ impl MigratorTrait for Migrator { Box::new(m20230709_000510_move_antenna_to_cache::Migration), Box::new(m20230726_213530_drop_ads::Migration), Box::new(m20230801_160334_add_instance_account_domain::Migration), + Box::new(m20230802_190415_fix_instance_account_domain::Migration), ] } } diff --git a/packages/backend/native-utils/migration/src/m20230802_190415_fix_instance_account_domain.rs b/packages/backend/native-utils/migration/src/m20230802_190415_fix_instance_account_domain.rs new file mode 100644 index 000000000..5b5fa0f26 --- /dev/null +++ b/packages/backend/native-utils/migration/src/m20230802_190415_fix_instance_account_domain.rs @@ -0,0 +1,37 @@ +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> { + manager + .alter_table( + Table::alter() + .table(Instance::Table) + .rename_column(Alias::new("account_domain"), Instance::AccountDomain) + .to_owned(), + ) + .await + } + + async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { + manager + .alter_table( + Table::alter() + .table(Instance::Table) + .rename_column(Instance::AccountDomain, Alias::new("account_domain")) + .to_owned(), + ) + .await + } +} + +/// Learn more at https://docs.rs/sea-query#iden +#[derive(Iden)] +enum Instance { + Table, + #[iden = "accountDomain"] + AccountDomain, +}