
/*------ ATD 431226 ------*/
IF NOT EXISTS (SELECT 1 FROM SYSOBJECTS T WHERE T.NAME = 'CARACTERISTICA_ECOMMERCE_CATALOGO' AND T.XTYPE = 'U')
BEGIN
    CREATE TABLE CARACTERISTICA_ECOMMERCE_CATALOGO(
        ID INT IDENTITY NOT NULL,
        CODIGO VARCHAR(20) NOT NULL, 
        NOME VARCHAR(50) NOT NULL)

	ALTER TABLE CARACTERISTICA_ECOMMERCE_CATALOGO ADD CONSTRAINT PK_CARACTERISTICA_ECOMMERCE_CATALOGO PRIMARY KEY (ID)
	CREATE UNIQUE INDEX CARACTERISTICA_ECOMMERCE_CATALOGO_IDX1 ON CARACTERISTICA_ECOMMERCE_CATALOGO(CODIGO)
END
GO

IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'CARACTERISTICA_ECOMMERCE' AND COLUMN_NAME = 'IDCARACTERISTICACATALOGO')
begin
	ALTER TABLE CARACTERISTICA_ECOMMERCE ADD IDCARACTERISTICACATALOGO INT
end
go
/*------ ATD 466536 ------*/
-- Adicionando coluna SEMCBENEF na tabela BASECALFAT
IF NOT EXISTS (SELECT 1 FROM SYSCOLUMNS WHERE name = 'SEMCBENEF' and syscolumns.id IN (SELECT ID FROM SYSOBJECTS WHERE xtype='U' AND name='BASECALFAT')) 
ALTER TABLE BASECALFAT ADD SEMCBENEF TINYINT
go
