| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace addons\Store\console\migrations;
- use addons\Store\common\models\StoreMenu;
- use yii\db\Migration;
- /**
- * Class M240313084103SecondaryCard
- */
- class M240313084103SecondaryCard extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $sql = "INSERT INTO `qimall_addons_store_addons` (`title`, `name`, `cover`, `brief_introduction`, `status`, `created_at`, `updated_at`) VALUES ('次卡', 'SecondaryCard', '', '次卡', '1', '1702975895', '1702975895');";
- $this->execute($sql);
- $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', '0', 'store/secondary-card/default/index', '', '2', '0', '999', NULL, '', '1', '0', '0', 'SecondaryCard', '1');";
- $this->execute($sql);
- $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/index', '', '2', '0', '999', NULL, '', '1', '0', '0', 'SecondaryCard', '1');
- 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/order', '', '2', '0', '999', NULL, '', '1', '0', '0', 'SecondaryCard', '1');
- 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');";
- $this->execute($sql);
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M240313084103SecondaryCard cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M240313084103SecondaryCard cannot be reverted.\n";
- return false;
- }
- */
- }
|