mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 05:12:14 +00:00
chore(db): make the 0187 telegram-prompt-context migration rerun-safe
Guard the CREATE TABLE + both CREATE INDEX statements with IF NOT EXISTS so a re-run on a database that already has the table is a no-op, matching the guard convention every other recent migration ships with. Semantics are unchanged — same table, same columns, same indexes.
This commit is contained in:
1 parent
868dfb72bd
commit
5c0583133d
1 file changed
+7
-3
@@ -1,6 +1,10 @@
|
||||
-- v1.19.0 — force-reply correlation for the interactive mood reminder.
|
||||
-- Maps a bot prompt message to the entry a free-text reply attaches to.
|
||||
CREATE TABLE "telegram_prompt_contexts" (
|
||||
--
|
||||
-- Idempotent guards (`IF NOT EXISTS`) so a rerun is safe on prod. The
|
||||
-- semantics are unchanged from the original cut (same table, same columns,
|
||||
-- same indexes) — v1.19.2 added only the guards.
|
||||
CREATE TABLE IF NOT EXISTS "telegram_prompt_contexts" (
|
||||
"id" TEXT NOT NULL,
|
||||
"user_id" TEXT NOT NULL,
|
||||
"chat_id" TEXT NOT NULL,
|
||||
@@ -14,7 +18,7 @@ CREATE TABLE "telegram_prompt_contexts" (
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "telegram_prompt_contexts_chat_id_prompt_msg_id_key" ON "telegram_prompt_contexts"("chat_id", "prompt_msg_id");
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS "telegram_prompt_contexts_chat_id_prompt_msg_id_key" ON "telegram_prompt_contexts"("chat_id", "prompt_msg_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "telegram_prompt_contexts_expires_at_idx" ON "telegram_prompt_contexts"("expires_at");
|
||||
CREATE INDEX IF NOT EXISTS "telegram_prompt_contexts_expires_at_idx" ON "telegram_prompt_contexts"("expires_at");
|
||||
Reference in new issue
Block a user