//! SeaORM migration: fix column types (TIMESTAMP -> TIMESTAMPTZ) and column names (*_uuid -> *)
//!
//! This migration corrects two categories of mismatches between the SQL schema and Rust models:
//! 1. Column type: `created_at` and other timestamp columns were created as `TIMESTAMP` instead of `TIMESTAMPTZ`
//! 2. Column names: foreign-key columns use `*_uuid` suffix in SQL but models expect `*` (e.g. `user_uuid` -> `user`)

use sea_orm_migration::prelude::*;

pub struct Migration;

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

#[async_trait::async_trait]
impl MigrationTrait for Migration {
    async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
        let sql = include_str!("sql/m20250628_000075_fix_column_types_and_names.sql");
        super::execute_sql(manager, sql).await
    }

    async fn down(&self, _manager: &SchemaManager) -> Result<(), DbErr> {
        Ok(())
    }
}
