Skip to content

Commit

Permalink
fix index error
Browse files Browse the repository at this point in the history
  • Loading branch information
khsing committed Apr 21, 2017
1 parent cf81c98 commit 5eeab46
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 154 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,35 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateWorldCitiesLocaleTable extends Migration {
class CreateWorldCitiesLocaleTable extends Migration
{

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('world_cities_locale', function(Blueprint $table)
{
$table->increments('id')->comment('Auto increase ID');
$table->integer('city_id')->unsigned()->nullable()->comment('City ID');
$table->string('name', 256)->default('')->comment('Localized city name');
$table->string('alias', 256)->nullable()->comment('Localized city alias');
$table->string('full_name', 256)->nullable()->comment('Localized city fullname');
$table->string('locale', 6)->nullable()->comment('locale name');
$table->unique(['city_id','locale'], 'uniq_locale');
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('world_cities_locale', function (Blueprint $table) {
$table->increments('id')->comment('Auto increase ID');
$table->integer('city_id')->unsigned()->comment('City ID');
$table->string('name', 255)->default('')->comment('Localized city name');
$table->string('alias', 255)->nullable()->comment('Localized city alias');
$table->string('full_name', 255)->nullable()->comment('Localized city fullname');
$table->string('locale', 6)->nullable()->comment('locale name');
$table->unique(['city_id','locale'], 'uniq_locale');
});
}


/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('world_cities_locale');
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('world_cities_locale');
}
}
57 changes: 28 additions & 29 deletions database/migrations/2017_04_08_163453_create_world_cities_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,35 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateWorldCitiesTable extends Migration {
class CreateWorldCitiesTable extends Migration
{

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('world_cities', function(Blueprint $table)
{
$table->increments('id')->comment('Auto increase ID');
$table->integer('country_id')->unsigned()->comment('Country ID');
$table->integer('division_id')->unsigned()->nullable()->index('division_id')->comment('Division ID');
$table->string('name', 256)->default('')->comment('City Name');
$table->string('full_name', 256)->nullable()->comment('City Fullname');
$table->string('code', 64)->nullable()->comment('City Code');
$table->index(['country_id','division_id','name'], 'uniq_city');
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('world_cities', function (Blueprint $table) {
$table->increments('id')->comment('Auto increase ID');
$table->integer('country_id')->unsigned()->comment('Country ID');
$table->integer('division_id')->unsigned()->nullable()->index('division_id')->comment('Division ID');
$table->string('name', 255)->default('')->comment('City Name');
$table->string('full_name', 255)->nullable()->comment('City Fullname');
$table->string('code', 64)->nullable()->comment('City Code');
$table->index(['country_id','division_id','name'], 'uniq_city');
});
}


/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('world_cities');
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('world_cities');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,36 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateWorldContinentsLocaleTable extends Migration {
class CreateWorldContinentsLocaleTable extends Migration
{

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('world_continents_locale', function(Blueprint $table)
{
$table->increments('id')->comment('Auto increase ID');
$table->integer('continent_id')->unsigned()->nullable()->comment('Continent ID');
$table->string('name', 256)->nullable()->comment('Localized Name');
$table->string('alias', 256)->nullable()->comment('Localized Alias');
$table->string('abbr', 16)->nullable()->comment('Localized Abbr name');
$table->string('full_name', 256)->nullable()->comment('Localized Fullname');
$table->string('locale', 6)->nullable()->comment('Locale');
$table->unique(['continent_id','locale'], 'uniq_locale');
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('world_continents_locale', function (Blueprint $table) {
$table->increments('id')->comment('Auto increase ID');
$table->integer('continent_id')->unsigned()->comment('Continent ID');
$table->string('name', 255)->nullable()->comment('Localized Name');
$table->string('alias', 255)->nullable()->comment('Localized Alias');
$table->string('abbr', 16)->nullable()->comment('Localized Abbr name');
$table->string('full_name', 255)->nullable()->comment('Localized Fullname');
$table->string('locale', 6)->nullable()->comment('Locale');
$table->unique(['continent_id','locale'], 'uniq_locale');
});
}


/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('world_continents_locale');
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('world_continents_locale');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,37 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateWorldCountriesLocaleTable extends Migration {
class CreateWorldCountriesLocaleTable extends Migration
{

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('world_countries_locale', function(Blueprint $table)
{
$table->increments('id')->comment('Auto increase ID');
$table->integer('country_id')->unsigned()->nullable()->comment('Country ID');
$table->string('name', 256)->default('')->comment('Localized Country Name');
$table->string('alias', 256)->nullable()->comment('Localized Country Alias');
$table->string('abbr', 16)->nullable()->comment('Localized Country Abbr Name');
$table->string('full_name', 256)->nullable()->comment('Localized Country Fullname');
$table->string('currency_name', 256)->nullable()->comment('Localized Country Currency Name');
$table->string('locale', 6)->nullable()->comment('locale');
$table->unique(['country_id','locale'], 'uniq_locale');
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('world_countries_locale', function (Blueprint $table) {
$table->increments('id')->comment('Auto increase ID');
$table->integer('country_id')->unsigned()->comment('Country ID');
$table->string('name', 255)->default('')->comment('Localized Country Name');
$table->string('alias', 255)->nullable()->comment('Localized Country Alias');
$table->string('abbr', 16)->nullable()->comment('Localized Country Abbr Name');
$table->string('full_name', 255)->nullable()->comment('Localized Country Fullname');
$table->string('currency_name', 255)->nullable()->comment('Localized Country Currency Name');
$table->string('locale', 6)->nullable()->comment('locale');
$table->unique(['country_id','locale'], 'uniq_locale');
});
}


/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('world_countries_locale');
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('world_countries_locale');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public function up()
{
$table->increments('id')->comment('Auto increase ID');
$table->integer('continent_id')->unsigned()->comment('Continent ID');
$table->string('name', 256)->default('')->comment('Country Common Name');
$table->string('full_name', 256)->nullable()->comment('Country Fullname');
$table->string('capital', 256)->nullable()->comment('Capital Common Name');
$table->string('name', 255)->default('')->comment('Country Common Name');
$table->string('full_name', 255)->nullable()->comment('Country Fullname');
$table->string('capital', 255)->nullable()->comment('Capital Common Name');
$table->string('code', 4)->nullable()->comment('ISO3166-1-Alpha-2');
$table->string('code_alpha3', 6)->nullable()->comment('ISO3166-1-Alpha-3');
$table->string('emoji', 16)->nullable()->comment('Country Emoji');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,36 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateWorldDivisionsLocaleTable extends Migration {
class CreateWorldDivisionsLocaleTable extends Migration
{

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('world_divisions_locale', function(Blueprint $table)
{
$table->increments('id')->comment('Auto Increase ID');
$table->integer('division_id')->unsigned()->nullable()->comment('Division ID');
$table->string('name', 256)->default('')->comment('Localized Division Name');
$table->string('abbr', 16)->nullable()->comment('Localized Division Abbr');
$table->string('alias', 256)->nullable()->comment('Localized Division Alias');
$table->string('full_name', 256)->nullable()->comment('Localized Division Fullname');
$table->string('locale', 6)->nullable()->comment('locale');
$table->unique(['division_id','locale'], 'uniq_locale');
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('world_divisions_locale', function (Blueprint $table) {
$table->increments('id')->comment('Auto Increase ID');
$table->integer('division_id')->unsigned()->comment('Division ID');
$table->string('name', 255)->default('')->comment('Localized Division Name');
$table->string('abbr', 16)->nullable()->comment('Localized Division Abbr');
$table->string('alias', 255)->nullable()->comment('Localized Division Alias');
$table->string('full_name', 255)->nullable()->comment('Localized Division Fullname');
$table->string('locale', 6)->nullable()->comment('locale');
$table->unique(['division_id','locale'], 'uniq_locale');
});
}


/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('world_divisions_locale');
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('world_divisions_locale');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public function up()
{
$table->increments('id')->comment('Auto Increase ID');
$table->integer('country_id')->unsigned()->comment('Country ID');
$table->string('name', 256)->default('')->comment('Division Common Name');
$table->string('full_name', 256)->nullable()->comment('Division Full Name');
$table->string('name', 255)->default('')->comment('Division Common Name');
$table->string('full_name', 255)->nullable()->comment('Division Full Name');
$table->string('code', 64)->nullable()->comment('ISO 3166-2 Code');
$table->boolean('has_city')->default(0)->comment('Has city?');
$table->unique(['country_id','name'], 'uniq_division');
Expand Down

0 comments on commit 5eeab46

Please sign in to comment.