﻿


DROP VIEW if exists pbx_localiza_opcoes;
DROP TABLE if exists cdr;
DROP TABLE if exists lista_coworking;

CREATE INDEX "idxPbxAuditaFull"
  ON pbx_audita_full
  USING btree
  (full_data, full_prog_nome);


ALTER TABLE ast_bilhetes
	DROP COLUMN controle;

ALTER TABLE pbx_cliente
	ALTER COLUMN cletp_id SET DEFAULT 0;

delete from pbx_bilhetes_complemento where id in(
select id from pbx_bilhetes_complemento group by id having count(*) > 1);

ALTER TABLE pbx_bilhetes_complemento
	ADD CONSTRAINT pbx_bilhetes_complemento_pkey PRIMARY KEY (id);


delete from pbx_eventos_dacs where id in(
select id from pbx_eventos_dacs group by id having count(*) > 1);

ALTER TABLE pbx_eventos_dacs
	ADD CONSTRAINT pbx_eventos_dacs_new_pbx_eventos_dac_pkey PRIMARY KEY (id);
