-- target-database: cmvr-project-dev -- Additive feedback storage. No menu, role, permission, or existing business data is changed. CREATE TABLE IF NOT EXISTS sys_feedback ( id bigint NOT NULL AUTO_INCREMENT, feedback_type varchar(16) CHARACTER SET ascii COLLATE ascii_bin NOT NULL COMMENT 'BUG/FEATURE', title varchar(100) NOT NULL, description text NOT NULL, page_path varchar(500) NOT NULL DEFAULT '' COMMENT 'Confirmed internal route without query or fragment', page_title varchar(100) NOT NULL DEFAULT '', status varchar(16) CHARACTER SET ascii COLLATE ascii_bin NOT NULL DEFAULT 'PENDING' COMMENT 'PENDING/PROCESSING/RESOLVED/DECLINED', reply varchar(2000) NOT NULL DEFAULT '', user_id bigint NOT NULL, submitter_name varchar(100) NOT NULL, create_time datetime NOT NULL, update_time datetime NOT NULL, handled_by varchar(64) DEFAULT NULL, handled_time datetime DEFAULT NULL, PRIMARY KEY (id), KEY idx_feedback_owner_time (user_id, create_time, id), KEY idx_feedback_status_time (status, create_time, id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Authenticated user bug reports and feature requests'; CREATE TABLE IF NOT EXISTS sys_feedback_image ( id char(32) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, feedback_id bigint DEFAULT NULL, owner_id bigint NOT NULL, original_name varchar(180) NOT NULL, content_type varchar(32) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, file_size bigint NOT NULL, sort_order int NOT NULL DEFAULT 0, create_time datetime NOT NULL, PRIMARY KEY (id), KEY idx_feedback_image_parent (feedback_id, sort_order), KEY idx_feedback_image_owner (owner_id, feedback_id), CONSTRAINT fk_feedback_image_parent FOREIGN KEY (feedback_id) REFERENCES sys_feedback (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Private images bound to their uploader and feedback';