Migraciones

This commit is contained in:
Juan Pablo Vial
2024-11-28 11:37:26 -03:00
parent dafabdbbdb
commit 57fc6fa46e
11 changed files with 214 additions and 872 deletions

View File

@ -0,0 +1,19 @@
<?php
use Phinx\Db\Adapter\MysqlAdapter;
class CreateLogins extends \Phinx\Migration\AbstractMigration
{
public function change(): void
{
$this->table('logins')
->addColumn('user_id', 'integer', ['null' => false, 'limit' => 10, 'signed' => false])
->addColumn('time', 'datetime', ['null' => false])
->addColumn('selector', 'string', ['null' => false, 'limit' => 255, 'collation' => 'utf8mb4_general_ci', 'encoding' => 'utf8mb4'])
->addColumn('token', 'string', ['null' => false, 'limit' => 255, 'collation' => 'utf8mb4_general_ci', 'encoding' => 'utf8mb4'])
->addColumn('status', 'integer', ['null' => false, 'default' => '1', 'limit' => 1])
->addIndex(['user_id'], ['name' => 'fk_logins_users', 'unique' => false])
->addForeignKey('user_id', 'users', 'id', ['constraint' => 'fk_logins_users', 'update' => 'CASCADE', 'delete' => 'CASCADE'])
->create();
}
}