Просмотр файла upgrade/migrations/20161211235433_rename_indexes_in_counter24.php

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

use Phinx\Migration\AbstractMigration;

class RenameIndexesInCounter24 extends AbstractMigration
{
    /**
     * Migrate Up.
     */
    public function up()
    {
        $table = $this->table('counter24');
        $table->removeIndexByName('count_hour');
        $table->addIndex('hour', ['unique' => true])
            ->save();
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        $table = $this->table('counter24');
        $table->removeIndexByName('hour');
        $table->addIndex('hour', ['unique' => true, 'name' => 'count_hour'])
            ->save();
    }
}