Skip to content
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 crates/database/migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ mod m20251001_125444_add_index_processed;
mod m20251005_160938_add_initial_l1_block_numbers;
mod m20251013_140946_add_initial_l1_processed_block_number;
mod m20251021_070729_add_skipped_column;
mod m20251021_144852_add_queue_index_index;

mod migration_info;
pub use migration_info::{
Expand Down Expand Up @@ -44,6 +45,7 @@ impl<MI: MigrationInfo + Send + Sync + 'static> MigratorTrait for Migrator<MI> {
Box::new(m20251005_160938_add_initial_l1_block_numbers::Migration),
Box::new(m20251013_140946_add_initial_l1_processed_block_number::Migration),
Box::new(m20251021_070729_add_skipped_column::Migration),
Box::new(m20251021_144852_add_queue_index_index::Migration),
]
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use crate::m20250304_125946_add_l1_msg_table::L1Message;
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> {
// Add index on `queue_index` for the `l1_message` table.
manager
.create_index(
Index::create()
.name("idx_l1_message_queue_index")
.col(L1Message::QueueIndex)
.table(L1Message::Table)
.to_owned(),
)
.await?;

Ok(())
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
// Drop index `queue_index` for the `l1_message` table.
manager
.drop_index(
Index::drop().name("idx_l1_message_queue_index").table(L1Message::Table).to_owned(),
)
.await
}
}