--Order 20011849.80

CREATE TABLE INVOICELINESUBTYPETAX
(
	INVOICELINESUBTYPE_ID NUMBER NOT NULL ,
	COUNTRY_ID           NUMBER NOT NULL ,
	TAXGROUP_ID          NUMBER NULL ,
	SYSTEMUSER_ID        NUMBER NOT NULL ,
	TIMESTAMP            DATE NOT NULL 
);


CREATE  INDEX XIF1INVOICELINESUBTYPETAX ON INVOICELINESUBTYPETAX
(INVOICELINESUBTYPE_ID   ASC);

CREATE  INDEX XIF2INVOICELINESUBTYPETAX ON INVOICELINESUBTYPETAX
(COUNTRY_ID   ASC);

CREATE  INDEX XIF3INVOICELINESUBTYPETAX ON INVOICELINESUBTYPETAX
(TAXGROUP_ID   ASC);

ALTER TABLE INVOICELINESUBTYPETAX
ADD CONSTRAINT  XPKINVOICELINESUBTYPETAX PRIMARY KEY (INVOICELINESUBTYPE_ID,COUNTRY_ID);

ALTER TABLE INVOICELINESUBTYPETAX
ADD CONSTRAINT INVLNSUBTYPE_INVLNSUBTYPETAX FOREIGN KEY (INVOICELINESUBTYPE_ID) REFERENCES INVOICELINESUBTYPE (INVOICELINESUBTYPE_ID) ON DELETE CASCADE;

ALTER TABLE INVOICELINESUBTYPETAX
ADD CONSTRAINT COUNTRY_INVOICELINESUBTYPETAX FOREIGN KEY (COUNTRY_ID) REFERENCES COUNTRY (COUNTRY_ID) ON DELETE CASCADE;

ALTER TABLE INVOICELINESUBTYPETAX
ADD CONSTRAINT TAXGROUP_INVOICELINESUBTYPETAX FOREIGN KEY (TAXGROUP_ID) REFERENCES TAXGROUP (TAXGROUP_ID);
