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> {
        // Optional discounted price in minor units. When set (and below
        // `price_cents`) the product is on sale; the regular price is shown
        // struck through and this is the effective price everywhere.
        add_column(m, "products", "sale_price_cents", ColType::BigIntegerNull).await
    }

    async fn down(&self, m: &SchemaManager) -> Result<(), DbErr> {
        remove_column(m, "products", "sale_price_cents").await
    }
}
