Scripts para zerar base do Easyvet - Financialvet
Script para ser executando para zerar tabelas e sequencias, o script ele não zera todas as tabelas deixei as principais tabelas com dados como exames dentre outros.
Versão | Proprietário | Nota | Data |
---|---|---|---|
1.0 | @Renan Mitsuo Oka | Criação de documento | 04/10/2021 |
Instrução
Este processo só deverá ser usado para clientes novos:
1- Abra o pgadmin, click no botão SQL Query e execute o comando:
DELETE FROM AGENDA4;
DELETE FROM AGENDA3;
DELETE FROM AGENDA2;
DELETE FROM AGENDA1;
DELETE FROM MOVAGENDA;
DELETE FROM AGENDA;
ALTER SEQUENCE agenda1_id_seq RESTART WITH 1;
ALTER SEQUENCE agenda2_id_seq RESTART WITH 1;
ALTER SEQUENCE agenda3_id_seq RESTART WITH 1;
ALTER SEQUENCE agenda4_id_seq RESTART WITH 1;
ALTER SEQUENCE agenda_id_seq RESTART WITH 1;
update exame set apoio_id = null
DELETE FROM apoio;
ALTER SEQUENCE apoio_id_seq RESTART WITH 1;
DELETE FROM armazen1;
ALTER SEQUENCE armazen1_id_seq RESTART WITH 1;
DELETE FROM armazen;
ALTER SEQUENCE armazen_id_seq RESTART WITH 1;
Delete from rps;
ALTER SEQUENCE rps_id_seq RESTART WITH 1;
Delete from movcai;
ALTER SEQUENCE movcai_id_seq RESTART WITH 1;
DELETE FROM pagar2;
ALTER SEQUENCE pagar2_id_seq RESTART WITH 1;
delete from pagar1;
ALTER SEQUENCE pagar1_id_seq RESTART WITH 1;
delete from pagar;
ALTER SEQUENCE pagar_id_seq RESTART WITH 1;
delete from receber2;
ALTER SEQUENCE receber2_id_seq RESTART WITH 1;
delete from receber1;
ALTER SEQUENCE receber1_id_seq RESTART WITH 1;
delete from receber;
ALTER SEQUENCE receber_id_seq RESTART WITH 1;
delete from contas;
ALTER SEQUENCE contas_id_seq RESTART WITH 1;
DELETE FROM banco;
ALTER SEQUENCE banco_id_seq RESTART WITH 1;
DELETE FROM bem;
ALTER SEQUENCE bem_id_seq RESTART WITH 1;
DELETE FROM caixa1;
ALTER SEQUENCE caixa1_id_seq RESTART WITH 1;
DELETE FROM caixa;
ALTER SEQUENCE caixa_id_seq RESTART WITH 1;
DELETE FROM cargo;
ALTER SEQUENCE cargo_id_seq RESTART WITH 1;
DELETE FROM movexa;
ALTER SEQUENCE movexa_id_seq RESTART WITH 1;
DELETE FROM crmp;
ALTER SEQUENCE crmp_id_seq RESTART WITH 1;
DELETE FROM movpac;
ALTER SEQUENCE movpac_id_seq RESTART WITH 1;
DELETE FROM prontuario;
ALTER SEQUENCE prontuario_id_seq RESTART WITH 1;
DELETE FROM clinicarot;
ALTER SEQUENCE clinicarot_id_seq RESTART WITH 1;
DELETE FROM nc;
ALTER SEQUENCE nc_id_seq RESTART WITH 1;
DELETE FROM clinicaespec;
ALTER SEQUENCE clinicaespec_id_seq RESTART WITH 1;
DELETE FROM clinicaemail;
ALTER SEQUENCE clinicaemail_id_seq RESTART WITH 1;
DELETE FROM clinica;
ALTER SEQUENCE clinica_id_seq RESTART WITH 1;
DELETE FROM clinicaemail;
ALTER SEQUENCE clinicaemail_id_seq RESTART WITH 1;
DELETE FROM compra1;
ALTER SEQUENCE compra1_id_seq RESTART WITH 1;
DELETE FROM compra;
ALTER SEQUENCE compra_id_seq RESTART WITH 1;
DELETE FROM conciliacao;
ALTER SEQUENCE conciliacao_id_seq RESTART WITH 1;
DELETE FROM contato;
ALTER SEQUENCE contato_id_seq RESTART WITH 1;
DELETE FROM cotacao1;
ALTER SEQUENCE cotacao1_id_seq RESTART WITH 1;
DELETE FROM cotacao;
ALTER SEQUENCE cotacao_id_seq RESTART WITH 1;
DELETE FROM crm;
ALTER SEQUENCE crm_id_seq RESTART WITH 1;
DELETE FROM despprest;
ALTER SEQUENCE despprest_id_seq RESTART WITH 1;
DELETE FROM devolucao;
ALTER SEQUENCE devolucao_id_seq RESTART WITH 1;
update exame set depto_id = null;
update grade set dpto_id = null;
DELETE FROM dpto;
ALTER SEQUENCE dpto_id_seq RESTART WITH 1;
DELETE FROM empresa;
ALTER SEQUENCE empresa_id_seq RESTART WITH 1;
DELETE FROM posto;
ALTER SEQUENCE posto_id_seq RESTART WITH 1;
DELETE FROM entrega;
ALTER SEQUENCE entrega_id_seq RESTART WITH 1;
DELETE FROM eqpexa;
ALTER SEQUENCE eqpexa_id_seq RESTART WITH 1;
DELETE FROM eqp;
ALTER SEQUENCE eqp_id_seq RESTART WITH 1;
DELETE FROM exame_kit;
ALTER SEQUENCE exame_kit_id_seq RESTART WITH 1;
DELETE FROM exameagenda;
ALTER SEQUENCE exameagenda_id_seq RESTART WITH 1;
DELETE FROM examealt;
ALTER SEQUENCE examealt_id_seq RESTART WITH 1;
DELETE FROM examecusto;
ALTER SEQUENCE examecusto_id_seq RESTART WITH 1;
DELETE FROM exameinc;
ALTER SEQUENCE exameinc_id_seq RESTART WITH 1;
DELETE FROM feriado;
ALTER SEQUENCE feriado_id_seq RESTART WITH 1;
DELETE FROM filtro;
ALTER SEQUENCE filtro_id_seq RESTART WITH 1;
DELETE FROM forhist;
ALTER SEQUENCE forhist_id_seq RESTART WITH 1;
DELETE FROM forimp;
ALTER SEQUENCE forimp_id_seq RESTART WITH 1;
DELETE FROM fornecedor;
ALTER SEQUENCE fornecedor_id_seq RESTART WITH 1;
DELETE FROM forrec;
ALTER SEQUENCE forrec_id_seq RESTART WITH 1;
DELETE FROM fraseexa;
ALTER SEQUENCE fraseexa_id_seq RESTART WITH 1;
DELETE FROM frase;
ALTER SEQUENCE frase_id_seq RESTART WITH 1;
DELETE FROM frete;
ALTER SEQUENCE frete_id_seq RESTART WITH 1;
DELETE FROM func;
ALTER SEQUENCE func_id_seq RESTART WITH 1;
DELETE FROM gradeexa;
ALTER SEQUENCE gradeexa_id_seq RESTART WITH 1;
DELETE FROM grade;
ALTER SEQUENCE grade_id_seq RESTART WITH 1;
DELETE FROM historico;
ALTER SEQUENCE historico_id_seq RESTART WITH 1;
DELETE FROM kits;
ALTER SEQUENCE kits_id_seq RESTART WITH 1;
DELETE FROM lancacompra1;
ALTER SEQUENCE lancacompra1_id_seq RESTART WITH 1;
DELETE FROM lancacompra;
ALTER SEQUENCE lancacompra_id_seq RESTART WITH 1;
DELETE FROM licensa;
ALTER SEQUENCE licensa_id_seq RESTART WITH 1;
DELETE FROM localarmazen;
ALTER SEQUENCE localarmazen_id_seq RESTART WITH 1;
DELETE FROM localb;
ALTER SEQUENCE localb_id_seq RESTART WITH 1;
DELETE FROM log_bolrem;
ALTER SEQUENCE log_bolrem_id_seq RESTART WITH 1;
DELETE FROM logcid;
ALTER SEQUENCE logcid_id_seq RESTART WITH 1;
DELETE FROM logfor1;
ALTER SEQUENCE logfor1_id_seq RESTART WITH 1;
DELETE FROM logfor;
ALTER SEQUENCE logfor_id_seq RESTART WITH 1;
DELETE FROM logforhist;
ALTER SEQUENCE logforhist_id_seq RESTART WITH 1;
DELETE FROM loghr;
ALTER SEQUENCE loghr_id_seq RESTART WITH 1;
DELETE FROM logilote_exm;
ALTER SEQUENCE logilote_exm_id_seq RESTART WITH 1;
DELETE FROM logilote;
ALTER SEQUENCE logilote_id_seq RESTART WITH 1;
DELETE FROM lote;
ALTER SEQUENCE lote_id_seq RESTART WITH 1;
DELETE FROM lote_bol;
ALTER SEQUENCE lote_bol_id_seq RESTART WITH 1;
DELETE FROM lote_boleto;
ALTER SEQUENCE lote_boleto_id_seq RESTART WITH 1;
DELETE FROM lote_envbolsite;
ALTER SEQUENCE lote_envbolsite_id_seq RESTART WITH 1;
DELETE FROM mapagrade;
ALTER SEQUENCE mapagrade_id_seq RESTART WITH 1;
DELETE FROM motoboy;
ALTER SEQUENCE motoboy_id_seq RESTART WITH 1;
DELETE FROM movagenda;
ALTER SEQUENCE movagenda_id_seq RESTART WITH 1;
DELETE FROM movagendaexa;
ALTER SEQUENCE movagendaexa_id_seq RESTART WITH 1;
DELETE FROM movapoio;
DELETE FROM movimentacao;
ALTER SEQUENCE movimentacao_id_seq RESTART WITH 1;
DELETE FROM movproduto;
ALTER SEQUENCE movproduto_id_seq RESTART WITH 1;
DELETE FROM nf1;
ALTER SEQUENCE nf1_id_seq RESTART WITH 1;
DELETE FROM nf;
ALTER SEQUENCE nf_id_seq RESTART WITH 1;
DELETE FROM nfse;
ALTER SEQUENCE nfse_id_seq RESTART WITH 1;
DELETE FROM novacol;
ALTER SEQUENCE novacol_id_seq RESTART WITH 1;
DELETE FROM ocorre1;
DELETE FROM orca1;
ALTER SEQUENCE orca1_id_seq RESTART WITH 1;
DELETE FROM orca;
ALTER SEQUENCE orca_id_seq RESTART WITH 1;
DELETE FROM pacportal;
ALTER SEQUENCE pacportal_id_seq RESTART WITH 1;
DELETE FROM pedido1;
ALTER SEQUENCE pedido1_id_seq RESTART WITH 1;
DELETE FROM pedido;
ALTER SEQUENCE pedido_id_seq RESTART WITH 1;
DELETE FROM plano;
ALTER SEQUENCE plano_id_seq RESTART WITH 1;
DELETE FROM prestadorexa;
ALTER SEQUENCE prestadorexa_id_seq RESTART WITH 1;
DELETE FROM prestador;
ALTER SEQUENCE prestador_id_seq RESTART WITH 1;
DELETE FROM reqcompra;
ALTER SEQUENCE reqcompra_id_seq RESTART WITH 1;
DELETE FROM produto;
ALTER SEQUENCE produto_id_seq RESTART WITH 1;
DELETE FROM prontuario_rec;
ALTER SEQUENCE prontuario_rec_id_seq RESTART WITH 1;
DELETE FROM prontuario_ana;
ALTER SEQUENCE prontuario_ana_id_seq RESTART WITH 1;
DELETE FROM prontuario;
ALTER SEQUENCE prontuario_id_seq RESTART WITH 1;
DELETE FROM prop;
ALTER SEQUENCE prop_id_seq RESTART WITH 1;
DELETE FROM rastrea;
ALTER SEQUENCE rastrea_id_seq RESTART WITH 1;
DELETE FROM retorno;
ALTER SEQUENCE retorno_id_seq RESTART WITH 1;
DELETE FROM tab_logcad;
ALTER SEQUENCE tab_logcad_id_seq RESTART WITH 1;
DELETE FROM tab_logcadf;
ALTER SEQUENCE tab_logcadf_id_seq RESTART WITH 1;
DELETE FROM tab_logcai;
ALTER SEQUENCE tab_logcai_id_seq RESTART WITH 1;
DELETE FROM tab_logetq;
ALTER SEQUENCE tab_logetq_id_seq RESTART WITH 1;
DELETE FROM tab_logexa;
ALTER SEQUENCE tab_logexa_id_seq RESTART WITH 1;
DELETE FROM tab_loglote_exam;
ALTER SEQUENCE tab_loglote_exam_id_seq RESTART WITH 1;
DELETE FROM tab_logreg;
ALTER SEQUENCE tab_logreg_id_seq RESTART WITH 1;
DELETE FROM tab_logregf;
ALTER SEQUENCE tab_logregf_id_seq RESTART WITH 1;
DELETE FROM tabela1;
ALTER SEQUENCE tabela1_id_seq RESTART WITH 1;
DELETE FROM tabela;
ALTER SEQUENCE tabela_id_seq RESTART WITH 1;
DELETE FROM transf1;
ALTER SEQUENCE transf1_id_seq RESTART WITH 1;
DELETE FROM transf;
ALTER SEQUENCE transf_id_seq RESTART WITH 1;
DELETE FROM vetani;
ALTER SEQUENCE vetani_id_seq RESTART WITH 1;
DELETE FROM vet;
ALTER SEQUENCE vet_id_seq RESTART WITH 1;