//! SeaORM migration: create project_member_join_answers table

use sea_orm_migration::prelude::*;

pub struct Migration;

impl MigrationName for Migration {
    fn name(&self) -> &str {
        "m20250628_000023_create_project_member_join_answers"
    }
}

#[async_trait::async_trait]
impl MigrationTrait for Migration {
    async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
        let sql = include_str!("sql/m20250628_000023_create_project_member_join_answers.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,
                format!("DROP TABLE IF EXISTS {};", "project_member_join_answers"),
            ))
            .await?;
        Ok(())
    }
}
