M230210095051UpdateQimallTown.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230210095051UpdateQimallTown
  6. */
  7. class M230210095051UpdateQimallTown extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $sql = "update qimall_town set name ='丰财街道' where id = '11286' and district_id = '833';
  16. update qimall_town set name ='环城街道' where id = '11287' and district_id = '833';
  17. update qimall_town set name ='琵琶街道' where id = '11288' and district_id = '833';
  18. update qimall_town set name ='铜沛街道' where id = '11289' and district_id = '833';
  19. update qimall_town set name ='牌楼街道' where id = '11290' and district_id = '833';
  20. update qimall_town set name ='黄楼街道' where id = '11291' and district_id = '833';
  21. update qimall_town set name ='九里街道' where id = '11292' and district_id = '833';
  22. update qimall_town set name ='拾屯街道' where id = '11293' and district_id = '833';
  23. DELETE FROM qimall_town where id in(11294,11295,11296,11297,11298) and district_id = '833';";
  24. $this->execute($sql);
  25. } catch (\Exception $e) {
  26. }
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function safeDown()
  32. {
  33. echo "M230210095051UpdateQimallTown cannot be reverted.\n";
  34. return false;
  35. }
  36. /*
  37. // Use up()/down() to run migration code without a transaction.
  38. public function up()
  39. {
  40. }
  41. public function down()
  42. {
  43. echo "M230210095051UpdateQimallTown cannot be reverted.\n";
  44. return false;
  45. }
  46. */
  47. }