Skip to content

Commit 91ad83c

Browse files
authored
feat: remove unused column from applied_policy table (#163)
1 parent 30bde2f commit 91ad83c

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
use async_trait::async_trait;
2+
use sea_orm_migration::{prelude::*, schema::*};
3+
4+
#[derive(DeriveIden)]
5+
pub enum AppliedPolicy {
6+
Table,
7+
Type,
8+
}
9+
10+
#[derive(DeriveMigrationName)]
11+
pub struct Migration;
12+
13+
#[async_trait]
14+
impl MigrationTrait for Migration {
15+
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
16+
manager
17+
.alter_table(Table::alter().table(AppliedPolicy::Table).drop_column(AppliedPolicy::Type).to_owned())
18+
.await?;
19+
20+
Ok(())
21+
}
22+
23+
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
24+
manager
25+
.alter_table(
26+
Table::alter()
27+
.table(AppliedPolicy::Table)
28+
.add_column_if_not_exists(string_len(AppliedPolicy::Type, 50))
29+
.to_owned(),
30+
)
31+
.await?;
32+
Ok(())
33+
}
34+
}

crates/nebula-backbone/src/database/workspace_migration/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use super::{workspace, AuthMethod};
77

88
mod m20241126_001_init_backbone;
99
mod m20241128_001_create_authority_table;
10+
mod m20241206_001_remove_unused_column_applied_policy_table;
1011

1112
pub struct Migrator;
1213

@@ -16,6 +17,7 @@ impl MigratorTrait for Migrator {
1617
vec![
1718
Box::new(m20241126_001_init_backbone::Migration),
1819
Box::new(m20241128_001_create_authority_table::Migration),
20+
Box::new(m20241206_001_remove_unused_column_applied_policy_table::Migration),
1921
]
2022
}
2123
}

0 commit comments

Comments
 (0)