M230715173725InsertQimallRegion.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230715173725InsertQimallRegion
  6. */
  7. class M230715173725InsertQimallRegion extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $sql = "INSERT INTO `qimall_region`(`id`,`name`, `parent_id`, `level`, `short_title`, `areacode`, `zipcode`, `initial`, `lng`, `lat`, `created_at`, `updated_at`) VALUES
  16. (10066, '沧浪区', 850, 3, '', 0, 0, 'C', '', '', NULL, NULL),
  17. (10067, '金阊区', 850, 3, '', 0, 0, 'J', '', '', NULL, NULL),
  18. (10068, '平江区', 850, 3, '', 0, 0, 'P', '', '', NULL, NULL),
  19. (10069, '苏州工业园区', 850, 3, '', 0, 0, 'S', '', '', NULL, NULL);";
  20. $sql.= "INSERT INTO `qimall_region`(`id`,`name`, `parent_id`, `level`, `short_title`, `areacode`, `zipcode`, `initial`, `lng`, `lat`, `created_at`, `updated_at`) VALUES
  21. (10070, '郑州高新技术产业开发区', 1507, 3, '', 0, 0, 'Z', '', '', NULL, NULL),
  22. (10071, '郑州经济技术开发区', 1507, 3, '', 0, 0, 'Z', '', '', NULL, NULL),
  23. (10072, '郑州航空港经济综合实验区', 1507, 3, '', 0, 0, 'Z', '', '', NULL, NULL),
  24. (10073, '郑东新区', 1507, 3, '', 0, 0, 'Z', '', '', NULL, NULL);";
  25. $this->execute($sql);
  26. }catch (\Exception $e){
  27. }
  28. }
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public function safeDown()
  33. {
  34. echo "M230715173725InsertQimallRegion cannot be reverted.\n";
  35. return false;
  36. }
  37. /*
  38. // Use up()/down() to run migration code without a transaction.
  39. public function up()
  40. {
  41. }
  42. public function down()
  43. {
  44. echo "M230715173725InsertQimallRegion cannot be reverted.\n";
  45. return false;
  46. }
  47. */
  48. }