View file database/migrations/20180420180022_create_inbox_table.php

File size: 674B
<?php

use Phinx\Migration\AbstractMigration;

class CreateInboxTable extends AbstractMigration
{
    /**
     * Change Method.
     */
    public function change()
    {
        if (! $this->hasTable('inbox')) {
            $table = $this->table('inbox', ['collation' => env('DB_COLLATION')]);
            $table
                ->addColumn('user_id', 'integer')
                ->addColumn('author_id', 'integer', ['null' => true])
                ->addColumn('text', 'text', ['null' => true])
                ->addColumn('created_at', 'integer')
                ->addIndex('user_id')
                ->addIndex('created_at')
                ->create();
        }
    }
}