fix(telegram): drop and recreate telegram_users table for schema change

The old table had hub_url column; new schema uses hub_id + agent_id.
CREATE TABLE IF NOT EXISTS won't alter existing tables, so drop first.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
yushen 2026-02-10 16:06:58 +08:00
parent 483f4a2f59
commit 6284ffd74a

View file

@ -39,10 +39,11 @@ export class TelegramUserStore implements OnModuleInit {
console.log("[TelegramUserStore] Done");
}
/** Create telegram_users table if not exists */
/** Drop and recreate telegram_users table (schema changed: hub_url -> hub_id + agent_id) */
private async ensureTable(): Promise<void> {
await this.db.execute("DROP TABLE IF EXISTS telegram_users");
const sql = `
CREATE TABLE IF NOT EXISTS telegram_users (
CREATE TABLE telegram_users (
telegram_user_id VARCHAR(64) PRIMARY KEY,
hub_id VARCHAR(64) NOT NULL,
agent_id VARCHAR(64) NOT NULL,