All checks were successful
Build and Publish Docker Container / build (push) Successful in 9m56s
40 lines
1.0 KiB
Rust
40 lines
1.0 KiB
Rust
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(
|
|
TableAlterStatement::new()
|
|
.table(Transaction::Table)
|
|
.add_column(
|
|
ColumnDef::new(Transaction::IdentityHash)
|
|
.big_integer()
|
|
.unique_key(),
|
|
)
|
|
.to_owned(),
|
|
)
|
|
.await
|
|
}
|
|
|
|
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
|
manager
|
|
.alter_table(
|
|
TableAlterStatement::new()
|
|
.table(Transaction::Table)
|
|
.drop_column(Transaction::IdentityHash)
|
|
.to_owned(),
|
|
)
|
|
.await
|
|
}
|
|
}
|
|
|
|
#[derive(DeriveIden)]
|
|
enum Transaction {
|
|
Table,
|
|
IdentityHash,
|
|
}
|