From b629b237da6c7618ae7e679a2c9b879c6019662d Mon Sep 17 00:00:00 2001
From: Cara Salter <cara@devcara.com>
Date: Sun, 23 Apr 2023 15:04:34 -0400
Subject: sql: Implement bot state

Allows for persistent, dynamic storage of configuration options outside
of the config.json file.

The bot_state table is, essentially, a key-value store for config
options. There are two new prepared statements, `state` and
`update_state`:

- `state` will return the value for the provided key
- `update_state` will create the key or update an existing key
---
 migrations/0002-state.sql | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 migrations/0002-state.sql

(limited to 'migrations/0002-state.sql')

diff --git a/migrations/0002-state.sql b/migrations/0002-state.sql
new file mode 100644
index 0000000..2465d30
--- /dev/null
+++ b/migrations/0002-state.sql
@@ -0,0 +1,5 @@
+CREATE TABLE IF NOT EXISTS bot_state (
+    id SERIAL PRIMARY KEY,
+    setting TEXT NOT NULL,
+    value TEXT NOT NULL
+);
\ No newline at end of file
-- 
cgit v1.2.3

