20 lines
653 B
PHP
20 lines
653 B
PHP
<?php
|
|
require_once __DIR__ . '/config.php';
|
|
|
|
try {
|
|
$pdo = db();
|
|
$pdo->exec("
|
|
CREATE TABLE IF NOT EXISTS sessions (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
session_code VARCHAR(6) NOT NULL UNIQUE,
|
|
status ENUM('active', 'ended') NOT NULL DEFAULT 'active',
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
");
|
|
echo "Database table 'sessions' created successfully.\n";
|
|
} catch (PDOException $e) {
|
|
die("Database setup failed: " . $e->getMessage());
|
|
}
|
|
|