-- ABS-32156
---------------   LEGALENTITY   -------------------
ALTER TABLE LEGALENTITY ADD (
	SENDINVOICETONAME VARCHAR2(40) NULL,
	SENDINVOICETOADDRESS_ID NUMBER NULL,
	SENDINVOICETOCOUNTRY_ID NUMBER NULL,
	SENDINVOICETOEXTRANAME1 VARCHAR2(40) NULL,
	SENDINVOICETOEXTRANAME2 VARCHAR2(40) NULL
);

CREATE INDEX XIF4LEGALENTITY ON LEGALENTITY (SENDINVOICETOADDRESS_ID ASC);

CREATE INDEX XIF5LEGALENTITY ON LEGALENTITY (SENDINVOICETOCOUNTRY_ID);

ALTER TABLE LEGALENTITY ADD CONSTRAINT LEGALENTITY_SENDINVADD FOREIGN KEY
(SENDINVOICETOADDRESS_ID) REFERENCES ADDRESS (ADDRESS_ID);

ALTER TABLE LEGALENTITY ADD CONSTRAINT LEGALENTITY_SENDINVCOUNTRY FOREIGN KEY
(SENDINVOICETOCOUNTRY_ID) REFERENCES COUNTRY (COUNTRY_ID);