P5-6245 add market_id to product_blacklist table

This commit is contained in:
Martin Carlsson
2020-11-09 09:45:18 +01:00
committed by GitHub
parent 48292ca82c
commit 3d79d61a84
+20
View File
@@ -0,0 +1,20 @@
-- P5-6245: add market id to product blacklist table
alter table product_blacklist
add column market_id integer;
alter table product_blacklist
add constraint market_fkey
foreign key (market_id)
references markets(id) match simple;
update product_blacklist SET market_id = (
select markets.id from markets
join locales on markets.locale_id = locales.id
where locales.value = product_blacklist.language_id || '_' || product_blacklist.territory_id
);
alter table product_blacklist
alter column market_id set not null;
create unique index on product_blacklist (product_id, group_id, market_id);