Added entity postcode lookup
This commit is contained in:
parent
cc84dbb76e
commit
a45c354834
12 changed files with 4793 additions and 1 deletions
27
share/ddl/PostgreSQL/upgrade/27-28/001-auto.sql
Normal file
27
share/ddl/PostgreSQL/upgrade/27-28/001-auto.sql
Normal file
|
@ -0,0 +1,27 @@
|
|||
-- Convert schema 'share/ddl/_source/deploy/27/001-auto.yml' to 'share/ddl/_source/deploy/28/001-auto.yml':;
|
||||
|
||||
;
|
||||
BEGIN;
|
||||
|
||||
;
|
||||
CREATE TABLE "entities_postcodes" (
|
||||
"outcode" character(4) NOT NULL,
|
||||
"incode" character(3) NOT NULL,
|
||||
"entity_id" integer NOT NULL,
|
||||
PRIMARY KEY ("outcode", "incode", "entity_id")
|
||||
);
|
||||
CREATE INDEX "entities_postcodes_idx_entity_id" on "entities_postcodes" ("entity_id");
|
||||
CREATE INDEX "entities_postcodes_idx_outcode_incode" on "entities_postcodes" ("outcode", "incode");
|
||||
|
||||
;
|
||||
ALTER TABLE "entities_postcodes" ADD CONSTRAINT "entities_postcodes_fk_entity_id" FOREIGN KEY ("entity_id")
|
||||
REFERENCES "entities" ("id") ON DELETE CASCADE DEFERRABLE;
|
||||
|
||||
;
|
||||
ALTER TABLE "entities_postcodes" ADD CONSTRAINT "entities_postcodes_fk_outcode_incode" FOREIGN KEY ("outcode", "incode")
|
||||
REFERENCES "gb_postcodes" ("outcode", "incode") DEFERRABLE;
|
||||
|
||||
;
|
||||
|
||||
COMMIT;
|
||||
|
Reference in a new issue