summaryrefslogtreecommitdiffstats
path: root/db/patch-monitor-tls-info-add-fk.sql
diff options
context:
space:
mode:
Diffstat (limited to 'db/patch-monitor-tls-info-add-fk.sql')
-rw-r--r--db/patch-monitor-tls-info-add-fk.sql18
1 files changed, 18 insertions, 0 deletions
diff --git a/db/patch-monitor-tls-info-add-fk.sql b/db/patch-monitor-tls-info-add-fk.sql
new file mode 100644
index 0000000..9b9c2d2
--- /dev/null
+++ b/db/patch-monitor-tls-info-add-fk.sql
@@ -0,0 +1,18 @@
+BEGIN TRANSACTION;
+
+PRAGMA writable_schema = TRUE;
+
+UPDATE
+ SQLITE_MASTER
+SET
+ sql = replace(sql,
+ 'monitor_id INTEGER NOT NULL',
+ 'monitor_id INTEGER NOT NULL REFERENCES [monitor] ([id]) ON DELETE CASCADE ON UPDATE CASCADE'
+)
+WHERE
+ name = 'monitor_tls_info'
+ AND type = 'table';
+
+PRAGMA writable_schema = RESET;
+
+COMMIT;