-- ABS-59024/ ABS-63033

-------   BUSINESSUNITCREDITCARDEBC   -----------

CREATE TABLE BUSINESSUNITCREDITCARDEBC
(
BUSINESSUNIT_ID NUMBER NOT NULL,
ENVIRONMENT NUMBER DEFAULT 0 NOT NULL CONSTRAINT ENVIRONMENT_VALID1_1 CHECK (ENVIRONMENT IN (0, 1)),
TESTAPI VARCHAR2(100) NULL,
PINCODE VARCHAR2(20) NOT NULL,
SOURCEKEY VARCHAR2(240) NOT NULL,
CLIENT_IP VARCHAR2(15) NOT NULL,
SYSTEMUSER_ID NUMBER NOT NULL,
TIMESTAMP DATE NOT NULL
);

COMMENT ON COLUMN BUSINESSUNITCREDITCARDEBC.ENVIRONMENT IS '0 = Test environment
1 = Live / production environment
';

COMMENT ON COLUMN BUSINESSUNITCREDITCARDEBC.TESTAPI IS 'Only filled if Environment = 0';
COMMENT ON COLUMN BUSINESSUNITCREDITCARDEBC.CLIENT_IP IS 'Must be a real IP address (format nnn.nnn.nnn.nnn where nnn between 0 and 255)';

ALTER TABLE BUSINESSUNITCREDITCARDEBC ADD CONSTRAINT XPKBUSINESSUNITCREDITCARDEBC PRIMARY KEY (BUSINESSUNIT_ID);

ALTER TABLE BUSINESSUNITCREDITCARDEBC ADD CONSTRAINT BUCCEBC_BU FOREIGN KEY (BUSINESSUNIT_ID)
REFERENCES BUSINESSUNIT (BUSINESSUNIT_ID) ON DELETE CASCADE;


