Fix account domain migration

This commit is contained in:
Laura Hausmann 2023-08-02 19:09:56 +02:00
parent aa76cf1c33
commit 537d63a11e
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
2 changed files with 39 additions and 0 deletions

View file

@ -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),
]
}
}

View file

@ -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,
}