View file database/migrations/20180420180046_create_surprise_table.php
<?php use Phinx\Migration\AbstractMigration; class CreateSurpriseTable extends AbstractMigration { /** * Change Method. */ public function change() { if (! $this->hasTable('surprise')) { $table = $this->table('surprise', ['engine' => config('DB_ENGINE'), 'collation' => config('DB_COLLATION')]); $table ->addColumn('user_id', 'integer') ->addColumn('year', 'year', ['limit' => 4]) ->addColumn('created_at', 'integer') ->addIndex('user_id') ->create(); } } }