gruby refaktor otyły panie
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class CreateBlogVisits extends AbstractMigration
|
||||
{
|
||||
public function change(): void
|
||||
{
|
||||
// create table if it does not exist
|
||||
$table = $this->table('blog_visits');
|
||||
if (!$table->exists()) {
|
||||
$table->addColumn('ip', 'string', ['null' => true, 'limit' => 255])
|
||||
->addColumn('useragent', 'text', ['null' => true])
|
||||
->addColumn('cnt', 'integer', ['default' => 0])
|
||||
->addColumn('first_seen', 'integer', ['null' => true])
|
||||
->addColumn('last_seen', 'integer', ['null' => true])
|
||||
->addIndex(['ip', 'useragent'], ['unique' => true, 'name' => 'idx_ip_useragent'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user