Files
kompress_eshop/migration/src/m20260616_130610_orders.rs
Priec baf7522273
Some checks failed
CI / Check Style (push) Has been cancelled
CI / Run Clippy (push) Has been cancelled
CI / Run Tests (push) Has been cancelled
eshop
2026-06-16 16:35:50 +02:00

36 lines
1.1 KiB
Rust

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
}
}