aboutsummaryrefslogtreecommitdiff
path: root/migrations/0003-unique-state-key.sql
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2023-04-23 15:04:34 -0400
committerCara Salter <cara@devcara.com>2023-04-23 15:04:34 -0400
commitb629b237da6c7618ae7e679a2c9b879c6019662d (patch)
tree2aded5e0b797e26f7774052dfedc0951d2adc4a4 /migrations/0003-unique-state-key.sql
parent6c16d4315b5d97316db25b5a79ccee8fa1d4e953 (diff)
download142bot-b629b237da6c7618ae7e679a2c9b879c6019662d.tar.gz
142bot-b629b237da6c7618ae7e679a2c9b879c6019662d.zip
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
Diffstat (limited to 'migrations/0003-unique-state-key.sql')
-rw-r--r--migrations/0003-unique-state-key.sql2
1 files changed, 2 insertions, 0 deletions
diff --git a/migrations/0003-unique-state-key.sql b/migrations/0003-unique-state-key.sql
new file mode 100644
index 0000000..1d19219
--- /dev/null
+++ b/migrations/0003-unique-state-key.sql
@@ -0,0 +1,2 @@
+ALTER TABLE bot_state DROP CONSTRAINT IF EXISTS setting_unique;
+ALTER TABLE bot_state ADD CONSTRAINT setting_unique UNIQUE (setting); \ No newline at end of file