Skip to content

Commit

Permalink
fix: add missing index by transaction hash (#984)
Browse files Browse the repository at this point in the history
  • Loading branch information
k1rill-fedoseev authored Jul 17, 2024
1 parent 5fd2440 commit 79daab7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 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 @@ -3,6 +3,7 @@ use sea_orm_migration::sea_orm::{Statement, TransactionTrait};
mod m20220101_000001_initial_tables;
mod m20231117_093738_add_indexes;
mod m20240206_150422_add_entrypoint_version;
mod m20240717_111524_add_transaction_hash_index;

pub struct Migrator;

Expand All @@ -13,6 +14,7 @@ impl MigratorTrait for Migrator {
Box::new(m20220101_000001_initial_tables::Migration),
Box::new(m20231117_093738_add_indexes::Migration),
Box::new(m20240206_150422_add_entrypoint_version::Migration),
Box::new(m20240717_111524_add_transaction_hash_index::Migration),
]
}
fn migration_table_name() -> DynIden {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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> {
let sql = r#"
CREATE INDEX user_operations_transaction_hash_index ON user_operations (transaction_hash);
"#;
crate::from_sql(manager, sql).await
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let sql = r#"
DROP INDEX user_operations_transaction_hash_index;
"#;
crate::from_sql(manager, sql).await
}
}

0 comments on commit 79daab7

Please sign in to comment.