3m: convert bi_all_forms to a table

This commit is contained in:
Benjamin Dauvergne 2016-05-19 11:09:38 +02:00
parent 773eede548
commit c8209c9c94
1 changed files with 7 additions and 5 deletions

View File

@ -1,6 +1,6 @@
-- Clean
DROP VIEW IF EXISTS bi_form;
DROP VIEW IF EXISTS bi_status;
DROP TABLE IF EXISTS bi_form;
DROP TABLE IF EXISTS bi_status;
DROP VIEW IF EXISTS bi_all_forms;
DROP VIEW IF EXISTS bi_encombrants;
DROP VIEW IF EXISTS bi_assainissement;
@ -150,7 +150,7 @@ CREATE VIEW bi_espaces_verts AS (SELECT
);
-- Les 7 formulaires pôles
CREATE VIEW bi_all_forms AS (
CREATE TABLE bi_all_forms AS (
SELECT formdef_id || '-' || id AS id, backoffice_submission, 'voirie' as form, receipt_time, status, pole_commune_ref FROM bi_voirie
UNION ALL
SELECT formdef_id || '-' || id AS id, backoffice_submission, 'proprete' as form, receipt_time, status, pole_commune_ref FROM bi_proprete
@ -161,6 +161,8 @@ CREATE VIEW bi_all_forms AS (
UNION ALL
SELECT formdef_id || '-' || id AS id, backoffice_submission, 'espaces_verts' as form, receipt_time, status, pole_commune_ref FROM bi_espaces_verts);
CREATE VIEW bi_form AS (SELECT distinct(form) from bi_all_forms);
CREATE TABLE bi_form AS (SELECT distinct(form) from bi_all_forms);
CREATE INDEX ON bi_form AS (form);
CREATE VIEW bi_status AS (SELECT distinct(status) from bi_all_forms);
CREATE TABLE bi_status AS (SELECT distinct(status) from bi_all_forms);
CREATE INDEX ON bi_status (status);