summaryrefslogtreecommitdiff
path: root/nodejs/database/000_init.sql
blob: c1fbb98306a9a012968e0e2f481a893cee385f6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CREATE TABLE schema_version (
	version INTEGER NOT NULL
);
CREATE TABLE tokens (
	id INTEGER PRIMARY KEY,
	data TEXT NOT NULL
);
CREATE TABLE agents (
	id INTEGER PRIMARY KEY,
	data TEXT NOT NULL
);
CREATE TABLE contracts (
	id INTEGER PRIMARY KEY,
	data TEXT NOT NULL
);
CREATE UNIQUE INDEX contracts_data_id ON contracts (json_extract(data, '$.id'));
CREATE INDEX contracts_data_fulfilled ON contracts (json_extract(data, '$.fulfilled'));