| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace addons\Store\console\migrations;
- use addons\Store\common\models\StoreMenu;
- use yii\db\Migration;
- /**
- * Class M240412073442SecondaryCard
- */
- class M240412073442SecondaryCard extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $model = StoreMenu::find()->where(['title'=>'次卡列表','addons_name'=>'SecondaryCard'])->orderBy('id asc')->one();
- $pid = $model['id'];
- $sql = "INSERT INTO `qimall_addons_store_menu` ( `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`, `addons_name`, `is_addon`) VALUES ( '使用记录', '0', '{$pid}', 'store/secondary-card/default/use-log', '', '2', '0', '999', NULL, '', '1', '0', '0', 'SecondaryCard', '1');";
- $model = StoreMenu::find()->where(['url'=>'store/secondary-card/default/use-log','addons_name'=>'SecondaryCard'])->orderBy('id asc')->one();
- if(empty($model)){
- $this->execute($sql);
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M240412073442SecondaryCard cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M240412073442SecondaryCard cannot be reverted.\n";
- return false;
- }
- */
- }
|