rgb-lib-migration 0.3.0-beta.4

RGB wallet library migrations
Documentation
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(BackupInfo::Table)
                    .add_column(
                        ColumnDef::new(BackupInfo::LastProcessedOperationIdx)
                            .integer()
                            .null(),
                    )
                    .to_owned(),
            )
            .await?;

        Ok(())
    }

    async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
        manager
            .alter_table(
                Table::alter()
                    .table(BackupInfo::Table)
                    .drop_column(BackupInfo::LastProcessedOperationIdx)
                    .to_owned(),
            )
            .await?;

        Ok(())
    }
}

#[derive(DeriveIden)]
enum BackupInfo {
    Table,
    LastProcessedOperationIdx,
}