From 114f40ea2acd684af943761fbd22742f139e6f4d Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 26 Apr 2018 15:04:10 +0200 Subject: [PATCH] P5-2534 add table for redirects --- migrations/000.062.sql | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 migrations/000.062.sql diff --git a/migrations/000.062.sql b/migrations/000.062.sql new file mode 100644 index 0000000..3ec7c76 --- /dev/null +++ b/migrations/000.062.sql @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS redirects; + +CREATE TABLE redirects +( + id SERIAL PRIMARY KEY, + market_id INTEGER NOT NULL, + source_uri VARCHAR NOT NULL, + target_uri VARCHAR NOT NULL, + UNIQUE (market_id, source_uri) +); + +GRANT ALL ON TABLE markets TO root; +GRANT ALL ON TABLE markets TO photowall_user; +GRANT ALL ON TABLE markets TO public; + +ALTER TABLE redirects + ADD CONSTRAINT market_fkey + FOREIGN KEY (market_id) + REFERENCES markets(id) MATCH SIMPLE;