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 @@ -10,6 +10,7 @@ mod m20250825_093350_remove_unsafe_l2_blocks;
mod m20250829_042803_add_table_indexes;
mod m20250901_102341_add_commit_batch_processed_column;
mod m20250904_175949_block_signature;
mod m20250923_135359_add_index_block_hash;
mod migration_info;
pub use migration_info::{
MigrationInfo, ScrollDevMigrationInfo, ScrollMainnetMigrationInfo, ScrollSepoliaMigrationInfo,
Expand All @@ -31,6 +32,7 @@ impl<MI: MigrationInfo + Send + Sync + 'static> MigratorTrait for Migrator<MI> {
Box::new(m20250829_042803_add_table_indexes::Migration),
Box::new(m20250901_102341_add_commit_batch_processed_column::Migration),
Box::new(m20250904_175949_block_signature::Migration),
Box::new(m20250923_135359_add_index_block_hash::Migration),
]
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
use super::m20250904_175949_block_signature::BlockSignature;
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> {
// Create indexes for the `block_signature` table.
manager
.create_index(
Index::create()
.name("idx_block_signature_block_hash")
.col(BlockSignature::BlockHash)
.table(BlockSignature::Table)
.to_owned(),
)
.await?;

Ok(())
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
// Drop indexes for the `block_signature` table.
manager
.drop_index(
Index::drop()
.name("idx_block_signature_block_hash")
.table(BlockSignature::Table)
.to_owned(),
)
.await?;

Ok(())
}
}