Skip to content

Commit 79daab7

Browse files
fix: add missing index by transaction hash (blockscout#984)
1 parent 5fd2440 commit 79daab7

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

user-ops-indexer/user-ops-indexer-migration/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use sea_orm_migration::sea_orm::{Statement, TransactionTrait};
33
mod m20220101_000001_initial_tables;
44
mod m20231117_093738_add_indexes;
55
mod m20240206_150422_add_entrypoint_version;
6+
mod m20240717_111524_add_transaction_hash_index;
67

78
pub struct Migrator;
89

@@ -13,6 +14,7 @@ impl MigratorTrait for Migrator {
1314
Box::new(m20220101_000001_initial_tables::Migration),
1415
Box::new(m20231117_093738_add_indexes::Migration),
1516
Box::new(m20240206_150422_add_entrypoint_version::Migration),
17+
Box::new(m20240717_111524_add_transaction_hash_index::Migration),
1618
]
1719
}
1820
fn migration_table_name() -> DynIden {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
use sea_orm_migration::prelude::*;
2+
3+
#[derive(DeriveMigrationName)]
4+
pub struct Migration;
5+
6+
#[async_trait::async_trait]
7+
impl MigrationTrait for Migration {
8+
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
9+
let sql = r#"
10+
CREATE INDEX user_operations_transaction_hash_index ON user_operations (transaction_hash);
11+
"#;
12+
crate::from_sql(manager, sql).await
13+
}
14+
15+
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
16+
let sql = r#"
17+
DROP INDEX user_operations_transaction_hash_index;
18+
"#;
19+
crate::from_sql(manager, sql).await
20+
}
21+
}

0 commit comments

Comments
 (0)