Autosave: 20260305-003400

This commit is contained in:
Flatlogic Bot 2026-03-05 00:34:00 +00:00
parent 68b13ff62d
commit d27da3b323

21
db/migrate_users.php Normal file
View File

@ -0,0 +1,21 @@
<?php
require_once __DIR__ . '/config.php';
$db = db();
$sql = "CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) NOT NULL UNIQUE,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
role VARCHAR(50) DEFAULT 'user',
last_login TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)";
try {
$db->exec($sql);
echo "Table 'users' created successfully.";
} catch (Exception $e) {
echo "Error creating table 'users': " . $e->getMessage();
}