Added migration file
This commit is contained in:
24
src/Database/Migration.php
Normal file
24
src/Database/Migration.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Database;
|
||||
|
||||
use Medoo\Medoo;
|
||||
|
||||
final class Migration
|
||||
{
|
||||
public static function run(Medoo $db): void
|
||||
{
|
||||
$db->pdo->exec("
|
||||
CREATE TABLE IF NOT EXISTS post (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
title TEXT NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
slug TEXT UNIQUE NOT NULL DEFAULT '',
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
)
|
||||
");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user