Skip to content

Commit

Permalink
Remove asset_creator_unique as we now allow duplicate rows
Browse files Browse the repository at this point in the history
  • Loading branch information
danenbm committed Jan 17, 2024
1 parent 6afeeb5 commit 7fc31ae
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ mod m20230918_182123_add_raw_name_symbol;
mod m20230919_072154_cl_audits;
mod m20231019_120101_add_seq_numbers_bgum_update_metadata;
mod m20231206_120101_remove_was_decompressed;
mod m20240117_120101_remove_creator_asset_unique_index;

pub struct Migrator;

Expand Down Expand Up @@ -71,6 +72,7 @@ impl MigratorTrait for Migrator {
Box::new(m20230919_072154_cl_audits::Migration),
Box::new(m20231019_120101_add_seq_numbers_bgum_update_metadata::Migration),
Box::new(m20231206_120101_remove_was_decompressed::Migration),
Box::new(m20240117_120101_remove_creator_asset_unique_index::Migration),
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use digital_asset_types::dao::asset_creators;
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> {
manager
.drop_index(
sea_query::Index::drop()
.name("asset_creator_unique")
.table(asset_creators::Entity)
.to_owned(),
)
.await?;
Ok(())
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.create_index(
Index::create()
.unique()
.name("asset_creator_unique")
.col(asset_creators::Column::AssetId)
.col(asset_creators::Column::Creator)
.table(asset_creators::Entity)
.to_owned(),
)
.await?;
Ok(())
}
}

0 comments on commit 7fc31ae

Please sign in to comment.