修改数据库文件

This commit is contained in:
邹景立 2022-10-13 17:10:09 +08:00
parent a6709b275f
commit 6a7c9a2a0b
5 changed files with 30 additions and 20 deletions

View File

@ -7,16 +7,18 @@ use think\migration\Migrator;
*/ */
class WechatFans extends Migrator class WechatFans extends Migrator
{ {
private $name = 'wechat_fans';
public function change() public function change()
{ {
// 当前操作
$table = 'wechat_fans';
// 存在则跳过 // 存在则跳过
if ($this->hasTable($this->name)) { if ($this->hasTable($table)) {
return; return;
} }
// 创建数据表 // 创建数据表
$this->table($this->name, [ $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-粉丝', 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-粉丝',
]) ])
->addColumn('appid', 'string', ['limit' => 50, 'default' => '', 'comment' => '公众号编号']) ->addColumn('appid', 'string', ['limit' => 50, 'default' => '', 'comment' => '公众号编号'])

View File

@ -7,16 +7,18 @@ use think\migration\Migrator;
*/ */
class WechatFansTags extends Migrator class WechatFansTags extends Migrator
{ {
private $name = 'wechat_fans_tags';
public function change() public function change()
{ {
// 当前操作
$table = 'wechat_fans_tags';
// 存在则跳过 // 存在则跳过
if ($this->hasTable($this->name)) { if ($this->hasTable($table)) {
return; return;
} }
// 创建数据表 // 创建数据表
$this->table($this->name, [ $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-标签', 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-标签',
]) ])
->addColumn('appid', 'string', ['limit' => 50, 'default' => '', 'comment' => '公众号编号']) ->addColumn('appid', 'string', ['limit' => 50, 'default' => '', 'comment' => '公众号编号'])

View File

@ -7,16 +7,18 @@ use think\migration\Migrator;
*/ */
class WechatKeys extends Migrator class WechatKeys extends Migrator
{ {
private $name = 'wechat_keys';
public function change() public function change()
{ {
// 当前操作
$table = 'wechat_keys';
// 存在则跳过 // 存在则跳过
if ($this->hasTable($this->name)) { if ($this->hasTable($table)) {
return; return;
} }
// 创建数据表 // 创建数据表
$this->table($this->name, [ $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-规则', 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-规则',
]) ])
->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'comment' => '类型(text,image,news)']) ->addColumn('type', 'string', ['limit' => 20, 'default' => '', 'comment' => '类型(text,image,news)'])

View File

@ -7,16 +7,18 @@ use think\migration\Migrator;
*/ */
class WechatMedia extends Migrator class WechatMedia extends Migrator
{ {
private $name = 'wechat_media';
public function change() public function change()
{ {
// 当前操作
$table = 'wechat_media';
// 存在则跳过 // 存在则跳过
if ($this->hasTable($this->name)) { if ($this->hasTable($table)) {
return; return;
} }
// 创建数据表 // 创建数据表
$this->table($this->name, [ $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-素材', 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-素材',
]) ])
->addColumn('md5', 'string', ['limit' => 32, 'default' => '', 'comment' => '文件哈希']) ->addColumn('md5', 'string', ['limit' => 32, 'default' => '', 'comment' => '文件哈希'])

View File

@ -7,16 +7,18 @@ use think\migration\Migrator;
*/ */
class WechatNews extends Migrator class WechatNews extends Migrator
{ {
private $name = 'wechat_news';
public function change() public function change()
{ {
// 当前操作
$table = 'wechat_news';
// 存在则跳过 // 存在则跳过
if ($this->hasTable($this->name)) { if ($this->hasTable($table)) {
return; return;
} }
// 创建数据表 // 创建数据表
$this->table($this->name, [ $this->table($table, [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-图文', 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '微信-图文',
]) ])
->addColumn('media_id', 'string', ['limit' => 100, 'default' => '', 'comment' => '永久素材编号']) ->addColumn('media_id', 'string', ['limit' => 100, 'default' => '', 'comment' => '永久素材编号'])