| 36562 |
amit |
1 |
-- Model Flagship: Date-wise flagship management
|
|
|
2 |
-- Date: 2026-05-16
|
|
|
3 |
|
|
|
4 |
-- 1. Create model_flagship table
|
|
|
5 |
CREATE TABLE catalog.model_flagship (
|
|
|
6 |
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
|
7 |
catalog_item_id INT NOT NULL,
|
|
|
8 |
start_date DATE NOT NULL,
|
|
|
9 |
end_date DATE NULL,
|
|
|
10 |
created_on DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
11 |
created_by VARCHAR(100) NULL,
|
|
|
12 |
INDEX idx_model_flagship_catalog (catalog_item_id),
|
|
|
13 |
INDEX idx_model_flagship_dates (start_date, end_date)
|
|
|
14 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
15 |
|
|
|
16 |
-- 2. Remove is_flagship from catalog_item (replaced by model_flagship table)
|
|
|
17 |
ALTER TABLE catalog.catalog DROP COLUMN is_flagship;
|
|
|
18 |
|
|
|
19 |
-- 3. Add menu entry as sibling of Create Combo (parent=188 Stock Management)
|
|
|
20 |
INSERT INTO auth.menu (display_text, action_class, parent_menu_id, sequence)
|
|
|
21 |
VALUES ('Flagship Models', 'manage-flagship', 188, 2);
|
|
|
22 |
|
|
|
23 |
-- 4. Migrate existing flagship catalog items to model_flagship (if any were set)
|
|
|
24 |
-- INSERT INTO catalog.model_flagship (catalog_item_id, start_date, created_by)
|
|
|
25 |
-- SELECT id, CURDATE(), 'migration' FROM catalog.catalog WHERE is_flagship = 1;
|
|
|
26 |
-- Run this BEFORE step 2 if there are existing flagship items.
|