diff --git a/database/create/008-language.sql b/database/create/008-language.sql deleted file mode 100644 index bc028fbf2c7c5c14aa2ace43033da1919fb2fbb4..0000000000000000000000000000000000000000 --- a/database/create/008-language.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE LANGUAGE plpgsql; diff --git a/database/load/998-copy_from_seed.sql b/database/load/998-copy_from_seed.sql deleted file mode 100644 index 7ff5bb641ac726819766d91ea5bd98043ba0c08b..0000000000000000000000000000000000000000 --- a/database/load/998-copy_from_seed.sql +++ /dev/null @@ -1,98 +0,0 @@ --- copy inventory data directly from the production database -CREATE OR REPLACE FUNCTION copy_inventory_from_seed() returns void as $$ -BEGIN - - -- inserting rows from production staging area into sa_inventory - INSERT INTO proinfo_inventory - (contact_date, project, inep, macaddr, os_type, os_distro, - os_kernel, processor, memory, disk1_model, disk1_size, - disk1_used, disk2_model, disk2_size, disk2_used) - (SELECT - * - FROM - dblink('dbname=db - host=host - user=user - password=passwd', - 'SELECT - sa_data, - sa_projeto, - sa_inep, - sa_mac, - sa_so_nome, - sa_so_distribuicao, - sa_so_kernel, - sa_processador, - sa_memoria, - sa_disco1_modelo, - sa_disco1_capacidade, - sa_disco1_usado, - sa_disco2_modelo, - sa_disco2_capacidade, - sa_disco2_usado - FROM mectb00_staging_area' - ) - AS ( - contact_date date, - project integer, - inep varchar(18), - macaddr varchar(18), - os_type text, - os_distro text, - os_kernel text, - processor text, - memory integer, - disk1_model text, - disk1_size integer, - disk1_used integer, - disk2_model text, - disk2_size integer, - disk2_used integer - )); - -END; -$$ language plpgsql; - --- copy net usage data directly from the production database -CREATE OR REPLACE FUNCTION copy_net_from_seed(date_to_load DATE) returns void as $$ -BEGIN - - INSERT INTO proinfo_net_usage - (contact_date, inep, macaddr, collect_time, down_kbits, down_packages, up_kbits, up_packages) - (SELECT - * - FROM - dblink('dbname=db - host=host - user=user - password=passwd', - 'SELECT - net_data, - net_inep, - net_mac, - net_hora, - net_bytes_in::integer, - net_pacotes_in, - net_bytes_out::integer, - net_pacotes_out - FROM mectb00_net_staging_area - WHERE - net_data = ''' || date_to_load ||''' - AND net_bytes_in <> 0 - AND net_pacotes_in <> 0 - AND net_bytes_out <> 0 - AND net_pacotes_in <> 0' - ) - AS ( - contact_date DATE, - inep VARCHAR(18), - macaddr VARCHAR(18), - collect_time TIME WITHOUT TIME ZONE, - down_kbits BIGINT, - down_packages INTEGER, - up_kbits BIGINT, - up_packages INTEGER - )); - -END; -$$ language plpgsql;