38676-vm/db/migrate_project_logs.php
Flatlogic Bot 2c4e1bc5b5 Alpha V0.9
2026-02-25 19:19:04 +00:00

28 lines
828 B
PHP

<?php
require_once __DIR__ . '/config.php';
$db = db();
$sql = "
CREATE TABLE IF NOT EXISTS project_logs (
id INT AUTO_INCREMENT PRIMARY KEY,
version VARCHAR(50) NOT NULL,
title VARCHAR(255) NOT NULL,
content TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
";
try {
$db->exec($sql);
echo "Table 'project_logs' created successfully.\n";
// Insert initial version
$stmt = $db->prepare("INSERT INTO project_logs (version, title, content) VALUES (?, ?, ?)");
$stmt->execute(['1.0.0', 'Initial Release', 'Welcome to the project log. This is the first version of the galaxy management system.']);
echo "Initial log entry inserted.\n";
} catch (PDOException $e) {
echo "Error creating table: " . $e->getMessage() . "\n";
}