gitdataai/libs/migrate/m20250628_000080_add_message_reactions_and_search.rs
2026-04-15 09:08:09 +08:00

29 lines
1007 B
Rust

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> {
let sql = include_str!("sql/m20250628_000080_add_message_reactions_and_search.sql");
super::execute_sql(manager, sql).await
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.drop_table(
Table::drop()
.table(Alias::new("room_message_reaction"))
.to_owned(),
)
.await?;
let sql = "DROP TRIGGER IF EXISTS room_message_tsv_update ON room_message;
DROP FUNCTION IF EXISTS room_message_tsv_trigger;
DROP INDEX IF EXISTS idx_room_message_content_tsv;
ALTER TABLE room_message DROP COLUMN IF EXISTS content_tsv;";
super::execute_sql(manager, sql).await
}
}