feat(F-193): completed feature
This commit is contained in:
25
project/migrations/057_product_variant_weight_and_expiry.js
Normal file
25
project/migrations/057_product_variant_weight_and_expiry.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* F-193: Adds `weight_grams` to catalog_product_variants.
|
||||
* Authoritative per-variant shipping weight in grams.
|
||||
* Defaults to NULL (fallback to product-level unit_weight_kg in checkout).
|
||||
* Note: expiration_date already exists on catalog_products (migration 038).
|
||||
*/
|
||||
exports.up = function (db) {
|
||||
return db.addColumn('catalog_product_variants', 'weight_grams', {
|
||||
type: 'integer',
|
||||
notNull: false,
|
||||
default: null,
|
||||
check: 'weight_grams IS NULL OR weight_grams > 0',
|
||||
}, 'ean');
|
||||
};
|
||||
|
||||
exports.down = function (db) {
|
||||
return db.removeColumn('catalog_product_variants', 'weight_grams');
|
||||
};
|
||||
|
||||
exports._meta = {
|
||||
version: 57,
|
||||
};
|
||||
Reference in New Issue
Block a user