summaryrefslogtreecommitdiff
path: root/pkg/database/sql
diff options
context:
space:
mode:
authorJulien Dessaux2024-10-14 23:54:49 +0200
committerJulien Dessaux2024-10-14 23:54:49 +0200
commit3319e74279af910523f068a96eea169c7a60d70d (patch)
treef309498f1d09f0549f2a63a5fa5b3aa15d41232a /pkg/database/sql
parentfeat(logger): implement optional body logging (diff)
downloadtfstated-3319e74279af910523f068a96eea169c7a60d70d.tar.gz
tfstated-3319e74279af910523f068a96eea169c7a60d70d.tar.bz2
tfstated-3319e74279af910523f068a96eea169c7a60d70d.zip
feat(tfstated): implement states versioning
Diffstat (limited to 'pkg/database/sql')
-rw-r--r--pkg/database/sql/000_init.sql9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/database/sql/000_init.sql b/pkg/database/sql/000_init.sql
index 8278433..08a58cd 100644
--- a/pkg/database/sql/000_init.sql
+++ b/pkg/database/sql/000_init.sql
@@ -5,7 +5,14 @@ CREATE TABLE schema_version (
CREATE TABLE states (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
- data BLOB,
lock TEXT
) STRICT;
CREATE UNIQUE INDEX states_name on states(name);
+
+CREATE TABLE versions (
+ id INTEGER PRIMARY KEY,
+ state_id INTEGER,
+ data BLOB,
+ created INTEGER DEFAULT (unixepoch()),
+ FOREIGN KEY(state_id) REFERENCES states(id) ON DELETE CASCADE
+) STRICT;