Skip to content

Commit

Permalink
feat: update export script
Browse files Browse the repository at this point in the history
  • Loading branch information
dr5hn committed Sep 3, 2023
1 parent 854ba4c commit 8fa597a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/export.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
run: |
grep -v "DROP TABLE" sql/world.sql > tmpfile && mv tmpfile sql/world.sql
echo -e "DROP TABLE IF EXISTS \`regions\`;\n\n$(cat sql/world.sql)" > sql/world.sql
echo -e "DROP TABLE IF EXISTS \`subregions\`;\n\n$(cat sql/world.sql)" > sql/world.sql
echo -e "DROP TABLE IF EXISTS \`countries\`;\n$(cat sql/world.sql)" > sql/world.sql
echo -e "DROP TABLE IF EXISTS \`states\`;\n$(cat sql/world.sql)" > sql/world.sql
echo -e "DROP TABLE IF EXISTS \`cities\`;\n$(cat sql/world.sql)" > sql/world.sql
Expand All @@ -60,6 +61,7 @@ jobs:
php scripts/export_yaml.php
php scripts/export_csv.php
mysqldump -uroot -proot --add-drop-table --disable-keys --set-charset --skip-add-locks world regions > sql/regions.sql
mysqldump -uroot -proot --add-drop-table --disable-keys --set-charset --skip-add-locks world subregions > sql/subregions.sql
mysqldump -uroot -proot --add-drop-table --disable-keys --set-charset --skip-add-locks world countries > sql/countries.sql
mysqldump -uroot -proot --add-drop-table --disable-keys --set-charset --skip-add-locks world states > sql/states.sql
mysqldump -uroot -proot --add-drop-table --disable-keys --set-charset --skip-add-locks world cities > sql/cities.sql
Expand Down
4 changes: 4 additions & 0 deletions scripts/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
$countriesArray[$m]['tld'] = $row['tld'];
$countriesArray[$m]['native'] = $row['native'];
$countriesArray[$m]['region'] = $row['region'];
$countriesArray[$m]['region_id'] = $row['region_id'];
$countriesArray[$m]['subregion'] = $row['subregion'];
$countriesArray[$m]['subregion_id'] = $row['subregion_id'];
$countriesArray[$m]['nationality'] = $row['nationality'];
$countriesArray[$m]['timezones'] = json_decode($row['timezones'], true);
$countriesArray[$m]['translations'] = json_decode($row['translations'], true);
Expand Down Expand Up @@ -72,7 +74,9 @@
$countryStateCityArray[$k]['tld'] = $country['tld'];
$countryStateCityArray[$k]['native'] = $country['native'];
$countryStateCityArray[$k]['region'] = $country['region'];
$countryStateCityArray[$k]['region_id'] = $country['region_id'];
$countryStateCityArray[$k]['subregion'] = $country['subregion'];
$countryStateCityArray[$k]['subregion_id'] = $country['subregion_id'];
$countryStateCityArray[$k]['nationality'] = $country['nationality'];
$countryStateCityArray[$k]['timezones'] = $country['timezones'];
$countryStateCityArray[$k]['translations'] = $country['translations'];
Expand Down

0 comments on commit 8fa597a

Please sign in to comment.