
/*------ ATD 472432 ------*/
IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'AcompanhamentoBoleto' and column_name = 'ProtocoloEmail')
    ALTER TABLE AcompanhamentoBoleto ADD ProtocoloEmail VARCHAR(254)
go
IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'AcompanhamentoBoleto' and column_name = 'ProtocoloImpressao')
    ALTER TABLE AcompanhamentoBoleto ADD ProtocoloImpressao VARCHAR(254)
go

IF NOT EXISTS (SELECT 1 FROM sys.indexes I JOIN  sys.objects o ON i.object_id = o.object_id WHERE O.name = 'AcompanhamentoBoleto' and i.name = 'IDX_ACOMPANHAMENTOBOLETO_CR_HIS')
	CREATE INDEX IDX_ACOMPANHAMENTOBOLETO_CR_HIS ON ACOMPANHAMENTOBOLETO(RCONTAARECEBER,HISTORICO)
go

/*------ ATD 472643 ------*/
IF not EXISTS (SELECT 1 FROM ITEM WHERE OID = 41559)
insert into item (rescopo, criadopor, atualizadopor, codigo, criadoem, atualizadoem , observacao, nome, cid, oid, excluido) 
values (7, 1, 1, '', '01/01/01', '01/01/01', '','Sweda SI 250', 18, 41559, 0) 
go
IF not EXISTS (SELECT 1 FROM CATEGORIA WHERE OID = 41559)
insert into categoria (rsuper, nomeinterno, oid) values (38095, 'IMP_NAO_FISCAL_SWEDASI250', 41559) 
go