Actions
Feature #163
closed
ES
ES
DB | Product schema cleanup and seeder idempotency
Feature #163:
DB | Product schema cleanup and seeder idempotency
Description
Deploy blocker, first. Remote seeding fails on Duplicate entry '0001' for key 'products.products_code_unique'. ProductSeeder keys updateOrCreate on slug while the unique
constraint is on code — legacy rows carry code = '0001' with slug = '0001-elegantna-…', so
the match misses and the insert collides. Invisible locally because migrate:fresh --seed starts
empty. Fix: key on code, add a guarded migration realigning legacy slugs, check the other seeders
for the same shape. Also confirm why the remote reports Database: app when production was renamed
to db_nota.
Schema cleanup. Six changes to products, all working on MySQL and SQLite:
- Rename the
products_code_uniqueindex tocode(drop + re-add, notrenameIndex). - Drop
short_description— nothing renders it. Use Tailwindline-clamp-*instead. - Move
meta_title/meta_descriptionto one polymorphicseo_metatable covering products and
categories. - Drop the
imagesJSON column; the MediaLibrarygallerycollection becomes the only source. No
media_idcolumn — a single FK can't hold 3–4 photos. ⚠️ Must not merge alone: this removes
the offline-image fallback and production has no MinIO yet. - Drop
is_available_today; derive it frompickup_available. -
is_premium/is_trend/is_urgentbecome alabelstable + pivot.BadgeResolverand its
tests move with it; eager-loadlabelsin the listing controllers.
Actions