CREATE TABLE `DIM_DATE` (
  `DATE_SK` int(11) NOT NULL,
  `DATE_FULL` date DEFAULT NULL,
  `DAY_NAME` varchar(9) DEFAULT NULL,
  `DAY_SHORT_NAME` varchar(3) DEFAULT NULL,
  `DAY_NUM_OF_WEEK` smallint(6) DEFAULT NULL ,
  `DAY_NUM_OF_MONTH` smallint(6) DEFAULT NULL ,
  `DAY_NUM_OF_QUARTER` smallint(6) DEFAULT NULL ,
  `DAY_NUM_OF_YEAR` smallint(6) DEFAULT NULL ,
  `WEEK_NUM` smallint(6) DEFAULT NULL ,
  `MONTH_NUM` smallint(6) DEFAULT NULL ,
  `MONTH_NAME` varchar(9) DEFAULT NULL ,
  `MONTH_SHORT_NAME` varchar(3) DEFAULT NULL ,
  `CALENDAR_QUARTER` varchar(3) DEFAULT NULL ,
  `QUARTER_NUM` smallint(6) DEFAULT NULL ,
  `YEAR` varchar(5) DEFAULT NULL ,
  `YEAR_QUARTER_NUM` int(11) DEFAULT NULL ,
  `YEAR_MONTH_NUM` int(11) DEFAULT NULL ,
  PRIMARY KEY (`DATE_SK`),
  KEY `idx_date_full` (`DATE_FULL`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8


CREATE TABLE `FACT_TRAN` (
  `TRANSACTION_SK` bigint(20) NOT NULL AUTO_INCREMENT ,
  `TRANSACTION_ID` varchar(50) NOT NULL ,
  `PAYMENT_PRODUCT_ID` smallint(6) DEFAULT NULL ,
  `POINT_OF_INTERACTION_ID` varchar(40) NOT NULL ,
  `TRANSACTION_CODE_SK` int(11) NOT NULL ,
  `ATTENDANCE_CONTEXT` varchar(10) NOT NULL ,
  `CARD_READING_CAPABILITIES` varchar(100) NOT NULL ,
  `CARD_DATA_ENTRY_MODE` varchar(10) NOT NULL ,
  `TRANSACTION_CHANNEL` varchar(10) NOT NULL ,
  `DESTINATION_ID` int(11) DEFAULT NULL ,
  `AIIC` varchar(11) NOT NULL ,
  `POS_SEQUENCE_NUMBER` varchar(8) NOT NULL ,
  `TRANSACTION_AMOUNT` decimal(14,4) DEFAULT NULL ,
  `CURRENCY_CODE` char(3) NOT NULL ,
  `RESULT` varchar(10) NOT NULL ,
  `INTERNAL_RESULT_CODE` char(4) NOT NULL ,
  `DESTINATION_RESULT_CODE` char(4) NOT NULL ,
  `TERMINAL_TREATMENT_RESULT_CODE` char(4) NOT NULL ,
  `TERMINAL_RESULT_CODE` char(5) NOT NULL ,
  `SALE_REFERENCE_NUMBER` varchar(100) DEFAULT NULL ,
  `INITIATING_PARTY` varchar(50) NOT NULL ,
  `TRAN_DATE_SK` int(11) NOT NULL ,
  `TRAN_TIME_SK` mediumint(9) NOT NULL ,
  `TRANSACTION_SYSTEM_DATE_SK` int(11) NOT NULL ,
  `TRANSACTION_SYSTEM_TIME_SK` mediumint(9) NOT NULL ,
  `TRANSACTION_BUSINESS_DATE_SK` int(11) NOT NULL ,
  `COUNTRY_CODE` char(3) NOT NULL ,
  `ACQUIRER_ID` varchar(50) NOT NULL,
  `PAYMENT_FACILITATOR_ID` varchar(50) NOT NULL,
  `MERCHANT_ID` varchar(50) NOT NULL,
  `MERCHANT_EXTERNAL_ID` varchar(40) NOT NULL ,
  `MERCHANT_CATEGORY_CODE` smallint(6) DEFAULT NULL,
  `AUTH_INTERNAL_PROCESSING_TIME` int(11) DEFAULT NULL,
  `AUTH_EXTERNAL_PROCESSING_TIME` int(11) DEFAULT NULL,
  `INSERT_TIMESTAMP` timestamp NOT NULL DEFAULT current_timestamp() ,
  `RUN_ID` bigint(20) NOT NULL ,
  PRIMARY KEY (`TRANSACTION_SK`),
  KEY `TRANSACTION_BUSINESS_DATE_SK` (`TRANSACTION_BUSINESS_DATE_SK`),
  KEY `tran_idx_fiid` (`ACQUIRER_ID`,`PAYMENT_FACILITATOR_ID`),
  KEY `tran_idx_poi` (`POINT_OF_INTERACTION_ID`),
  KEY `tran_idx_transaction_date` (`TRAN_DATE_SK`)
) ENGINE=InnoDB AUTO_INCREMENT=1245097739 DEFAULT CHARSET=utf8