| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- *
- * Class M221215092022AddCategoryToLinkCategory
- */
- class M221215092022AddCategoryToLinkCategory extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $sql = "select * from qimall_link_category where name = 'group_cate'";
- $res = $this->db->createCommand($sql)->execute();
- if(!$res){
- $sql = "INSERT INTO `qimall_link_category` ( `name`, `title`, `pid`, `is_list`, `remark`, `status`, `created_at`, `updated_at`) VALUES
- ( 'group_cate', '拼团分类', 19, 1, NULL, 1, 1639814497, 1640312920);";
- $this->execute($sql);
- }
- $sql = "select * from qimall_link_category where name = 'group_activity'";
- $res = $this->db->createCommand($sql)->execute();
- if(!$res){
- $sql = "INSERT INTO `qimall_link_category` ( `name`, `title`, `pid`, `is_list`, `remark`, `status`, `created_at`, `updated_at`) VALUES ('group_activity', '拼团活动', 19, 1, NULL, 1, 1639814136, 1639814255);";
- $this->execute($sql);
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M221215092022AddCategoryToLinkCategory cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M221215092022AddCategoryToLinkCategory cannot be reverted.\n";
- return false;
- }
- */
- }
|