This commit is contained in:
pavel 2026-02-13 17:45:29 +01:00
commit c7a592933e
32 changed files with 7871 additions and 0 deletions

View file

@ -0,0 +1,65 @@
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
.alter_table(
Table::alter()
.table(Channels::Table)
.add_column(
ColumnDef::new(Channels::Kind)
.string()
.not_null()
.default("text"),
)
.to_owned(),
)
.await?;
manager
.create_index(
Index::create()
.name("idx_channels_guild_kind")
.table(Channels::Table)
.col(Channels::GuildId)
.col(Channels::Kind)
.to_owned(),
)
.await?;
Ok(())
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.drop_index(
Index::drop()
.name("idx_channels_guild_kind")
.table(Channels::Table)
.to_owned(),
)
.await?;
manager
.alter_table(
Table::alter()
.table(Channels::Table)
.drop_column(Channels::Kind)
.to_owned(),
)
.await?;
Ok(())
}
}
#[derive(DeriveIden)]
enum Channels {
Table,
GuildId,
Kind,
}