006 - Rename ProductCategory Merch→ProShop, Equipment→Rent
- Tanggal: 2026-08-10
- DB: mpcdb (PostgreSQL)
- Ringkas: Samakan enum
products.category dengan konsep bisnis: FnB, ProShop, Rent.
ALTER (jalankan di DB server)
-- Rebuild enum: migrate values then replace type
ALTER TABLE products ALTER COLUMN category DROP DEFAULT;
ALTER TABLE products ALTER COLUMN category TYPE text USING category::text;
UPDATE products SET category = 'ProShop' WHERE category = 'Merch';
UPDATE products SET category = 'Rent' WHERE category = 'Equipment';
DROP TYPE IF EXISTS "ProductCategory";
CREATE TYPE "ProductCategory" AS ENUM ('FnB', 'ProShop', 'Rent');
ALTER TABLE products
ALTER COLUMN category TYPE "ProductCategory" USING category::"ProductCategory";
ALTER TABLE products ALTER COLUMN category SET DEFAULT 'FnB'::"ProductCategory";
Rollback (opsional)
ALTER TABLE products ALTER COLUMN category DROP DEFAULT;
ALTER TABLE products ALTER COLUMN category TYPE text USING category::text;
UPDATE products SET category = 'Merch' WHERE category = 'ProShop';
UPDATE products SET category = 'Equipment' WHERE category = 'Rent';
DROP TYPE IF EXISTS "ProductCategory";
CREATE TYPE "ProductCategory" AS ENUM ('FnB', 'Merch', 'Equipment');
ALTER TABLE products
ALTER COLUMN category TYPE "ProductCategory" USING category::"ProductCategory";
ALTER TABLE products ALTER COLUMN category SET DEFAULT 'FnB'::"ProductCategory";
Catatan
- Dampak: mpc-admin (Prisma enum + menus), mpc-be (
/amenities filter Rent, inventory exclude Rent), mpc-be-pos (is_rental / stock adjust), member apps (parse ProShop).
TransactionType.Merchandise tidak diubah di migrasi ini.