增加文章详情以及相关策略
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class CreateArticleViewTable extends Migrator
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('yz_article_view', ['engine' => 'InnoDB', 'collation' => 'utf8mb4_unicode_ci']);
|
||||
$table
|
||||
->addColumn('article_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '文章ID'])
|
||||
->addColumn('ip', 'string', ['limit' => 50, 'null' => false, 'comment' => '访问IP'])
|
||||
->addColumn('view_time', 'integer', ['signed' => false, 'null' => false, 'comment' => '访问时间'])
|
||||
->addIndex(['article_id', 'ip', 'view_time'], ['name' => 'idx_article_ip_time'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user