idk anymore! please put the dog down (me)!

This commit is contained in:
2026-04-19 19:22:38 +02:00
commit b6a258b3cf
16 changed files with 324 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php
use src\Database;
require_once __DIR__ . '/Database.php';
$db = Database::getInstance();
$db->exec("CREATE TABLE IF NOT EXISTS users (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
)");
$db->exec("CREATE TABLE IF NOT EXISTS posts (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
user_id INT UNSIGNED NOT NULL,
title VARCHAR(255) NOT NULL,
body TEXT NOT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
)");
echo "Migrations ran successfully.\n";