Skip to content

Commit

Permalink
fix: add census subnetwork indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
mrferris committed Sep 20, 2024
1 parent 421dae0 commit aa57060
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion migration/src/m20240814_121507_census_subnetwork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ use sea_orm_migration::prelude::*;
#[derive(DeriveMigrationName)]
pub struct Migration;

const INDEX_CENSUS_SUBNET_INDEX: &str = "idx_census_subnet";
const INDEX_CENSUS_NODE_SUBNET_INDEX: &str = "idx_census_node_subnet";

#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
Expand All @@ -16,7 +19,16 @@ impl MigrationTrait for Migration {
.to_owned(),
)
.await;
manager
let _ = manager
.create_index(
Index::create()
.name(INDEX_CENSUS_SUBNET_INDEX)
.table(Census::Table)
.col(Census::SubNetwork)
.to_owned(),
)
.await;
let _ = manager
.alter_table(
Table::alter()
.table(CensusNode::Table)
Expand All @@ -25,6 +37,15 @@ impl MigrationTrait for Migration {
)
.to_owned(),
)
.await;
manager
.create_index(
Index::create()
.name(INDEX_CENSUS_NODE_SUBNET_INDEX)
.table(CensusNode::Table)
.col(CensusNode::SubNetwork)
.to_owned(),
)
.await
}

Expand Down

0 comments on commit aa57060

Please sign in to comment.