CREATE TABLE BLC_NOTIFICATION_STATE (ID VARCHAR2(36 CHAR) NOT NULL, ACKED CHAR(1 CHAR) DEFAULT 'N' NOT NULL, ATTEMPTS NUMBER(10, 0), CHANGE_TIMESTAMP TIMESTAMP(6), CHANGE_TIMESTAMP_ACK TIMESTAMP(6), CONTAINER VARCHAR2(36 CHAR), ENTITY_TYPE VARCHAR2(255 CHAR) NOT NULL, MESSAGE_TYPE VARCHAR2(255 CHAR), MESSAGE_VALUE CLOB, NOTIFICATION_NAME VARCHAR2(255 CHAR), NEXT_ATTEMPT TIMESTAMP(6), STOPPED CHAR(1 CHAR) DEFAULT 'N' NOT NULL, CONSTRAINT CT_41UI48L19X9V43WPOJJG PRIMARY KEY (ID));
CREATE TABLE BLC_PAYMENT (ID VARCHAR2(36 CHAR) NOT NULL, ADDRESSES CLOB, ADJUSTMENTS_TOTAL NUMBER(19, 5), AMOUNT NUMBER(19, 5), ATTRIBUTES CLOB, SAVED_PAYMENT_METHOD_ID VARCHAR2(255 CHAR), DISPLAY_ATTRIBUTES CLOB, FULFILLMENT_TOTAL NUMBER(19, 5), GATEWAY_TYPE VARCHAR2(60 CHAR), SINGLE_USE_PAYMENT_METHOD CHAR(1 CHAR) DEFAULT 'N' NOT NULL, NAME VARCHAR2(255 CHAR), OWNER_ID VARCHAR2(36 CHAR), OWNER_TYPE VARCHAR2(60 CHAR), PAYMENT_METHOD_PROPERTIES CLOB, SHOULD_SAVE_PMT_TO_CUSTOMER CHAR(1 CHAR) DEFAULT 'N' NOT NULL, SUBTOTAL NUMBER(19, 5), TAX_TOTAL NUMBER(19, 5), TRK_ARCHIVED CHAR(1 CHAR) DEFAULT 'N' NOT NULL, AUDIT_CREATION_TIME TIMESTAMP(6), AUDIT_CREATOR VARCHAR2(60 CHAR), AUDIT_UPDATE_TIME TIMESTAMP(6), AUDIT_UPDATER VARCHAR2(60 CHAR), TRK_CHANGE_DETAILS CLOB, TRK_TENANT_ID VARCHAR2(36 CHAR), TYPE VARCHAR2(60 CHAR), VERSION NUMBER(10, 0) NOT NULL, CONSTRAINT CT_DW3JGIFETLXZ8H1OWIB1 PRIMARY KEY (ID));
CREATE TABLE BLC_PAYMENT_TRANSACTION (ID VARCHAR2(36 CHAR) NOT NULL, AMOUNT NUMBER(19, 5), ATTRIBUTES CLOB, CUSTOMER_IP_ADDRESS VARCHAR2(255 CHAR), DATE_RECORDED TIMESTAMP(6), DECLINE_TYPE VARCHAR2(60 CHAR), FAILURE_TYPE VARCHAR2(60 CHAR), GATEWAY_RESPONSE_CODE VARCHAR2(255 CHAR), INDETERMINATE_RESULT CHAR(1 CHAR) DEFAULT 'N' NOT NULL, MANAGEMENT_STATE VARCHAR2(60 CHAR), PARENT_TRANSACTION_ID VARCHAR2(36 CHAR), RAW_RESPONSE CLOB, REQUEST_ID VARCHAR2(255 CHAR), SOURCE VARCHAR2(255 CHAR), STATUS VARCHAR2(60 CHAR), THREE_D_SEC_VERIFICATION_URL VARCHAR2(500 CHAR), TRK_ARCHIVED CHAR(1 CHAR) DEFAULT 'N' NOT NULL, AUDIT_CREATION_TIME TIMESTAMP(6), AUDIT_CREATOR VARCHAR2(60 CHAR), AUDIT_UPDATE_TIME TIMESTAMP(6), AUDIT_UPDATER VARCHAR2(60 CHAR), TRK_CHANGE_DETAILS CLOB, TRK_TENANT_ID VARCHAR2(36 CHAR), TRANSACTION_REFERENCE_ID VARCHAR2(255 CHAR), TYPE VARCHAR2(60 CHAR), VERSION NUMBER(10, 0) NOT NULL, PAYMENT_ID VARCHAR2(36 CHAR) NOT NULL, CONSTRAINT CT_XH99CCS8M7BI1IR22L04 PRIMARY KEY (ID));
CREATE TABLE BLC_RESOURCE_LOCK (ID VARCHAR2(36 CHAR) NOT NULL, CONCEPT_KEY VARCHAR2(255 CHAR), CONTEXT_ID VARCHAR2(36 CHAR), LOCK_EXPIRATION_TIMESTAMP TIMESTAMP(6), LOCKED CHAR(1 CHAR) DEFAULT 'N', SANDBOX_ID VARCHAR2(36 CHAR), LOCK_TIMESTAMP TIMESTAMP(6), TOKEN VARCHAR2(255 CHAR), TYPE_ALIAS VARCHAR2(255 CHAR), CONSTRAINT CT_SP09HS112H7AMW36Q2SW PRIMARY KEY (ID));
CREATE UNIQUE INDEX UK7IEGJT4GOJV24Q9BW8K0I4J0C ON BLC_RESOURCE_LOCK(CONTEXT_ID, TYPE_ALIAS, SANDBOX_ID, CONCEPT_KEY);
ALTER TABLE BLC_RESOURCE_LOCK ADD CONSTRAINT UK7IEGJT4GOJV24Q9BW8K0I4J0C UNIQUE (CONTEXT_ID, TYPE_ALIAS, SANDBOX_ID, CONCEPT_KEY) USING INDEX UK7IEGJT4GOJV24Q9BW8K0I4J0C;
CREATE INDEX FKEQNSPI0P8WRSJJRGXOVTC4M5CIX ON BLC_PAYMENT_TRANSACTION(PAYMENT_ID);
CREATE INDEX IDX7I0I5VCL1DKKWUQ5DYC88WEM5 ON BLC_NOTIFICATION_STATE(ACKED);
CREATE INDEX IDXGFAQE3XMQ5Q4YH78MIX1G04FY ON BLC_NOTIFICATION_STATE(CONTAINER);
CREATE INDEX IDXKM4Y3QJ3JH2MPT0RT6L6VSCL8 ON BLC_RESOURCE_LOCK(TOKEN);
CREATE INDEX IDXMB5IXJYLOPR5DWIG7JEHAOUAE ON BLC_PAYMENT(OWNER_ID);
ALTER TABLE BLC_PAYMENT_TRANSACTION ADD CONSTRAINT FKEQNSPI0P8WRSJJRGXOVTC4M5C FOREIGN KEY (PAYMENT_ID) REFERENCES BLC_PAYMENT (ID);
ALTER TABLE BLC_PAYMENT_TRANSACTION ADD GATEWAY_TRANSACTION_TYPE VARCHAR2(60 CHAR);
ALTER TABLE BLC_PAYMENT_TRANSACTION ADD PARENT_SOURCE_ENTITY_ID VARCHAR2(36 CHAR);
ALTER TABLE BLC_PAYMENT_TRANSACTION ADD PARENT_SOURCE_ENTITY_TYPE VARCHAR2(60 CHAR);
ALTER TABLE BLC_PAYMENT_TRANSACTION ADD SOURCE_ENTITY_ID VARCHAR2(36 CHAR);
ALTER TABLE BLC_PAYMENT_TRANSACTION ADD SOURCE_ENTITY_TYPE VARCHAR2(60 CHAR);
ALTER TABLE BLC_PAYMENT ADD CUSTOMER_ID VARCHAR2(36 CHAR);
ALTER TABLE BLC_PAYMENT ADD IS_CUSTOMER_REGISTERED CHAR(1 CHAR) DEFAULT 'N';
ALTER TABLE BLC_PAYMENT ADD ACCESS_RESTRICTIONS CLOB;
ALTER TABLE BLC_PAYMENT ADD CURRENCY VARCHAR2(255 CHAR);
