View file database/migrations/20180420180013_create_counters24_table.php

File size: 607B
<?php

use Phinx\Migration\AbstractMigration;
use Phinx\Db\Adapter\MysqlAdapter;

class CreateCounters24Table extends AbstractMigration
{
    /**
     * Change Method.
     */
    public function change()
    {
        if (! $this->hasTable('counters24')) {
            $table = $this->table('counters24', ['collation' => env('DB_COLLATION')]);
            $table
                ->addColumn('hour', 'integer')
                ->addColumn('hosts', 'integer')
                ->addColumn('hits', 'integer')
                ->addIndex('hour', ['unique' => true])
                ->create();
        }
    }
}