1
0
Fork 0
mirror of https://github.com/janickiy/yii2-nomer synced 2025-02-12 10:01:52 +00:00
yii2-nomer/migrations/m170529_130558_create_geo_table.php
2020-02-05 06:34:26 +03:00

43 lines
1.1 KiB
PHP

<?php
use yii\db\Migration;
/**
* Handles the creation of table `geo`.
*/
class m170529_130558_create_geo_table extends Migration
{
/**
* @inheritdoc
*/
public function up()
{
$this->createTable('geo', [
'geoname_id' => $this->integer(),
'locale_code' => $this->string(),
'continent_code' => $this->string(),
'continent_name' => $this->string(),
'country_iso_code' => $this->string(),
'country_name' => $this->string(),
'subdivision_1_iso_code' => $this->string(),
'subdivision_1_name' => $this->string(),
'subdivision_2_iso_code' => $this->string(),
'subdivision_2_name' => $this->string(),
'city_name' => $this->string(),
'metro_code' => $this->string(),
'time_zone' => $this->string(),
]);
$this->createIndex("idx_geo_id", "geo", "geoname_id");
}
/**
* @inheritdoc
*/
public function down()
{
$this->dropIndex("idx_geo_id", "geo");
$this->dropTable('geo');
}
}