BEGIN;
CREATE TABLE goods (
 id SERIAL PRIMARY KEY,
 name TEXT NOT NULL,
 price INT CHECK (price > 0)
);

CREATE TABLE customers (
 id SERIAL PRIMARY KEY,
 name TEXT NOT NULL,
 email TEXT NOT NULL UNIQUE,
 phone TEXT,
 address TEXT
);

CREATE TABLE orders (
 id SERIAL PRIMARY KEY,
 customer_id INT REFERENCES customers(id),
 goods_id INT REFERENCES goods(id),
 number INT CHECK (number >= 0),
 o_time timestamp(0) DEFAULT CURRENT_TIMESTAMP
);
COMMIT;
