This commit is contained in:
你的名字
2025-10-15 14:53:54 +08:00
commit ac0f12b21a
864 changed files with 200931 additions and 0 deletions

View File

@ -0,0 +1,43 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class ArticleCates extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$this->table('article_cates')->drop()->save();
$this->table('article_cates', ['comment' => '文章分类表'])
->addColumn('title', 'string', ['limit' => 50, 'null' => false, 'comment' => '分类名称'])
->addColumn('sort', 'integer', ['default' => 0, 'null' => false, 'comment' => '排序'])
->addColumn('status', 'boolean', ['default' => 1, 'null' => false, 'comment' => '状态 1:启用 0:禁用'])
->addColumn('create_time', 'integer', ['null' => true, 'comment' => '创建时间'])
->addColumn('update_time', 'integer', ['null' => true, 'comment' => '更新时间'])
->addIndex(['title'], ['unique' => true, 'name' => 'idx_title'])
->addIndex(['status','sort'], ['name' => 'idx_status_sort'])
->addIndex(['create_time','sort'], ['name' => 'idx_create_time_sort'])
->save();
}
}