From: Nicolas Boisselier Date: Thu, 4 Jan 2018 01:36:16 +0000 (+0000) Subject: www/dbq/etc/nginx.conf X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=13d817261554b091f31bf201eb8f4c35e5cf5100;p=nb.git www/dbq/etc/nginx.conf --- diff --git a/share/sql/zipcode.sql b/share/sql/zipcode.sql new file mode 100644 index 00000000..2b76372e --- /dev/null +++ b/share/sql/zipcode.sql @@ -0,0 +1,27 @@ +-- DROP TABLE IF EXISTS zipcode; +CREATE TABLE IF NOT EXISTS zipcode ( + id varchar(20), + country varchar(2), + name varchar(180), + state varchar(100), + state_code varchar(20), + province varchar(100), + province_code varchar(20), + community varchar(100), + community_code varchar(20), + latitue numeric(7,4), + longitude numeric(7,4), + accuracy smallint + -- PRIMARY KEY(id,country) +); +GRANT ALL ON ALL TABLES IN SCHEMA public TO www; +GRANT ALL ON ALL TABLES IN SCHEMA public TO nico; +GRANT ALL ON ALL TABLES IN SCHEMA public TO root; +CREATE INDEX IF NOT EXISTS zipcode_id_idx ON zipcode (id); +CREATE INDEX IF NOT EXISTS zipcode_country_countryx ON zipcode (country); +CREATE INDEX IF NOT EXISTS zipcode_name_namex ON zipcode (name); +-- \copy zipcode from stdin with delimiter E'\t' null as ''; +BEGIN TRANSACTION; +DELETE FROM zipcode; +copy zipcode from stdin with (format 'text'); +COMMIT;