M230113040014CreateTableProductDecorationTemplate.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230113040014CreateTableProductDecorationTemplate
  6. */
  7. class M230113040014CreateTableProductDecorationTemplate extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $goods_decoration_template_sql = "CREATE TABLE `qimall_goods_decoration_template` (
  15. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  16. `mall_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Mall ID',
  17. `name` varchar(60) NOT NULL DEFAULT '' COMMENT '模板名称',
  18. `is_default` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否为默认; [0非默认, 1默认]',
  19. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态; [-1删除, 0禁用, 1启用]',
  20. `template_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品样式id',
  21. `created_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  22. `updated_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  23. PRIMARY KEY (`id`)
  24. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
  25. $this->execute($goods_decoration_template_sql);
  26. $goods_decoration_template_content_sql = "CREATE TABLE `qimall_goods_decoration_template_content` (
  27. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  28. `mall_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Mall ID',
  29. `title` varchar(15) NOT NULL DEFAULT '' COMMENT '标题',
  30. `content` longtext COMMENT '内容',
  31. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态; [-1删除, 0禁用, 1启用]',
  32. `created_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  33. `updated_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  34. PRIMARY KEY (`id`)
  35. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
  36. $this->execute($goods_decoration_template_content_sql);
  37. $goods_template_ralation_sql = "CREATE TABLE `qimall_goods_template_relation` (
  38. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  39. `mall_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Mall ID',
  40. `goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Goods ID',
  41. `template_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '模板ID[qimall_goods_decoration_template主键]',
  42. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态; [-1删除, 0禁用, 1启用]',
  43. `created_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  44. `updated_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  45. PRIMARY KEY (`id`)
  46. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
  47. $this->execute($goods_template_ralation_sql);
  48. $commodity_strategy_group_insert_sql = "INSERT INTO `qimall_diy_components`(`code`, `title`, `group`, `icon`, `count`, `is_top`, `permission`, `sort`, `source`, `status`, `created_at`, `updated_at`) VALUES ('commodity-strategy-group', '商品组', 'goods_template', '', 999, 0, '{\"is_drag\":\"true\",\"is_up\":\"true\",\"id_down\":\"true\",\"is_copy\":\"true\"}', 999, '', 1, 1634538238, 1634538238);";
  49. $this->execute($commodity_strategy_group_insert_sql);
  50. }
  51. /**
  52. * {@inheritdoc}
  53. */
  54. public function safeDown()
  55. {
  56. }
  57. }