summaryrefslogtreecommitdiff
path: root/pkg/database/sql/000_init.sql
blob: 9c9c07cfa28eadec0ebef90a4361140abe341121 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
CREATE TABLE schema_version (
  version INTEGER NOT NULL
) STRICT;

CREATE TABLE states (
  id INTEGER PRIMARY KEY,
  name TEXT NOT NULL,
  lock TEXT
) STRICT;
CREATE UNIQUE INDEX states_name on states(name);

CREATE TABLE versions (
  id INTEGER PRIMARY KEY,
  state_id INTEGER,
  data BLOB,
  lock TEXT,
  created INTEGER DEFAULT (unixepoch()),
  FOREIGN KEY(state_id) REFERENCES states(id) ON DELETE CASCADE
) STRICT;