2017-06-09 09:02:52 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
|
|
|
|
class CreateAirlinesTable extends Migration
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
Schema::create('airlines', function (Blueprint $table) {
|
|
|
|
$table->increments('id');
|
2017-07-11 07:54:51 +08:00
|
|
|
$table->string('code', 5);
|
2017-07-23 12:03:39 +08:00
|
|
|
$table->string('iata', 5);
|
2017-07-11 07:54:51 +08:00
|
|
|
$table->string('name', 50);
|
|
|
|
$table->string('country', 2)->nullable();
|
2017-06-09 09:46:50 +08:00
|
|
|
$table->boolean('active');
|
2017-06-09 09:02:52 +08:00
|
|
|
$table->timestamps();
|
2017-06-20 00:30:18 +08:00
|
|
|
|
|
|
|
$table->index('code');
|
|
|
|
$table->unique('code');
|
2017-07-23 12:03:39 +08:00
|
|
|
|
|
|
|
$table->index('iata');
|
|
|
|
$table->unique('iata');
|
2017-06-09 09:02:52 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
Schema::drop('airlines');
|
|
|
|
}
|
|
|
|
}
|