table('articles')->drop()->save(); $this->table('articles', ['comment' => '文章表']) ->addColumn('title', 'string', ['limit' => 50, 'null' => false, 'comment' => '分类名称']) ->addColumn('cate_id', 'integer', ['null' => false, 'comment' => '分类ID']) ->addColumn('cover', 'string', ['limit' => 255, 'null' => true, 'default' => '', 'comment' => '封面']) ->addColumn('summary', 'string', ['limit' => 255, 'null' => true, 'default' => '', 'comment' => '简介']) ->addColumn('content', 'text', ['null' => true, 'comment' => '内容']) ->addColumn('author', 'string', ['limit' => 50, 'null' => true, 'default' => '', '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','cate_id'], ['unique' => true, 'name' => 'idx_title_cate_id']) ->addIndex(['status','sort'], ['name' => 'idx_status_sort']) ->addIndex(['create_time','sort'], ['name' => 'idx_create_time_sort']) ->save(); } }