Create migration m20260417_000001_add_stream_to_room_ai that adds the `stream BOOLEAN NOT NULL DEFAULT true` column to room_ai. The model definition includes this field but the original migration was missing it. Also format libs/api/room/ws.rs and add gitdata.ai to allowed WS origins.
37 lines
1.0 KiB
Rust
37 lines
1.0 KiB
Rust
//! SeaORM migration: add `stream` column to `room_ai` table
|
|
|
|
use sea_orm_migration::prelude::*;
|
|
|
|
pub struct Migration;
|
|
|
|
impl MigrationName for Migration {
|
|
fn name(&self) -> &str {
|
|
"m20260417_000001_add_stream_to_room_ai"
|
|
}
|
|
}
|
|
|
|
#[async_trait::async_trait]
|
|
impl MigrationTrait for Migration {
|
|
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
|
manager
|
|
.get_connection()
|
|
.execute_raw(sea_orm::Statement::from_string(
|
|
sea_orm::DbBackend::Postgres,
|
|
"ALTER TABLE room_ai ADD COLUMN IF NOT EXISTS stream BOOLEAN NOT NULL DEFAULT true;",
|
|
))
|
|
.await?;
|
|
Ok(())
|
|
}
|
|
|
|
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
|
manager
|
|
.get_connection()
|
|
.execute_raw(sea_orm::Statement::from_string(
|
|
sea_orm::DbBackend::Postgres,
|
|
"ALTER TABLE room_ai DROP COLUMN IF EXISTS stream;",
|
|
))
|
|
.await?;
|
|
Ok(())
|
|
}
|
|
}
|