31 lines
1.0 KiB
Rust
31 lines
1.0 KiB
Rust
//! SeaORM migration: extend repo_branch_protect with enhanced fields
|
|
|
|
use sea_orm_migration::prelude::*;
|
|
|
|
pub struct Migration;
|
|
|
|
impl MigrationName for Migration {
|
|
fn name(&self) -> &str {
|
|
"m20260407_000001_extend_repo_branch_protect"
|
|
}
|
|
}
|
|
|
|
#[async_trait::async_trait]
|
|
impl MigrationTrait for Migration {
|
|
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
|
let sql = include_str!("sql/m20260407_000001_extend_repo_branch_protect.sql");
|
|
super::execute_sql(manager, sql).await
|
|
}
|
|
|
|
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
|
manager
|
|
.get_connection()
|
|
.execute_raw(sea_orm::Statement::from_string(
|
|
sea_orm::DbBackend::Postgres,
|
|
"ALTER TABLE repo_branch_protect DROP COLUMN IF EXISTS required_approvals, DROP COLUMN IF EXISTS dismiss_stale_reviews, DROP COLUMN IF EXISTS require_linear_history, DROP COLUMN IF EXISTS allow_fork_syncing;",
|
|
))
|
|
.await?;
|
|
Ok(())
|
|
}
|
|
}
|