-- ====================================================================
-- A_COLUMN_DATE_FORMAT Table
-- ====================================================================
-- Purpose: Store column-specific date format configurations
-- ====================================================================

CREATE TABLE CT_MRDS.A_COLUMN_DATE_FORMAT (
    A_SOURCE_FILE_CONFIG_KEY NUMBER(38,0) NOT NULL ENABLE,
    COLUMN_NAME VARCHAR2(200) NOT NULL,
    DATE_FORMAT VARCHAR2(200) NOT NULL,
    CONSTRAINT A_COLUMN_DATE_FORMAT_PK PRIMARY KEY (A_SOURCE_FILE_CONFIG_KEY, COLUMN_NAME),
    CONSTRAINT ACDF_A_SOURCE_FILE_CONFIG_KEY_FK FOREIGN KEY(A_SOURCE_FILE_CONFIG_KEY) REFERENCES CT_MRDS.A_SOURCE_FILE_CONFIG(A_SOURCE_FILE_CONFIG_KEY)
) TABLESPACE "DATA";

-- Primary key index (matching constraint definition)
CREATE UNIQUE INDEX "CT_MRDS"."A_COLUMN_DATE_FORMAT_PK" 
ON "CT_MRDS"."A_COLUMN_DATE_FORMAT" ("A_SOURCE_FILE_CONFIG_KEY", "COLUMN_NAME") 
TABLESPACE "DATA";

GRANT SELECT, INSERT, UPDATE, DELETE ON CT_MRDS.A_COLUMN_DATE_FORMAT TO MRDS_LOADER_ROLE;