Skip to content

Commit

Permalink
feat: custom migration table
Browse files Browse the repository at this point in the history
  • Loading branch information
k1rill-fedoseev committed Dec 15, 2023
1 parent 82026d6 commit bdf1140
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions user-ops-indexer/user-ops-indexer-migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ impl MigratorTrait for Migrator {
Box::new(m20231117_093738_add_indexes::Migration),
]
}
fn migration_table_name() -> DynIden {
Alias::new("user_ops_indexer_migrations").into_iden()
}
}

pub async fn from_sql(manager: &SchemaManager<'_>, content: &str) -> Result<(), DbErr> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
if manager.has_table("blocks").await? {
if !manager.has_table("blocks").await? {
return Err(DbErr::Migration(
"Table blocks does not exist in the database".to_string(),
));
}
if manager.has_table("logs").await? {
if !manager.has_table("logs").await? {
return Err(DbErr::Migration(
"Table logs does not exist in the database".to_string(),
));
Expand Down

0 comments on commit bdf1140

Please sign in to comment.