Migraciones
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user