m220227_143427_common_addons.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. use yii\db\Migration;
  3. class m220227_143427_common_addons extends Migration
  4. {
  5. public function up()
  6. {
  7. /* 取消外键约束 */
  8. $this->execute('SET foreign_key_checks = 0');
  9. /* 创建表 */
  10. $this->createTable('{{%common_addons}}', [
  11. 'id' => "int(11) NOT NULL AUTO_INCREMENT COMMENT '主键'",
  12. 'title' => "varchar(20) NOT NULL DEFAULT '' COMMENT '中文名'",
  13. 'name' => "varchar(100) NOT NULL DEFAULT '' COMMENT '插件名或标识'",
  14. 'title_initial' => "varchar(1) NOT NULL DEFAULT '' COMMENT '首字母拼音'",
  15. 'bootstrap' => "varchar(255) NULL DEFAULT '' COMMENT '启用文件'",
  16. 'service' => "varchar(255) NULL DEFAULT '' COMMENT '服务调用类'",
  17. 'cover' => "varchar(200) NULL DEFAULT '' COMMENT '封面'",
  18. 'group' => "varchar(20) NULL DEFAULT '' COMMENT '组别'",
  19. 'brief_introduction' => "varchar(140) NULL DEFAULT '' COMMENT '简单介绍'",
  20. 'description' => "varchar(1000) NULL DEFAULT '' COMMENT '插件描述'",
  21. 'author' => "varchar(40) NULL DEFAULT '' COMMENT '作者'",
  22. 'version' => "varchar(20) NULL DEFAULT '1.0.0' COMMENT '版本号'",
  23. 'is_merchant_route_map' => "tinyint(1) NULL DEFAULT '0' COMMENT '商户路由映射'",
  24. 'default_config' => "json NULL COMMENT '默认配置'",
  25. 'console' => "json NULL COMMENT '控制台'",
  26. 'status' => "tinyint(4) NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]'",
  27. 'created_at' => "int(10) unsigned NULL DEFAULT '0' COMMENT '创建时间'",
  28. 'updated_at' => "int(10) unsigned NULL DEFAULT '0' COMMENT '修改时间'",
  29. 'PRIMARY KEY (`id`)'
  30. ], "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='公用_插件表'");
  31. /* 索引设置 */
  32. $this->createIndex('name','{{%common_addons}}','name',0);
  33. $this->createIndex('update','{{%common_addons}}','updated_at',0);
  34. /* 表数据 */
  35. $this->insert('{{%common_addons}}',['id'=>'1','title'=>'系统更新','name'=>'Authority','title_initial'=>'X','bootstrap'=>'addons\\Authority\\common\\components\\Bootstrap','service'=>'addons\\Authority\\services\\Application','cover'=>'','group'=>'business','brief_introduction'=>'RageFrame 官方在线升级工具','description'=>'','author'=>'简言','version'=>'3.1.49','is_merchant_route_map'=>'0','default_config'=>'[]','console'=>'[]','status'=>'1','created_at'=>'1635410282','updated_at'=>'1635410282']);
  36. /* 设置外键约束 */
  37. $this->execute('SET foreign_key_checks = 1;');
  38. }
  39. public function down()
  40. {
  41. $this->execute('SET foreign_key_checks = 0');
  42. /* 删除表 */
  43. $this->dropTable('{{%common_addons}}');
  44. $this->execute('SET foreign_key_checks = 1;');
  45. }
  46. }
粤ICP备19079148号