hasTable($table)) { return; } // 创建数据表 $this->table($table, [ 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '数据-文章', ]) ->addColumn('code', 'string', ['limit' => 20, 'default' => '', 'comment' => '文章编号']) ->addColumn('name', 'string', ['limit' => 100, 'default' => '', 'comment' => '文章标题']) ->addColumn('mark', 'string', ['limit' => 200, 'default' => '', 'comment' => '文章标签']) ->addColumn('cover', 'string', ['limit' => 500, 'default' => '', 'comment' => '文章封面']) ->addColumn('remark', 'string', ['limit' => 500, 'default' => '', 'comment' => '备注说明']) ->addColumn('content', 'text', ['default' => null, 'comment' => '文章内容']) ->addColumn('num_like', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '文章点赞数']) ->addColumn('num_read', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '文章阅读数']) ->addColumn('num_collect', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '文章收藏数']) ->addColumn('num_comment', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '文章评论数']) ->addColumn('sort', 'integer', ['limit' => 20, 'default' => 0, 'comment' => '排序权重']) ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '文章状态(1使用,0禁用)']) ->addColumn('deleted', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '删除状态(0未删,1已删)']) ->addColumn('create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间']) ->save(); } }