-- ====================================================================
-- A_TABLE_STAT Table
-- ====================================================================
-- Purpose: Store current table statistics and archival thresholds
-- ====================================================================

CREATE TABLE CT_MRDS.A_TABLE_STAT (
    A_TABLE_STAT_KEY                  NUMBER(38,0) PRIMARY KEY, 
    A_SOURCE_FILE_CONFIG_KEY          NUMBER(38,0) NOT NULL,
    TABLE_NAME                        VARCHAR2(200) NOT NULL,
    FILE_COUNT                        NUMBER(38,0),
    OVER_ARCH_THRESOLD_FILE_COUNT     NUMBER(38,0),
    ROW_COUNT                         NUMBER(38,0), 
    OVER_ARCH_THRESOLD_ROW_COUNT      NUMBER(38,0), 
    SIZE                              NUMBER(38,0),
    OVER_ARCH_THRESOLD_SIZE           NUMBER(38,0),
    ARCH_THRESHOLD_DAYS               NUMBER(4,0),
    CREATED                           TIMESTAMP(6) DEFAULT SYSTIMESTAMP,
    CONSTRAINT A_TABLE_STAT_UK1 UNIQUE(A_SOURCE_FILE_CONFIG_KEY)
) TABLESPACE "DATA";

-- Unique constraint index (from production export)
CREATE UNIQUE INDEX "CT_MRDS"."A_TABLE_STAT_UK1" 
ON "CT_MRDS"."A_TABLE_STAT" ("A_SOURCE_FILE_CONFIG_KEY") 
TABLESPACE "DATA";