feat(F-102): completed feature
This commit is contained in:
24
project/migrations/038_product_weight_min_purchase.js
Normal file
24
project/migrations/038_product_weight_min_purchase.js
Normal 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`);
|
||||
};
|
||||
Reference in New Issue
Block a user