M250726022813InsertQimallGlobalVarMap.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M250726022813InsertQimallGlobalVarMap
  6. */
  7. class M250726022813InsertQimallGlobalVarMap extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. return true;
  15. try {
  16. $sql = <<<SQL
  17. INSERT INTO `qimall_global_var_map`(`id`, `name`, `title`, `type`, `is_addons`, `status`, `created_at`, `updated_at`) VALUES (NULL, 'luck_draw', '抽奖活动', 'CapitalTypeMap', 1, 1, 1673433032, 1673433032);
  18. INSERT INTO `qimall_global_var_map`(`id`, `name`, `title`, `type`, `is_addons`, `status`, `created_at`, `updated_at`) VALUES (NULL, 'LuckDraw', '抽奖活动', 'FromTypeMap', 1, 1, 1673433032, 1673433032);
  19. SQL;
  20. $this->execute($sql);
  21. } catch (\Exception $e) {
  22. // 处理异常
  23. var_dump($e->getMessage());
  24. }
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function safeDown()
  30. {
  31. echo "M250726022813InsertQimallGlobalVarMap cannot be reverted.\n";
  32. return false;
  33. }
  34. /*
  35. // Use up()/down() to run migration code without a transaction.
  36. public function up()
  37. {
  38. }
  39. public function down()
  40. {
  41. echo "M250726022813InsertQimallGlobalVarMap cannot be reverted.\n";
  42. return false;
  43. }
  44. */
  45. }