-- Optional: submission_type table (aligns with Opening/Closing concept).
-- The app currently uses forms_type + form_details.form_type_id for opening/closing;
-- this table can be used for reference or future use (e.g. if you want submission-level type).
-- Run in your schema (e.g. sat) if you use one: USE sat; then run the statements below.

CREATE TABLE IF NOT EXISTS submission_type (
    submission_type_id INT PRIMARY KEY,
    submission_type_name VARCHAR(255)
);

-- Populate so it's not empty (matches forms_type: 1 = Opening, 2 = Closing)
INSERT INTO submission_type (submission_type_id, submission_type_name)
VALUES (1, 'Opening'),
       (2, 'Closing')
ON DUPLICATE KEY UPDATE submission_type_name = VALUES(submission_type_name);
