chore: complete update
This commit is contained in:
36
src/Domain/User/Migrations/CreateUsersTable.php
Normal file
36
src/Domain/User/Migrations/CreateUsersTable.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Domain\User\Migrations;
|
||||
|
||||
use App\Framework\Database\ConnectionInterface;
|
||||
use App\Framework\Database\Migration\Migration;
|
||||
|
||||
final readonly class CreateUsersTable implements Migration
|
||||
{
|
||||
|
||||
public function up(ConnectionInterface $connection): void
|
||||
{
|
||||
$connection->query("CREATE TABLE IF NOT EXISTS users (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
ulid BINARY(16) NOT NULL UNIQUE,
|
||||
name VARCHAR(255) NOT NULL
|
||||
)"
|
||||
);
|
||||
}
|
||||
|
||||
public function down(ConnectionInterface $connection): void
|
||||
{
|
||||
$connection->query("DROP TABLE users");
|
||||
}
|
||||
|
||||
public function getVersion(): string
|
||||
{
|
||||
return "001";
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return "Create Users Table";
|
||||
}
|
||||
}
|
||||
23
src/Domain/User/User.php
Normal file
23
src/Domain/User/User.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\User;
|
||||
|
||||
use App\Framework\Database\Attributes\Column;
|
||||
use App\Framework\Database\Attributes\Entity;
|
||||
|
||||
#[Entity(tableName: 'users')]
|
||||
final readonly class User
|
||||
{
|
||||
public function __construct(
|
||||
#[Column(name: 'id', primary: true)]
|
||||
public string $id,
|
||||
|
||||
#[Column(name: 'name')]
|
||||
public string $name,
|
||||
|
||||
#public ?string $email = null,
|
||||
|
||||
/*#[Column(name: 'email')]
|
||||
public string $email*/
|
||||
) {}
|
||||
}
|
||||
Reference in New Issue
Block a user