| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace addons\SecondaryCard\console\migrations;
- use common\enums\StatusEnum;
- use common\models\diy\DiyComponents;
- use yii\db\Migration;
- /**
- * Class M240909025003InsertQimallDiyComponents
- */
- class M240909025003InsertQimallDiyComponents extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $res = DiyComponents::find()->where(['code' => 'secondary-card', 'status' => StatusEnum::ENABLED])->one();
- if (!empty($res)) {
- return true;
- }
- $sql = "INSERT INTO `qimall_diy_components` ( `code`, `title`, `group`, `icon`, `count`, `is_top`, `permission`, `sort`, `source`, `status`, `created_at`, `updated_at`) VALUES ( 'secondary-card', '次卡', 'marketing', '', 999, 0, '{\"is_drag\":\"true\",\"is_up\":\"true\",\"id_down\":\"true\",\"is_copy\":\"true\"}', 999, 'SecondaryCard', 1, 1634538238, 1634538238);";
- $this->execute($sql);
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M240909025003InsertQimallDiyComponents cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M240909025003InsertQimallDiyComponents cannot be reverted.\n";
- return false;
- }
- */
- }
|