Files
nabeh/backend/migrate_telegram_sessions.php

1 line
2.2 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
[{"/app/bootstrap.php":"use AppCoreDatabase;\n\ntry {\n $pdo = Database::getConnection();\n\n echo","Migrations":"Telegram Bot Integration ===","\n CREATE TABLE IF NOT EXISTS `telegram_sessions` (\n `id` INT AUTO_INCREMENT PRIMARY KEY,\n `company_id` INT NOT NULL,\n `name` VARCHAR(255) NOT NULL COMMENT 'e.g., Support Bot, Sales Bot',\n `bot_token` TEXT NOT NULL COMMENT 'Encrypted using AES-256-GCM',\n `bot_username` VARCHAR(255) DEFAULT NULL,\n `bot_id` BIGINT DEFAULT NULL COMMENT 'Telegram Bot ID from getMe',\n `webhook_url` TEXT DEFAULT NULL,\n `status` ENUM('connected', 'disconnected', 'error') DEFAULT 'disconnected',\n `allowed_updates` JSON DEFAULT NULL COMMENT 'Array of update types to receive',\n `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n FOREIGN KEY (`company_id`) REFERENCES `companies`(`id`) ON DELETE CASCADE,\n UNIQUE KEY `company_bot_unique` (`company_id`, `bot_username`)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;":"Database::execute($createSessionsTableSql);\n echo","telegram_sessions":"erified/created.","Database":"select(","telegram_session_id":"if (empty($columns)) {\n Database::execute(","meta_session_id`":"Database::execute(","✅ Added 'telegram_session_id' column and foreign key constraint to 'messages_log'.":""},{" Column 'telegram_session_id' already exists in 'messages_log'. Skipping.":""},{"Database":"execute(","session_id`":"Database::execute(","✅ Added 'telegram_session_id' column to 'chatbot_rules'.":""},{" Column 'telegram_session_id' already exists in 'chatbot_rules'. Skipping.":""},{"Database":"execute(","company_id`":"Database::execute(","✅ Added 'telegram_session_id' column to 'conversation_states'.":""},{" Column 'telegram_session_id' already exists in 'conversation_states'. Skipping.":""},{"Database":"execute(","✅ Added 'telegram_requests' column to 'company_subscription_usage'.":""},{" Column 'telegram_requests' already exists in 'company_subscription_usage'. Skipping.":""},{"❌ Migration error: \" . $e->getMessage() . \"":""}]