M240925100736ModifyTownForDistrictId1885.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M240925100736ModifyTownForDistrictId1885
  6. */
  7. class M240925100736ModifyTownForDistrictId1885 extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = <<<SQL
  15. DELETE FROM `qimall_town` WHERE `district_id` = '1885';
  16. INSERT INTO `qimall_town` (`district_id`, `adcode`, `name`, `created_at`, `updated_at`) VALUES
  17. (1885, 430921, '乌嘴乡', 1727230159, 1727230159),
  18. (1885, 430921, '中鱼口镇', 1727230159, 1727230159),
  19. (1885, 430921, '浪拔湖镇', 1727230159, 1727230159),
  20. (1885, 430921, '麻河口镇', 1727230159, 1727230159),
  21. (1885, 430921, '三仙湖镇', 1727230159, 1727230159),
  22. (1885, 430921, '茅草街镇', 1727230159, 1727230159),
  23. (1885, 430921, '华阁镇', 1727230159, 1727230159),
  24. (1885, 430921, '南洲镇', 1727230159, 1727230159),
  25. (1885, 430921, '武圣宫镇', 1727230159, 1727230159),
  26. (1885, 430921, '厂窖镇', 1727230159, 1727230159),
  27. (1885, 430921, '青树嘴镇', 1727230159, 1727230159),
  28. (1885, 430921, '明山头镇', 1727230159, 1727230159);
  29. SQL;
  30. $this->execute($sql);
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function safeDown()
  36. {
  37. echo "M240925100736ModifyTownForDistrictId1885 cannot be reverted.\n";
  38. return false;
  39. }
  40. }