Browse Source

Organizing files

master
ddangelorb 3 years ago
parent
commit
5ac5cbee59
  1. 0
      db/0.services.ddl.sql
  2. 0
      db/1.services.sys_config.sql
  3. 88
      db/1.sys_config.sql
  4. 0
      db/wp6.erd.pdf

0
db/services.ddl.sql → db/0.services.ddl.sql

0
db/0.services.sys_config.sql → db/1.services.sys_config.sql

88
db/1.sys_config.sql

@ -1,88 +0,0 @@
DO $$
DECLARE
idformsoriginsinserted bigint;
idformsinserted bigint;
idfieldsinserted bigint;
BEGIN
SELECT id FROM formsorigins INTO idformsoriginsinserted WHERE name = 'WP6.MobileApp' and active = 1;
--BEGIN FLOODZONES_FORM
INSERT INTO forms(idformsorigins, code, name, description, dtcreation, active) values (idformsoriginsinserted, "FLOODZONES_FORM", "Flood Zones", "Flood Zones Form", DateTime(), 1)
RETURNING id INTO idformsinserted;
INSERT INTO fields(idfieldsdatatypes, name, description, fillingclue, active)
SELECT fdt.id, 'id', 'id From FloodZones Form', '', 1 FROM fieldsdatatypes fdt WHERE fdt.name = 'integer'
RETURNING id INTO idfieldsinserted;
INSERT INTO formsfields(id, idforms, idfields, active) VALUES (DEFAULT, idformsinserted, idfieldsinserted, 1);
INSERT INTO fields(idfieldsdatatypes, name, description, fillingclue, active)
SELECT fdt.id, 'description', 'description From FloodZones Form', '', 1 FROM fieldsdatatypes fdt WHERE fdt.name = 'text'
RETURNING id INTO idfieldsinserted;
INSERT INTO formsfields(id, idforms, idfields, active) VALUES (DEFAULT, idformsinserted, idfieldsinserted, 1);
INSERT INTO fields(idfieldsdatatypes, name, description, fillingclue, active)
SELECT fdt.id, 'Images', 'Images From FloodZones Form', '', 1 FROM fieldsdatatypes fdt WHERE fdt.name = 'text'
RETURNING id INTO idfieldsinserted;
INSERT INTO formsfields(id, idforms, idfields, active) VALUES (DEFAULT, idformsinserted, idfieldsinserted, 1);
INSERT INTO fields(idfieldsdatatypes, name, description, fillingclue, active)
SELECT fdt.id, 'Latitude', 'Latitude From FloodZones Form', '', 1 FROM fieldsdatatypes fdt WHERE fdt.name = 'real'
RETURNING id INTO idfieldsinserted;
INSERT INTO formsfields(id, idforms, idfields, active) VALUES (DEFAULT, idformsinserted, idfieldsinserted, 1);
INSERT INTO fields(idfieldsdatatypes, name, description, fillingclue, active)
SELECT fdt.id, 'Longitude', 'Longitude From FloodZones Form', '', 1 FROM fieldsdatatypes fdt WHERE fdt.name = 'real'
RETURNING id INTO idfieldsinserted;
INSERT INTO formsfields(id, idforms, idfields, active) VALUES (DEFAULT, idformsinserted, idfieldsinserted, 1);
INSERT INTO fields(idfieldsdatatypes, name, description, fillingclue, active)
SELECT fdt.id, 'Passable', 'Passable From FloodZones Form', '', 1 FROM fieldsdatatypes fdt WHERE fdt.name = 'integer'
RETURNING id INTO idfieldsinserted;
INSERT INTO formsfields(id, idforms, idfields, active) VALUES (DEFAULT, idformsinserted, idfieldsinserted, 1);
INSERT INTO fields(idfieldsdatatypes, name, description, fillingclue, active)
SELECT fdt.id, 'Date', 'Date From FloodZones Form', '', 1 FROM fieldsdatatypes fdt WHERE fdt.name = 'text'
RETURNING id INTO idfieldsinserted;
INSERT INTO formsfields(id, idforms, idfields, active) VALUES (DEFAULT, idformsinserted, idfieldsinserted, 1);
INSERT INTO fields(idfieldsdatatypes, name, description, fillingclue, active)
SELECT fdt.id, 'Time', 'Time From FloodZones Form', '', 1 FROM fieldsdatatypes fdt WHERE fdt.name = 'text'
RETURNING id INTO idfieldsinserted;
INSERT INTO formsfields(id, idforms, idfields, active) VALUES (DEFAULT, idformsinserted, idfieldsinserted, 1);
INSERT INTO fields(idfieldsdatatypes, name, description, fillingclue, active)
SELECT fdt.id, 'Address', 'Address From FloodZones Form', '', 1 FROM fieldsdatatypes fdt WHERE fdt.name = 'text'
RETURNING id INTO idfieldsinserted;
INSERT INTO formsfields(id, idforms, idfields, active) VALUES (DEFAULT, idformsinserted, idfieldsinserted, 1);
--END FLOODZONES_FORM
--BEGIN PLUVIOMETERS_FORM
INSERT INTO forms(idformsorigins, code, name, description, dtcreation, active) values (idformsoriginsinserted, "PLUVIOMETERS_FORM", "Pluviometers", "Pluviometers Form", DateTime(), 1);
--END PLUVIOMETERS_FORM
--BEGIN RAIN_FORM
INSERT INTO forms(idformsorigins, code, name, description, dtcreation, active) values (idformsoriginsinserted, "RAIN_FORM", "Rain", "Rain zones Form", DateTime(), 1);
--END RAIN_FORM
--BEGIN RIVERFLOOD_FORM
INSERT INTO forms(idformsorigins, code, name, description, dtcreation, active) values (idformsoriginsinserted, "RIVERFLOOD_FORM", "River Flood", "River Flood Form", DateTime(), 1);
--END RIVERFLOOD_FORM
--BEGIN PLUVIOMETERS_REGISTRATION
INSERT INTO forms(idformsorigins, code, name, description, dtcreation, active) values (idformsoriginsinserted, "PLUVIOMETERS_REGISTRATION", "Pluviometer registration", "Pluviometer registration", DateTime(), 1);
--END PLUVIOMETERS_REGISTRATION
END $$;

0
db/services.erd.pdf → db/wp6.erd.pdf

Loading…
Cancel
Save