discounts
This commit is contained in:
@@ -35,6 +35,7 @@ mod m20260618_000002_customer_profiles;
|
||||
mod m20260618_000003_account_type;
|
||||
mod m20260618_000004_account_ownership;
|
||||
mod m20260620_000001_add_totp_to_users;
|
||||
mod m20260621_000001_add_sale_price_to_products;
|
||||
pub struct Migrator;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
@@ -74,6 +75,7 @@ impl MigratorTrait for Migrator {
|
||||
Box::new(m20260618_000003_account_type::Migration),
|
||||
Box::new(m20260618_000004_account_ownership::Migration),
|
||||
Box::new(m20260620_000001_add_totp_to_users::Migration),
|
||||
Box::new(m20260621_000001_add_sale_price_to_products::Migration),
|
||||
// inject-above (do not remove this comment)
|
||||
]
|
||||
}
|
||||
|
||||
19
migration/src/m20260621_000001_add_sale_price_to_products.rs
Normal file
19
migration/src/m20260621_000001_add_sale_price_to_products.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user