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, "shipping_methods",
            &[
            
            ("id", ColType::PkAuto),
            
            ("code", ColType::StringUniq),
            ("name", ColType::String),
            ("price_cents", ColType::BigIntegerWithDefault(0)),
            ("requires_pickup_point", ColType::BooleanWithDefault(false)),
            ("enabled", ColType::BooleanWithDefault(true)),
            ("position", ColType::IntegerWithDefault(0)),
            ],
            &[
            ]
        ).await
    }

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