bazzar/migrations/20220523090806_change_orders.sql

20 lines
465 B
SQL

ALTER TABLE account_orders
ALTER COLUMN buyer_id DROP NOT NULL;
CREATE TABLE order_addresses
(
id serial not null primary key unique,
name text not null,
email text not null,
street text not null,
city text not null,
country text not null,
zip text not null
);
ALTER TABLE account_orders
ADD COLUMN address_id INT REFERENCES order_addresses (id);
ALTER TABLE account_orders
RENAME TO orders;