
/*------ ATD 322599 ------*/
IF NOT EXISTS (SELECT 1 FROM SYSOBJECTS T WHERE T.NAME = 'CATEGORY_ECOMMERCE' AND T.XTYPE = 'U')
begin
	create table CATEGORY_ECOMMERCE (ID INT NOT NULL, NAME VARCHAR(100) NOT NULL) 

	ALTER TABLE CATEGORY_ECOMMERCE ADD CONSTRAINT PK_CATEGORY_ECOMMERCE PRIMARY KEY (ID)
end
go

IF NOT EXISTS (SELECT 1 FROM SYSOBJECTS T WHERE T.NAME = 'BRAND_ECOMMERCE' AND T.XTYPE = 'U')
begin
	create table BRAND_ECOMMERCE(ID INT NOT NULL, NAME VARCHAR(100) NOT NULL)
	
	ALTER TABLE BRAND_ECOMMERCE ADD CONSTRAINT PK_BRAND_ECCOMERCE PRIMARY KEY (ID)
end
go

IF NOT EXISTS (SELECT 1 FROM SYSOBJECTS T WHERE T.NAME = 'PRODUCT_ECOMMERCE' AND T.XTYPE = 'U')
begin
	create table PRODUCT_ECOMMERCE (
	ID INT NOT NULL,
	NAME varchar(150),
	DESCRIPTION  varchar(8000),
	DESCRIPTIONSHORT varchar(254),
	CATEGORYID int,
	BRANDID int,
	REFID varchar(200),
	METATAGDESCRIPTION varchar(8000),
	TITLE varchar(150),
	KEYWORDS varchar(8000),
	LINKID varchar(254)
	)

	ALTER TABLE PRODUCT_ECOMMERCE ADD CONSTRAINT PK_PRODUCT_ECOMMERCE PRIMARY KEY (ID)
end
go

IF NOT EXISTS (SELECT 1 FROM SYSOBJECTS T WHERE T.NAME = 'SKU_ECOMMERCE' AND T.XTYPE = 'U')
begin
	create table SKU_ECOMMERCE (
	CODPRO CHAR(5) NOT NULL,
	SKUID INT,
	PRODUCTID int,
	NAME varchar(200),
	REFID varchar(50),
	PRICE decimal(18,2),
	HEIGHT decimal(18,4),
	LENGTH decimal(18,4), 
	WIDTH decimal(18,4),
	WEIGHTKG decimal(18,4),
	CUBICWEIGHT decimal(18,4),
	UNITMULTIPLIER decimal(18,4),
	MEASUREMENTUNIT varchar(50),
	MODALID int,
	ISKIT int)

	ALTER TABLE SKU_ECOMMERCE ADD CONSTRAINT PK_SKU_ECOMMERCE PRIMARY KEY (CODPRO)
end
go