From ccc99542dc9cf9ff7fbee6b5acd3b4a09bd79eb7 Mon Sep 17 00:00:00 2001 From: fredrikphotowall <35255659+fredrikphotowall@users.noreply.github.com> Date: Mon, 1 Feb 2021 11:30:27 +0100 Subject: [PATCH] P5-6131 Slideshow slides belong to market_locales (#175) --- migrations/000.290.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 migrations/000.290.sql diff --git a/migrations/000.290.sql b/migrations/000.290.sql new file mode 100644 index 0000000..5dc629c --- /dev/null +++ b/migrations/000.290.sql @@ -0,0 +1,11 @@ +-- P5-6131 Splashes belong to market_locale + +ALTER TABLE slideshow_slides ADD COLUMN market_locale_id INTEGER REFERENCES market_locales (id); + +UPDATE slideshow_slides SET market_locale_id = ( + select id from market_locales + where slideshow_slides.market_id = market_locales.market_id + order by market_locales.id limit 1 +); + +ALTER TABLE slideshow_slides ALTER COLUMN market_locale_id SET NOT NULL;