File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
crates/database/migration/src Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ mod m20251001_125444_add_index_processed;
1616mod m20251005_160938_add_initial_l1_block_numbers;
1717mod m20251013_140946_add_initial_l1_processed_block_number;
1818mod m20251021_070729_add_skipped_column;
19+ mod m20251021_144852_add_queue_index_index;
1920
2021mod migration_info;
2122pub use migration_info:: {
@@ -44,6 +45,7 @@ impl<MI: MigrationInfo + Send + Sync + 'static> MigratorTrait for Migrator<MI> {
4445 Box :: new( m20251005_160938_add_initial_l1_block_numbers:: Migration ) ,
4546 Box :: new( m20251013_140946_add_initial_l1_processed_block_number:: Migration ) ,
4647 Box :: new( m20251021_070729_add_skipped_column:: Migration ) ,
48+ Box :: new( m20251021_144852_add_queue_index_index:: Migration ) ,
4749 ]
4850 }
4951}
Original file line number Diff line number Diff line change 1+ use crate :: m20250304_125946_add_l1_msg_table:: L1Message ;
2+ use sea_orm_migration:: prelude:: * ;
3+
4+ #[ derive( DeriveMigrationName ) ]
5+ pub struct Migration ;
6+
7+ #[ async_trait:: async_trait]
8+ impl MigrationTrait for Migration {
9+ async fn up ( & self , manager : & SchemaManager ) -> Result < ( ) , DbErr > {
10+ // Add index on `queue_index` for the `l1_message` table.
11+ manager
12+ . create_index (
13+ Index :: create ( )
14+ . name ( "idx_l1_message_queue_index" )
15+ . col ( L1Message :: QueueIndex )
16+ . table ( L1Message :: Table )
17+ . to_owned ( ) ,
18+ )
19+ . await ?;
20+
21+ Ok ( ( ) )
22+ }
23+
24+ async fn down ( & self , manager : & SchemaManager ) -> Result < ( ) , DbErr > {
25+ // Drop index `queue_index` for the `l1_message` table.
26+ manager
27+ . drop_index (
28+ Index :: drop ( ) . name ( "idx_l1_message_queue_index" ) . table ( L1Message :: Table ) . to_owned ( ) ,
29+ )
30+ . await
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments