diff --git a/services/discord-gateway/drizzle/migrations/0013_rename_mascot_chat_to_chatbot.sql b/services/discord-gateway/drizzle/migrations/0013_rename_mascot_chat_to_chatbot.sql new file mode 100644 index 0000000..0dedbee --- /dev/null +++ b/services/discord-gateway/drizzle/migrations/0013_rename_mascot_chat_to_chatbot.sql @@ -0,0 +1,19 @@ +-- Rename mascot chat tables/columns to chatbot (code rename in 977a6f9, +-- DB was never migrated). Idempotent: no-ops on databases that already +-- carry the new names (e.g. after a manual hotfix). +ALTER TABLE IF EXISTS "mascot_chat_messages" RENAME TO "chatbot_messages"; + +--> statement-breakpoint +DO $$ +BEGIN + IF EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_name = 'chatbot_messages' AND column_name = 'mascot_response' + ) THEN + ALTER TABLE "chatbot_messages" RENAME COLUMN "mascot_response" TO "bot_response"; + END IF; +END $$; + +--> statement-breakpoint +ALTER INDEX IF EXISTS "idx_mascot_chat_messages_user_created" RENAME TO "idx_chatbot_messages_user_created"; diff --git a/services/discord-gateway/drizzle/migrations/meta/_journal.json b/services/discord-gateway/drizzle/migrations/meta/_journal.json index 8edda62..3e933a2 100644 --- a/services/discord-gateway/drizzle/migrations/meta/_journal.json +++ b/services/discord-gateway/drizzle/migrations/meta/_journal.json @@ -92,6 +92,13 @@ "when": 1785500000000, "tag": "0012_add_embedding_to_text_cache", "breakpoints": true + }, + { + "idx": 13, + "version": "7", + "when": 1785551832190, + "tag": "0013_rename_mascot_chat_to_chatbot", + "breakpoints": true } ] } \ No newline at end of file