| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace addons\Store\console\migrations;
- use yii\db\Migration;
- /**
- * 添加一个o2o分类链接数据
- * Class M250514144436AlterLinkCategory
- */
- class M250514144436AlterLinkCategory extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $table = 'qimall_link_category';
- $sql = "select id from {$table} where name = 'goods' and pid=0 and status = 1";
- $res = $this->db->createCommand($sql)->queryOne();
- if (empty($res)) return '';
- $sql = <<<SQL
- INSERT INTO `qimall_link_category`(`name`, `title`, `pid`, `is_list`, `remark`, `status`, `created_at`, `updated_at`) VALUES ('store_renov_goods', 'O2O门店商品', {$res['id']}, 1, '', 1, 1747206336, 1747206336);
- SQL;
- $this->execute($sql);
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M250514144436AlterLinkCategory cannot be reverted.\n";
- return false;
- }
-
- }
|