hardcode of dpd and packeta

This commit is contained in:
Priec
2026-06-17 17:27:19 +02:00
parent e8c0362a54
commit cd7a756a54
24 changed files with 694 additions and 152 deletions

View File

@@ -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)
]
}

View File

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

View 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(())
}
}