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> {
        // Which carrier API (if any) a delivery option maps to. "none" means the
        // option is fulfilled manually and never calls an external API.
        add_column(
            m,
            "shipping_methods",
            "carrier",
            ColType::StringWithDefault("none".to_string()),
        )
        .await
    }

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