| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Class M230708085948InsertLinkCategoryMch
- */
- class M230708085948InsertLinkCategoryMch extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $sql = "select * from qimall_link_category where name = 'mch'";
- $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 ('mch', '多商户门店', '19', '1', NULL, '1', '1654741229', '1654741229');";
- $this->execute($sql);
- }
- $sql = "select * from qimall_link_category where name = 'mch_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 ('mch_cate', '多商户门店分类', '19', '1', NULL, '1', '1654741255', '1654741345');";
- $this->execute($sql);
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230708085948InsertLinkCategoryMch cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230708085948InsertLinkCategoryMch cannot be reverted.\n";
- return false;
- }
- */
- }
|