Fix "relation does not exist" error
This commit is contained in:
parent
4b9a7b8da8
commit
0827451f5e
24
db/init.sql
24
db/init.sql
|
@ -12,18 +12,6 @@ CREATE TABLE sessions(
|
||||||
pubkey TEXT NOT NULL REFERENCES users(pubkey),
|
pubkey TEXT NOT NULL REFERENCES users(pubkey),
|
||||||
session_id VARCHAR(48)
|
session_id VARCHAR(48)
|
||||||
);
|
);
|
||||||
CREATE TABLE markets(
|
|
||||||
id SERIAL PRIMARY KEY,
|
|
||||||
description TEXT NOT NULL,
|
|
||||||
end_date TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
||||||
invoice_id UUID NOT NULL UNIQUE REFERENCES invoices(id)
|
|
||||||
);
|
|
||||||
CREATE EXTENSION "uuid-ossp";
|
|
||||||
CREATE TABLE shares(
|
|
||||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
||||||
market_id INTEGER REFERENCES markets(id),
|
|
||||||
description TEXT NOT NULL
|
|
||||||
);
|
|
||||||
CREATE TABLE invoices(
|
CREATE TABLE invoices(
|
||||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||||
pubkey TEXT NOT NULL REFERENCES users(pubkey),
|
pubkey TEXT NOT NULL REFERENCES users(pubkey),
|
||||||
|
@ -38,6 +26,18 @@ CREATE TABLE invoices(
|
||||||
held_since TIMESTAMP WITH TIME ZONE,
|
held_since TIMESTAMP WITH TIME ZONE,
|
||||||
description TEXT
|
description TEXT
|
||||||
);
|
);
|
||||||
|
CREATE TABLE markets(
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
description TEXT NOT NULL,
|
||||||
|
end_date TIMESTAMP WITH TIME ZONE NOT NULL,
|
||||||
|
invoice_id UUID NOT NULL UNIQUE REFERENCES invoices(id)
|
||||||
|
);
|
||||||
|
CREATE EXTENSION "uuid-ossp";
|
||||||
|
CREATE TABLE shares(
|
||||||
|
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||||
|
market_id INTEGER REFERENCES markets(id),
|
||||||
|
description TEXT NOT NULL
|
||||||
|
);
|
||||||
CREATE TYPE order_side AS ENUM ('BUY', 'SELL');
|
CREATE TYPE order_side AS ENUM ('BUY', 'SELL');
|
||||||
CREATE TABLE orders(
|
CREATE TABLE orders(
|
||||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||||
|
|
Loading…
Reference in New Issue