From 8d4195a024908324b0667f617598e0b2f4c1d76c Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Mon, 9 Feb 2026 14:31:10 +0000 Subject: [PATCH] Add script to keep track of all the DB commands to drop and reload --- tools/drop-and-recreate.sql | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tools/drop-and-recreate.sql diff --git a/tools/drop-and-recreate.sql b/tools/drop-and-recreate.sql new file mode 100644 index 00000000..4b75acc1 --- /dev/null +++ b/tools/drop-and-recreate.sql @@ -0,0 +1,18 @@ +DROP DATABASE "nidus-sync"; +-- ALTER DATABASE "nidus-sync" OWNER TO $1; +CREATE DATABASE "nidus-sync" WITH OWNER $1; +GRANT CONNECT ON DATABASE "nidus-sync" TO $1; +\c nidus-sync; +CREATE EXTENSION h3; +CREATE EXTENSION h3_postgis CASCADE; +CREATE EXTENSION hstore; +CREATE SCHEMA import; +ALTER SCHEMA import OWNER TO $1; +GRANT USAGE ON SCHEMA import TO "tegola"; +GRANT USAGE ON SCHEMA publicreport TO "tegola"; +GRANT SELECT ON publicreport.report_location TO "tegola"; +GRANT SELECT ON h3_aggregation to "tegola"; +GRANT SELECT ON import.district TO "tegola"; +GRANT ALL PRIVILEGES ON SCHEMA public TO $1; +-- do import of district data +ALTER TABLE import.district ADD COLUMN geom_4326 geometry(MultiPolygon,4326) GENERATED ALWAYS AS (ST_Transform(geom, 4326)) STORED;