CREATE TABLE IF NOT EXISTS course_package_item (
    id VARCHAR NOT NULL PRIMARY KEY,
    package_id VARCHAR NOT NULL,
    course_group_id VARCHAR NOT NULL,
    sort_order INT4 DEFAULT 0,
    created_at TIMESTAMP NOT NULL DEFAULT NOW(),
    created_by VARCHAR,
    is_delete BOOL DEFAULT FALSE
);

CREATE INDEX IF NOT EXISTS idx_cpi_package_id ON course_package_item (package_id);
CREATE INDEX IF NOT EXISTS idx_cpi_course_group_id ON course_package_item (course_group_id);
CREATE INDEX IF NOT EXISTS idx_cpi_package_course_group ON course_package_item (package_id, course_group_id);
