Просмотр файла database/upgrades/20170911011432_delete_trash_table.php

Размер файла: 797B
<?php

use Phinx\Migration\AbstractMigration;

class DeleteTrashTable extends AbstractMigration
{
    /**
     * Migrate Up.
     */
    public function up()
    {
        $this->dropTable('trash');
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        if (! $this->hasTable('trash')) {
            $table = $this->table('trash', ['collation' => env('DB_COLLATION')]);
            $table->addColumn('user_id', 'integer')
                ->addColumn('author_id', 'integer')
                ->addColumn('text', 'text', ['null' => true])
                ->addColumn('created_at', 'integer')
                ->addColumn('deleted_at', 'integer')
                ->addIndex('created_at')
                ->addIndex('user_id')
                ->create();
        }
    }
}