| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace app\migrations;
- use common\models\common\Region;
- use common\models\user\Town;
- use yii\db\Migration;
- /**
- * Class M230821025254InsertQimallRegion
- */
- class M230821025254InsertQimallRegion extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $sql = "INSERT INTO `qimall_region`(`id`, `name`, `parent_id`, `level`, `short_title`, `areacode`, `zipcode`, `initial`, `lng`, `lat`, `created_at`, `updated_at`) VALUES
- (10074, '临平区', 922, 3, '', 0, 0, '', '', '', 1695434148, 1695434148),
- (10075, '钱塘区', 922, 3, '', 0, 0, '', '', '', 1695434148, 1695434148);";
- $this->execute($sql);
- $town_sql = "INSERT INTO `qimall_town`(`id`, `district_id`, `adcode`, `name`, `created_at`, `updated_at`) VALUES
- (39157, 10074, 330113, '临平街道', 1695434148, 1695434148),
- (39158, 10074, 330113, '南苑街道', 1695434148, 1695434148),
- (39159, 10074, 330113, '东湖街道', 1695434148, 1695434148),
- (39160, 10074, 330113, '星桥街道', 1695434148, 1695434148),
- (39161, 10074, 330113, '乔司街道', 1695434148, 1695434148),
- (39162, 10074, 330113, '运河街道', 1695434148, 1695434148),
- (39163, 10074, 330113, '崇贤街道', 1695434148, 1695434148),
- (39164, 10074, 330113, '塘栖镇', 1695434148, 1695434148),
- (39165, 10075, 330114, '下沙街道', 1695434148, 1695434148),
- (39166, 10075, 330114, '白杨街道', 1695434148, 1695434148),
- (39167, 10075, 330114, '河庄街道', 1695434148, 1695434148),
- (39168, 10075, 330114, '义蓬街道', 1695434148, 1695434148),
- (39169, 10075, 330114, '新湾街道', 1695434148, 1695434148),
- (39170, 10075, 330114, '临江街道', 1695434148, 1695434148),
- (39171, 10075, 330114, '前进街道', 1695434148, 1695434148);";
- $this->execute($town_sql);
- } catch (\Exception $e) {
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230821025254InsertQimallRegion cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230821025254InsertQimallRegion cannot be reverted.\n";
- return false;
- }
- */
- }
|