diff --git a/.gitignore b/.gitignore index eea70eb..1a0b5b3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ backups/ node_modules/ .DS_Store test/node_modules/ + +*.swp +*.swo diff --git a/CHANGELOG.md b/CHANGELOG.md index 4df6bb0..69fae3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,3 +37,7 @@ CHANGE LOG - added waterways and basins data for Broward County, FL - deleted old Jakarta infrastructure folder - added instance regions and local areas for Madhubani, Kerala + +### v3.2.0 +- added outreach schema for fb ads. +- added C11 West SFWMD site for Broward. diff --git a/build/run.sh b/build/run.sh index 2a03017..bfebbe4 100755 --- a/build/run.sh +++ b/build/run.sh @@ -69,9 +69,13 @@ if [ $SCHEMA == true ]; then # Load the pumps, floodgates and waterways infrastructure schema data psql -h $PGHOST -p $PGPORT -U $PGUSER -d $PGDATABASE -f $(pwd)/schema/infrastructure/infrastructure.schema.sql - echo "Load new sensors schema" + echo "Load sensors schema" # Load sensors schema psql -h $PGHOST -p $PGPORT -U $PGUSER -d $PGDATABASE -f $(pwd)/schema/sensors/sensors.schema.sql + + echo "Load outreach schema" + # Load outreach schema + psql -h $PGHOST -p $PGPORT -U $PGUSER -d $PGDATABASE -f $(pwd)/schema/outreach/outreach.schema.sql fi # Functions loading diff --git a/data/us/infrastructure/add_new_site_C11W.sql b/data/us/infrastructure/add_new_site_C11W.sql new file mode 100644 index 0000000..c23d8a7 --- /dev/null +++ b/data/us/infrastructure/add_new_site_C11W.sql @@ -0,0 +1 @@ +INSERT INTO infrastructure.sites (name, tags, the_geom) VALUES ('C11 CANAL WEST OF WESTON RD (WEST OF I75)', '{"instance_region_code":"brw", "site": "C11U75", "basin": "C11"}', '01010000A0E61000001FA2D11D441754C04F292B5D2C103A400000000000000000'); diff --git a/data/us/infrastructure/sites.sql b/data/us/infrastructure/sites.sql index 4c42179..22b39b6 100644 --- a/data/us/infrastructure/sites.sql +++ b/data/us/infrastructure/sites.sql @@ -17,4 +17,5 @@ INSERT INTO infrastructure.sites (name, tags, the_geom) VALUES ('S-37B SPILLWAY INSERT INTO infrastructure.sites (name, tags, the_geom) VALUES ('S-38 CULVERT ON CANAL C-14 AT CONSERVATION AREA 2A', '{"instance_region_code":"brw", "site": "S38", "basin": "C14"}', '01010000A0E6100000D46A406B1B1354C05D182B62BF3A3A400000000000000000'); INSERT INTO infrastructure.sites (name, tags, the_geom) VALUES ('WATER CONTROL STRUCTURE S-381', '{"instance_region_code":"brw", "site": "S381", "basin": "C11"}', '01010000A0E6100000F98D65B0D81A54C03C27C5E0C40F3A400000000000000000'); INSERT INTO infrastructure.sites (name, tags, the_geom) VALUES ('S-39 ON HILLSBORO CANAL AT CONSERVATION AREA 1', '{"instance_region_code":"brw", "site": "S39", "basin": "HILLS"}', '01010000A0E6100000555D9A350B1354C0BC77C93E185B3A400000000000000000'); -INSERT INTO infrastructure.sites (name, tags, the_geom) VALUES ('S-9 PUMP FROM SOUTH NEW RIVER CANAL TO C.A. 3A', '{"instance_region_code":"brw", "site": "S9", "basin": "C11"}', '01010000A0E61000001BD82AC1621C54C018E4123CC40F3A400000000000000000'); \ No newline at end of file +INSERT INTO infrastructure.sites (name, tags, the_geom) VALUES ('S-9 PUMP FROM SOUTH NEW RIVER CANAL TO C.A. 3A', '{"instance_region_code":"brw", "site": "S9", "basin": "C11"}', '01010000A0E61000001BD82AC1621C54C018E4123CC40F3A400000000000000000'); +INSERT INTO infrastructure.sites (name, tags, the_geom) VALUES ('C11 CANAL WEST OF WESTON RD (WEST OF I75)', '{"instance_region_code":"brw", "site": "C11U75", "basin": "C11"}', '01010000A0E61000001FA2D11D441754C04F292B5D2C103A400000000000000000'); diff --git a/package-lock.json b/package-lock.json index 15d8e62..b11b5c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cognicity-schema", - "version": "3.1.0", + "version": "3.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index dd2d076..001f3b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cognicity-schema", - "version": "3.1.1", + "version": "3.2.0", "description": "Cognicity Database Schema", "engines": { "node": ">=8.1.4" diff --git a/schema/cognicity/cognicity.functions.sql b/schema/cognicity/cognicity.functions.sql index 3020b96..373050a 100644 --- a/schema/cognicity/cognicity.functions.sql +++ b/schema/cognicity/cognicity.functions.sql @@ -113,7 +113,7 @@ CREATE FUNCTION cognicity.version() RETURNS varchar AS $BODY$ BEGIN - RETURN '3.1.0'; + RETURN '3.2.0'; END $BODY$ LANGUAGE plpgsql VOLATILE diff --git a/schema/outreach/outreach.schema.sql b/schema/outreach/outreach.schema.sql new file mode 100644 index 0000000..62858d8 --- /dev/null +++ b/schema/outreach/outreach.schema.sql @@ -0,0 +1,34 @@ +CREATE SCHEMA outreach; + +-- Outreach content table +-- Holds the adCreative +CREATE TABLE outreach.fb_metadata +( + id bigserial NOT NULL, + fb_id bigint NOT NULL UNIQUE, + created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), + properties JSONB NOT NULL, + CONSTRAINT outreach_fb_metadata_pkey PRIMARY KEY (id) +); + +-- Outreach data table +-- Has facebook insight information +CREATE TABLE outreach.fb_data +( + id bigserial NOT NULL, + f_key bigint NOT NULL, + fb_id bigint NOT NULL UNIQUE, + created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), + properties JSONB NOT NULL, + CONSTRAINT outreach_fb_data_pkey PRIMARY KEY (id), + CONSTRAINT outreach_fb_data_fkey FOREIGN KEY (f_key) + REFERENCES outreach.fb_metadata (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION +); + +-- Add a geometry column +SELECT AddGeometryColumn('outreach', 'fb_data', 'the_geom', 4326, 'POLYGON', 2); +ALTER TABLE outreach.fb_data ALTER COLUMN the_geom SET NOT NULL; + +-- Add a GIST spatial index +CREATE INDEX gix_outreach_fb_data ON outreach.fb_data USING gist(the_geom);