Files
whatsapp/scripts/create_survey_table.php
T
2026-01-22 10:33:16 -05:00

28 lines
812 B
PHP

<?php
require_once __DIR__ . '/../config/config.php';
$db = Database::getInstance();
try {
$col = $db->fetch("SHOW TABLES LIKE 'survey_responses'");
if ($col) {
echo "Table survey_responses already exists\n";
exit;
}
$sql = "CREATE TABLE survey_responses (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NULL,
phone_number VARCHAR(30) NULL,
q_easy_interact TINYINT(1) NULL,
q_human_resolved TINYINT(1) NULL,
rating INT NULL,
comment TEXT NULL,
raw_text TEXT NULL,
created_at DATETIME NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4";
$db->query($sql);
echo "Created table survey_responses\n";
} catch (Exception $e) {
echo "Failed creating survey_responses: " . $e->getMessage() . "\n";
}