fix(db): migration 0013 rename mascot_chat_messages to chatbot_messages
Build & Deploy (Nix) / build-and-deploy (backend) (push) Successful in 2m17s
Build & Deploy (Nix) / build-and-deploy (discord-gateway) (push) Successful in 2m59s
Build & Deploy (Nix) / build-and-deploy (proxy) (push) Successful in 3m7s
Build & Deploy (Nix) / build-and-deploy (backend) (push) Successful in 2m17s
Build & Deploy (Nix) / build-and-deploy (discord-gateway) (push) Successful in 2m59s
Build & Deploy (Nix) / build-and-deploy (proxy) (push) Successful in 3m7s
/api/chat/history 500 (relation "chatbot_messages" does not exist):
codebase di-rename mascot->chatbot (977a6f9) tapi tabel DB tidak
pernah di-migrate — backend SELECT dari chatbot_messages, DB masih
mascot_chat_messages dengan kolom mascot_response.
- Migration 0013 (idempotent): ALTER TABLE mascot_chat_messages RENAME
TO chatbot_messages, RENAME COLUMN mascot_response -> bot_response,
RENAME INDEX -> idx_chatbot_messages_user_created; journal when >
max(created_at) di __drizzle_migrations (0012)
- Diterapkan live via psql; riwayat chat lama tetap ada
- Verifikasi: GET /api/chat/history 200 + data, POST /api/chat 200
+ tersimpan (total history 1 -> 2)
This commit is contained in:
@@ -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";
|
||||||
@@ -92,6 +92,13 @@
|
|||||||
"when": 1785500000000,
|
"when": 1785500000000,
|
||||||
"tag": "0012_add_embedding_to_text_cache",
|
"tag": "0012_add_embedding_to_text_cache",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 13,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1785551832190,
|
||||||
|
"tag": "0013_rename_mascot_chat_to_chatbot",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user