Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

-- Model Flagship: Date-wise flagship management
-- Date: 2026-05-16

-- 1. Create model_flagship table
CREATE TABLE catalog.model_flagship (
    id INT AUTO_INCREMENT PRIMARY KEY,
    catalog_item_id INT NOT NULL,
    start_date DATE NOT NULL,
    end_date DATE NULL,
    created_on DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    created_by VARCHAR(100) NULL,
    INDEX idx_model_flagship_catalog (catalog_item_id),
    INDEX idx_model_flagship_dates (start_date, end_date)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- 2. Remove is_flagship from catalog_item (replaced by model_flagship table)
ALTER TABLE catalog.catalog DROP COLUMN is_flagship;

-- 3. Add menu entry as sibling of Create Combo (parent=188 Stock Management)
INSERT INTO auth.menu (display_text, action_class, parent_menu_id, sequence)
VALUES ('Flagship Models', 'manage-flagship', 188, 2);

-- 4. Migrate existing flagship catalog items to model_flagship (if any were set)
-- INSERT INTO catalog.model_flagship (catalog_item_id, start_date, created_by)
-- SELECT id, CURDATE(), 'migration' FROM catalog.catalog WHERE is_flagship = 1;
-- Run this BEFORE step 2 if there are existing flagship items.