//! SeaORM migration: replace room_member with room_access + room_user_state use sea_orm_migration::prelude::*; pub struct Migration; impl MigrationName for Migration { fn name(&self) -> &str { "m20260503_000001_replace_room_member" } } #[async_trait::async_trait] impl MigrationTrait for Migration { async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { let sql = include_str!("sql/m20260503_000001_replace_room_member.sql"); super::execute_sql(manager, sql).await } async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { // Reverse: recreate room_member, drop new tables manager .get_connection() .execute_raw(sea_orm::Statement::from_string( sea_orm::DbBackend::Postgres, "DROP TABLE IF EXISTS room_user_state; DROP TABLE IF EXISTS room_access;".to_string(), )) .await?; Ok(()) } }