hardcode of dpd and packeta
This commit is contained in:
@@ -27,6 +27,8 @@ mod m20260616_132000_drop_blog_and_pages;
|
||||
mod m20260616_150755_shipping_methods;
|
||||
mod m20260616_150812_add_shipping_fields_to_orders;
|
||||
mod m20260616_160000_add_parent_to_categories;
|
||||
mod m20260617_000001_add_carrier_to_shipping_methods;
|
||||
mod m20260617_000002_add_shipment_to_orders;
|
||||
pub struct Migrator;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
@@ -58,6 +60,8 @@ impl MigratorTrait for Migrator {
|
||||
Box::new(m20260616_150755_shipping_methods::Migration),
|
||||
Box::new(m20260616_150812_add_shipping_fields_to_orders::Migration),
|
||||
Box::new(m20260616_160000_add_parent_to_categories::Migration),
|
||||
Box::new(m20260617_000001_add_carrier_to_shipping_methods::Migration),
|
||||
Box::new(m20260617_000002_add_shipment_to_orders::Migration),
|
||||
// inject-above (do not remove this comment)
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
23
migration/src/m20260617_000002_add_shipment_to_orders.rs
Normal file
23
migration/src/m20260617_000002_add_shipment_to_orders.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
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> {
|
||||
// Populated only after an admin manually sends the order to a carrier.
|
||||
add_column(m, "orders", "tracking_number", ColType::StringNull).await?;
|
||||
add_column(m, "orders", "shipment_id", ColType::StringNull).await?;
|
||||
add_column(m, "orders", "label_url", ColType::StringNull).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn down(&self, m: &SchemaManager) -> Result<(), DbErr> {
|
||||
remove_column(m, "orders", "tracking_number").await?;
|
||||
remove_column(m, "orders", "shipment_id").await?;
|
||||
remove_column(m, "orders", "label_url").await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user