-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to insert observation data for 50 sites
- Loading branch information
Showing
3 changed files
with
762 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
TRUNCATE TABLE observations RESTART IDENTITY CASCADE; | ||
TRUNCATE TABLE observation_sites_measurements RESTART IDENTITY CASCADE; | ||
TRUNCATE TABLE observation_sites RESTART IDENTITY CASCADE; | ||
|
||
INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-1', null); | ||
INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-2', null); | ||
INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-3', null); | ||
INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-4', null); | ||
INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-5', null); | ||
INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-6', null); | ||
INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-7', null); | ||
INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-8', null); | ||
INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-9', null); | ||
INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-10', null); | ||
INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-11', null); | ||
INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-12', null); | ||
INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-13', null); | ||
INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-14', null); | ||
INSERT INTO observation_sites(council_id, name, location) VALUES (9, 'TEST-SITE-15', null); | ||
INSERT INTO observation_sites(council_id, name, location) | ||
SELECT 9, CONCAT('TEST-METER-', LPAD(num::varchar, 2, '0')), null FROM (SELECT generate_series(0, 50) AS num) AS subquery; | ||
|
||
INSERT INTO observation_sites_measurements(site_id, measurement_name, first_observation_at, last_observation_at, observation_count) | ||
SELECT id, 'Water Meter Reading', '2000-01-01', '2099-01-01', 0 | ||
FROM observation_sites | ||
WHERE council_id = 9; | ||
|
||
SELECT pg_temp.insert_observation_data(osm.id) FROM observation_sites_measurements osm; |
Oops, something went wrong.