New order rows table (#238)

Co-authored-by: Niklas Fondberg <niklas.fondberg@photowall.se>
Co-authored-by: Rikard Bartholf <rikard@bartholf.nu>
This commit is contained in:
Fredrik Ringqvist
2022-01-20 06:04:59 +01:00
committed by GitHub
co-authored by Niklas Fondberg Rikard Bartholf
parent cbffaaeee7
commit 8ef219452f
5 changed files with 459 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
-- migrate email and phone to addresses table
ALTER TABLE addresses ADD column IF NOT EXISTS email text;
ALTER TABLE addresses ADD column IF NOT EXISTS phone text;
UPDATE addresses SET phone = oo.phone, email = oo.email FROM orders oo WHERE addresses.id = oo.billing_address_id;
UPDATE addresses SET phone = oo.delivery_phone, email = oo.delivery_email FROM orders oo WHERE addresses.id = oo.delivery_address_id;
-- ALTER table orders drop column phone;
-- ALTER table orders drop column email;
-- ALTER table orders drop column delivery_email;
-- ALTER table orders drop column delivery_phone;