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;
