squeaknode/squeaknode/client/schema.sql
Jonathan Zernik 7ae6ea1f08
Upload squeaks to server (#13)
* Include address in squeak database.

* Add tables to db for uploader

* Include address in squeak database.

* Add tables to db for uploader

* Add uploader class.

* Fix foreign key relation in client db.

* Change uploader to check all squeaks based on address and block number.

* Start and stop uploader thread in client.
2020-04-09 17:49:53 -07:00

41 lines
1 KiB
SQL

-- Initialize the database.
-- Drop any existing data and create empty tables.
DROP TABLE IF EXISTS post;
CREATE TABLE squeak (
hash TEXT PRIMARY KEY,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
nVersion INTEGER NOT NULL,
hashEncContent TEXT NOT NULL,
hashReplySqk TEXT NOT NULL,
hashBlock TEXT NOT NULL,
nBlockHeight INTEGER NOT NULL,
scriptPubKey BLOB NOT NULL,
hashDataKey TEXT NOT NULL,
vchIv TEXT NOT NULL,
nTime INTEGER NOT NULL,
nNonce INTEGER NOT NULL,
encContent BLOB NOT NULL,
scriptSig BLOB NOT NULL,
address TEXT NOT NULL,
vchDataKey TEXT,
content BLOB
);
CREATE TABLE hub (
host TEXT NOT NULL,
port TEXT NOT NULL,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(host, port)
);
CREATE TABLE upload (
id INTEGER PRIMARY KEY AUTOINCREMENT,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
squeakHash TEXT NOT NULL,
complete INTEGER NOT NULL,
FOREIGN KEY (squeakHash) REFERENCES [squeak] (hash) ON UPDATE NO ACTION ON DELETE CASCADE
);