Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(user-ops-indexer): add missing index by transaction hash #984

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}
Loading