-- Keep practices as a separate feature and introduce lessons as a new table.
CREATE TABLE IF NOT EXISTS sub_module_lessons (
    id BIGSERIAL PRIMARY KEY,
    sub_module_id BIGINT NOT NULL REFERENCES sub_modules(id) ON DELETE CASCADE,
    question_set_id BIGINT NOT NULL REFERENCES question_sets(id) ON DELETE CASCADE,
    intro_video_url TEXT,
    display_order INT NOT NULL DEFAULT 0,
    is_active BOOLEAN NOT NULL DEFAULT TRUE,
    created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
    UNIQUE(question_set_id)
);

CREATE INDEX IF NOT EXISTS idx_sub_module_lessons_sub_module_id
ON sub_module_lessons(sub_module_id);

