20 lines
536 B
PHP
20 lines
536 B
PHP
<?php
|
|
require_once __DIR__ . '/../config.php';
|
|
|
|
try {
|
|
$pdo = db();
|
|
$sql = "
|
|
CREATE TABLE IF NOT EXISTS competitions (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
title VARCHAR(255) NOT NULL,
|
|
description TEXT,
|
|
start_date DATETIME,
|
|
end_date DATETIME,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
);";
|
|
$pdo->exec($sql);
|
|
echo "Table 'competitions' created successfully (if it didn't exist)." . PHP_EOL;
|
|
} catch (PDOException $e) {
|
|
die("DB ERROR: " . $e->getMessage());
|
|
}
|