ALTER TABLE IF EXISTS public.ent_nota_fiscal_item_lote DROP CONSTRAINT IF EXISTS pk_ent_nota_fiscal_item_lote; ALTER TABLE IF EXISTS public.ent_nota_fiscal_item_lote ADD CONSTRAINT pk_ent_nota_fiscal_item_lote PRIMARY KEY (filial_nota, filial_for, fornecedor, serie, numero, sequencia, sequencia_lote); ALTER TABLE IF EXISTS public.ent_aux_nota_fiscal_item_lote DROP CONSTRAINT IF EXISTS pk_ent_aux_nota_fiscal_item_lote; ALTER TABLE IF EXISTS public.ent_aux_nota_fiscal_item_lote ADD CONSTRAINT pk_ent_aux_nota_fiscal_item_lote PRIMARY KEY (filial_nota, filial_for, fornecedor, serie, numero, sequencia, nr_lote);