aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/sqlite
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-07-04 16:19:32 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-07-04 16:19:32 +0200
commit32bea4675dd751c0d07aa1f348b1b7201794d884 (patch)
tree01be1e7ee7b55086a3f278a55cc26964fa20320c /src/sqlite
parentstorage_sqlite: refactoring (diff)
downloadcimple-32bea4675dd751c0d07aa1f348b1b7201794d884.tar.gz
cimple-32bea4675dd751c0d07aa1f348b1b7201794d884.zip
sqlite: store new runs in SQLite
Diffstat (limited to 'src/sqlite')
-rw-r--r--src/sqlite/v01.sql17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/sqlite/v01.sql b/src/sqlite/v01.sql
index 2793b8b..44c5116 100644
--- a/src/sqlite/v01.sql
+++ b/src/sqlite/v01.sql
@@ -1,19 +1,19 @@
-CREATE TABLE cimple_repositories (
+CREATE TABLE cimple_repos (
id INTEGER PRIMARY KEY,
url TEXT NOT NULL
) STRICT;
-CREATE UNIQUE INDEX cimple_repositories_url_index ON cimple_repositories(url);
+CREATE UNIQUE INDEX cimple_repos_index_url ON cimple_repos(url);
CREATE TABLE cimple_run_status (
id INTEGER PRIMARY KEY,
label TEXT NOT NULL
) STRICT;
-CREATE UNIQUE INDEX cimple_run_status_label_index ON cimple_run_status(label);
+CREATE UNIQUE INDEX cimple_run_status_index_label ON cimple_run_status(label);
-INSERT INTO cimple_run_status(id, label) VALUES (0, 'created');
-INSERT INTO cimple_run_status(id, label) VALUES (1, 'finished');
+INSERT INTO cimple_run_status(id, label) VALUES (1, 'created');
+INSERT INTO cimple_run_status(id, label) VALUES (2, 'finished');
CREATE TABLE cimple_runs (
id INTEGER PRIMARY KEY,
@@ -21,10 +21,11 @@ CREATE TABLE cimple_runs (
result INTEGER NOT NULL,
output BLOB NOT NULL,
repo_id INTEGER NOT NULL,
+ rev TEXT NOT NULL,
FOREIGN KEY (status) REFERENCES cimple_run_status(id),
- FOREIGN KEY (repo_id) REFERENCES cimple_repositories(id)
+ FOREIGN KEY (repo_id) REFERENCES cimple_repos(id)
ON DELETE CASCADE ON UPDATE CASCADE
) STRICT;
-CREATE INDEX cimple_runs_status_index ON cimple_runs(status);
-CREATE INDEX cimple_runs_repo_id_index ON cimple_runs(repo_id);
+CREATE INDEX cimple_runs_index_status ON cimple_runs(status);
+CREATE INDEX cimple_runs_index_repo_id ON cimple_runs(repo_id);