-- Add columns ERP_I_PRODUCT
alter table ERP_I_PRODUCT add EANNUMBER number;
alter table ERP_I_PRODUCT add LANGUAGECODE varchar2(5);
-- Add comments to the columns 
comment on column ERP_I_PRODUCT.EANNUMBER
  is 'Optional EAN number of the product';
comment on column ERP_I_PRODUCT.LANGUAGECODE
  is 'If left empty the ‘default’ language is being used for the product description and long description.
Remark the optional table erp_i_productdesc can overrule / overwrite the descriptions for the given language when used.';

-- Create table ERP_I_PRODUCTDESC
create table ERP_I_PRODUCTDESC
(
  TRANSFER_ID             NUMBER not null,
  TRANSFER_STATUS         NUMBER default 0 not null,
  PRODUCTCODE             VARCHAR2(12) not null,
  LANGUAGECODE            VARCHAR2(5) not null,
  DESCRIPTION             VARCHAR2(30) not null,
  LONGDESCRIPTION         VARCHAR2(60) not null  
);
-- Create primary, unique and foreign key constraints 
alter table ERP_I_PRODUCTDESC
  add constraint PK_ERP_I_PRODUCTDESC primary key (TRANSFER_ID, PRODUCTCODE, LANGUAGECODE);
alter table ERP_I_PRODUCTDESC
  add constraint FK_ERP_I_PRODUCTDESC foreign key (TRANSFER_ID, PRODUCTCODE)
  references ERP_I_PRODUCT (TRANSFER_ID, CODE) on delete cascade;
