monzo-ingestion/migration/src/m20240529_195030_add_transaction_identity_hash.rs
Joshua Coles 4bb9f2813d
All checks were successful
Build and Publish Docker Container / build (push) Successful in 9m56s
Move transaction whittling out of the database
2024-06-03 12:12:45 +01:00

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