diff --git a/migrations/000.111.sql b/migrations/000.111.sql new file mode 100644 index 0000000..743c1fa --- /dev/null +++ b/migrations/000.111.sql @@ -0,0 +1,88 @@ +-- P5-3853 Add new delivery methods DHL Freight and DHL Express and remove unused + +INSERT INTO "delivery-methods" (id, name) VALUES + (12, 'dhlFreightPrivate'), + (13, 'dhlFreightBusiness'), + (14, 'dhlExpress'); + +-- Assign DHL Freight to Sweden +INSERT INTO "delivery-methods_prices" (method, option, option_value, currency, price, territory) VALUES + (12, '', '', 'SEK', 0, 'SE'), + (13, '', '', 'SEK', 0, 'SE'); + +-- Assign DHL Freight to resellers with delivery country Sweden +INSERT INTO "delivery-methods_prices" (method, option, option_value, currency, price, territory) VALUES + (12, '', '', 'DKK', 0, 'SE'), + (13, '', '', 'DKK', 0, 'SE'), + (12, '', '', 'GBP', 0, 'SE'), + (13, '', '', 'GBP', 0, 'SE'), + (12, '', '', 'PLN', 0, 'SE'), + (13, '', '', 'PLN', 0, 'SE'); + +-- Change all DB Schenker BPA in EU expect Sweden to DHL Express +UPDATE "delivery-methods_prices" SET method = 14 WHERE method = 7 AND territory IN ( + 'AT','BE','BG','CY','CZ','DE','EE','ES','EU','FR','GB','GR','HR','HU','IE','IT','LT','LU','LV','MT','NL','PL','PT','RO','SI','SK' +); + +-- Make sure DHL Express is assigned to all EU countries (except Sweden) in native currency: +INSERT INTO "delivery-methods_prices" (method, option, option_value, currency, price, territory) VALUES + (14, '', '', 'EUR', 0, 'AT'), + (14, '', '', 'DKK', 0, 'DK'), + (14, '', '', 'EUR', 0, 'FI'), + (14, '', '', 'EUR', 0, 'BE'), + (14, '', '', 'EUR', 0, 'BG'), + (14, '', '', 'EUR', 0, 'CY'), + (14, '', '', 'EUR', 0, 'CZ'), + (14, '', '', 'EUR', 0, 'DE'), + (14, '', '', 'EUR', 0, 'EE'), + (14, '', '', 'EUR', 0, 'ES'), + (14, '', '', 'EUR', 0, 'EU'), + (14, '', '', 'EUR', 0, 'FR'), + (14, '', '', 'GBP', 0, 'GB'), + (14, '', '', 'EUR', 0, 'GR'), + (14, '', '', 'EUR', 0, 'HR'), + (14, '', '', 'EUR', 0, 'HU'), + (14, '', '', 'EUR', 0, 'IE'), + (14, '', '', 'EUR', 0, 'IT'), + (14, '', '', 'EUR', 0, 'LT'), + (14, '', '', 'EUR', 0, 'LU'), + (14, '', '', 'EUR', 0, 'LV'), + (14, '', '', 'EUR', 0, 'MT'), + (14, '', '', 'EUR', 0, 'NL'), + (14, '', '', 'PLN', 0, 'PL'), + (14, '', '', 'EUR', 0, 'PT'), + (14, '', '', 'EUR', 0, 'RO'), + (14, '', '', 'EUR', 0, 'SI'), + (14, '', '', 'EUR', 0, 'SK') +ON CONFLICT DO NOTHING; + +-- Add missing DHL Express reseller combinations +INSERT INTO "delivery-methods_prices" (method, option, option_value, currency, price, territory) VALUES + (14, '', '', 'SEK', 0, 'DK'), + (14, '', '', 'SEK', 0, 'FI'), + (14, '', '', 'GBP', 0, 'FR'), + (14, '', '', 'GBP', 0, 'IR'), + (14, '', '', 'GBP', 0, 'NL'), + (14, '', '', 'GBP', 0, 'PL'), + (14, '', '', 'GBP', 0, 'PT'), + (14, '', '', 'GBP', 0, 'ES'), + (14, '', '', 'GBP', 0, 'DE'); + +-- Delete remaining DB Schenker from anywhere +DELETE FROM "delivery-methods_prices" WHERE method IN (5,6,7); + +-- Delete Bring outside of Norway +DELETE FROM "delivery-methods_prices" WHERE method IN (8,9) AND territory != 'NO'; + +-- Add missing Bring reseller combinations +INSERT INTO "delivery-methods_prices" (method, option, option_value, currency, price, territory) VALUES + (8, '', '', 'DKK', 0, 'NO'), + (9, '', '', 'DKK', 0, 'NO'), + (8, '', '', 'SEK', 0, 'NO'), + (9, '', '', 'SEK', 0, 'NO'), + (8, '', '', 'GBP', 0, 'NO'), + (9, '', '', 'GBP', 0, 'NO'); + +-- Delete old unused methods postenStandard, postenBusiness, myPack +DELETE FROM "delivery-methods_prices" WHERE method IN (1,2,4); +