Add offer table (#229)

* Add offer table to db schema

* Add offer table to db schema

* Add sent payment table
This commit is contained in:
Jonathan Zernik 2020-08-05 04:16:08 -07:00 committed by GitHub
parent fc08f74801
commit 4e58415299
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,3 +42,31 @@ CREATE TABLE IF NOT EXISTS peer (
uploading BOOLEAN NOT NULL,
downloading BOOLEAN NOT NULL
);
CREATE TABLE IF NOT EXISTS offer (
offer_id SERIAL PRIMARY KEY,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
squeak_hash CHAR(64) NOT NULL,
key_cipher bytea NOT NULL,
iv bytea NOT NULL,
preimage_hash CHAR(64) NOT NULL,
amount INTEGER NOT NULL,
payment_request TEXT NOT NULL,
node_pubkey VARCHAR(66) NOT NULL,
node_host VARCHAR(256) NOT NULL,
node_port INTEGER NOT NULL,
peer_id INTEGER NOT NULL
);
CREATE TABLE IF NOT EXISTS sent_payment (
sent_payment_id SERIAL PRIMARY KEY,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
offer_id INTEGER NOT NULL,
peer_id INTEGER NOT NULL,
squeak_hash CHAR(64) NOT NULL,
preimage_hash CHAR(64) NOT NULL,
preimage CHAR(64) NOT NULL,
amount INTEGER NOT NULL,
node_pubkey VARCHAR(66) NOT NULL,
preimage_is_valid BOOLEAN NOT NULL
);