feat(F-102): completed feature

This commit is contained in:
chattie
2026-08-21 12:02:15 +02:00
parent e46faa869a
commit 027cacd871
31 changed files with 510 additions and 80 deletions

View File

@@ -0,0 +1,24 @@
/**
* Product unit weight and minimum purchase quantity, plus per-method weight
* limits for shipping (max weight and free-shipping weight cap).
* @param {import('node-pg-migrate').MigrationBuilder} pgm
*/
export const up = (pgm) => {
pgm.sql(
`ALTER TABLE catalog_products ADD COLUMN IF NOT EXISTS unit_weight_kg numeric(8,3) NOT NULL DEFAULT 1`,
);
pgm.sql(
`ALTER TABLE catalog_products ADD COLUMN IF NOT EXISTS min_purchase_qty integer NOT NULL DEFAULT 1`,
);
pgm.sql(`ALTER TABLE shipping_methods ADD COLUMN IF NOT EXISTS max_weight_kg numeric(8,3) NULL`);
pgm.sql(
`ALTER TABLE shipping_methods ADD COLUMN IF NOT EXISTS free_shipping_max_weight_kg numeric(8,3) NULL`,
);
};
export const down = (pgm) => {
pgm.sql(`ALTER TABLE shipping_methods DROP COLUMN IF EXISTS free_shipping_max_weight_kg`);
pgm.sql(`ALTER TABLE shipping_methods DROP COLUMN IF EXISTS max_weight_kg`);
pgm.sql(`ALTER TABLE catalog_products DROP COLUMN IF EXISTS min_purchase_qty`);
pgm.sql(`ALTER TABLE catalog_products DROP COLUMN IF EXISTS unit_weight_kg`);
};