summaryrefslogtreecommitdiff
path: root/src/sql/config.sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql/config.sql')
-rw-r--r--src/sql/config.sql34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/sql/config.sql b/src/sql/config.sql
new file mode 100644
index 0000000..53eb279
--- /dev/null
+++ b/src/sql/config.sql
@@ -0,0 +1,34 @@
+; "Litestream requires periodic but short write locks on the database when
+; checkpointing occurs":
+; https://litestream.io/tips/#busy-timeout
+PRAGMA busy_timeout = 5000;
+
+; "Litestream only works with the SQLite WAL journaling mode":
+; https://litestream.io/tips/#wal-journal-mode
+PRAGMA journal_mode = WAL;
+
+; "(...) change the synchronous mode to NORMAL (it typically defaults to FULL)":
+; https://litestream.io/tips/#synchronous-pragma
+; "WAL mode is safe from corruption with synchronous=NORMAL":
+; https://www.sqlite.org/pragma.html#pragma_synchronous
+PRAGMA synchronous = NORMAL;
+
+; "(...) can perform a checkpoint in between Litestream-initiated checkpoints
+; and cause Litestream to miss a WAL file":
+; https://litestream.io/tips/#disable-autocheckpoints-for-high-write-load-servers
+PRAGMA wal_autocheckpoint = 0;
+
+; "This pragma does a low-level formatting and consistency check of the
+; database":
+; https://www.sqlite.org/pragma.html#pragma_integrity_check
+PRAGMA integrity_check;
+
+; "The foreign_key_check pragma checks the database, or the table called
+ \"table-name\", for foreign key constraints that are violated":
+; https://www.sqlite.org/pragma.html#pragma_foreign_key_check
+PRAGMA foreign_key_check;
+
+
+CREATE TABLE IF NO EXISTS migrations (
+ name TEXT PRIMARY KEY
+);