From 0827451f5ea51e90d1891da3b307b8c16a54adfd Mon Sep 17 00:00:00 2001 From: ekzyis Date: Mon, 20 Nov 2023 14:18:50 +0100 Subject: [PATCH] Fix "relation does not exist" error --- db/init.sql | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/db/init.sql b/db/init.sql index 9c7846a..63bda21 100644 --- a/db/init.sql +++ b/db/init.sql @@ -12,18 +12,6 @@ CREATE TABLE sessions( pubkey TEXT NOT NULL REFERENCES users(pubkey), 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( id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), pubkey TEXT NOT NULL REFERENCES users(pubkey), @@ -38,6 +26,18 @@ CREATE TABLE invoices( held_since TIMESTAMP WITH TIME ZONE, 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 TABLE orders( id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),