37332-vm/db/migrations/002_create_users_table.php
Flatlogic Bot 298521e30e bb
2026-01-09 01:55:06 +00:00

25 lines
641 B
PHP

<?php
require_once __DIR__ . '/../../db/config.php';
try {
$pdo = db();
$sql = "
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
role ENUM('user', 'manager', 'admin') NOT NULL DEFAULT 'user',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=INNODB;
";
$pdo->exec($sql);
echo "Migration 002 completed successfully: 'users' table created." . PHP_EOL;
} catch (PDOException $e) {
die("Migration 002 failed: " . $e->getMessage());
}
?>