Skip to content

Commit f71d1bf

Browse files
committed
Add population field to states and cities in export commands
1 parent 96876fb commit f71d1bf

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

bin/Commands/ExportJson.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
159159
$statesArray[$i]['timezone'] = $state['timezone'];
160160
$statesArray[$i]['translations'] = json_decode($state['translations'], true);
161161
$statesArray[$i]['wikiDataId'] = $state['wikiDataId'];
162+
$statesArray[$i]['population'] = $state['population'];
162163

163164
// For Country State Array
164165
$stateArr = array(
@@ -197,6 +198,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
197198
$citiesArray[$j]['latitude'] = $city['latitude'];
198199
$citiesArray[$j]['longitude'] = $city['longitude'];
199200
$citiesArray[$j]['native'] = $city['native'];
201+
$citiesArray[$j]['type'] = $city['type'];
202+
$citiesArray[$j]['level'] = $city['level'];
203+
$citiesArray[$j]['parent_id'] = $city['parent_id'];
204+
$citiesArray[$j]['population'] = $city['population'] !== null ? (int)$city['population'] : null;
200205
$citiesArray[$j]['timezone'] = $city['timezone'];
201206
$citiesArray[$j]['translations'] = json_decode($city['translations'], true);
202207
$citiesArray[$j]['wikiDataId'] = $city['wikiDataId'];

bin/Commands/ExportSqlServer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ private function generateTableSchema(string $table): string
113113
updated_at DATETIME2 NOT NULL DEFAULT GETDATE(),
114114
flag BIT NOT NULL DEFAULT 1,
115115
wikiDataId NVARCHAR(255) NULL,
116+
population NVARCHAR(255) NULL,
116117
CONSTRAINT FK_states_countries FOREIGN KEY (country_id) REFERENCES world.countries(id)
117118
);",
118119
'cities' => "
@@ -124,9 +125,13 @@ private function generateTableSchema(string $table): string
124125
state_code NVARCHAR(255) NOT NULL,
125126
country_id INT NOT NULL,
126127
country_code NCHAR(2) NOT NULL,
128+
type NVARCHAR(191) NULL,
129+
level INT NULL,
130+
parent_id INT NULL,
127131
latitude DECIMAL(10,8) NOT NULL,
128132
longitude DECIMAL(11,8) NOT NULL,
129133
native NVARCHAR(255) NULL,
134+
population BIGINT NULL,
130135
timezone NVARCHAR(255) NULL,
131136
translations NVARCHAR(MAX),
132137
created_at DATETIME2 NOT NULL DEFAULT '2014-01-01 12:01:01',

0 commit comments

Comments
 (0)