use loco_rs::schema::*; use sea_orm_migration::prelude::*; #[derive(DeriveMigrationName)] pub struct Migration; #[async_trait::async_trait] impl MigrationTrait for Migration { async fn up(&self, m: &SchemaManager) -> Result<(), DbErr> { create_table(m, "orders", &[ ("id", ColType::PkAuto), ("order_number", ColType::StringUniq), ("email", ColType::String), ("customer_name", ColType::StringNull), ("status", ColType::StringWithDefault("pending".to_string())), ("total_cents", ColType::BigInteger), ("currency", ColType::StringWithDefault("EUR".to_string())), ("address", ColType::StringNull), ("city", ColType::StringNull), ("zip", ColType::StringNull), ("country", ColType::StringNull), ("note", ColType::TextNull), ], &[ ] ).await } async fn down(&self, m: &SchemaManager) -> Result<(), DbErr> { drop_table(m, "orders").await } }