22 lines
782 B
PHP
22 lines
782 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class CreateUsers extends AbstractMigration
|
|
{
|
|
public function change(): void
|
|
{
|
|
$table = $this->table('users', ['id' => false, 'primary_key' => ['id']]);
|
|
$table
|
|
->addColumn('id', 'uuid', ['null' => false])
|
|
->addColumn('username', 'string', ['limit' => 255, 'null' => false])
|
|
->addColumn('password_hash', 'string', ['limit' => 255, 'null' => false])
|
|
->addColumn('created_at', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP'])
|
|
->addColumn('updated_at', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP'])
|
|
->addIndex(['username'], ['unique' => true])
|
|
->create();
|
|
}
|
|
}
|