Project

General

Profile

Feature #163

Updated by Eugene Suhanov 4 months ago

**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: 

 1. Rename the `products_code_unique` index to `code` (drop + re-add, not `renameIndex`). 
 2. Drop `short_description` — nothing renders it. Use Tailwind `line-clamp-*` instead. 
 3. Move `meta_title`/`meta_description` to one polymorphic `seo_meta` table covering products and 
    categories. 
 4. Drop the `images` JSON column; the MediaLibrary `gallery` collection becomes the only source. No 
    `media_id` column — 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. 
 5. Drop `is_available_today`; derive it from `pickup_available`. 
 6. `is_premium`/`is_trend`/`is_urgent` become a `labels` table + pivot. `BadgeResolver` and its 
    tests move with it; eager-load `labels` in the listing controllers.

Back