%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/diaspora/api/database/migrations/
Upload File :
Create Path :
Current File : /var/www/html/diaspora/api/database/migrations/2019_03_22_161328_create_countries_table.php

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCountriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('countries', function (Blueprint $table) {
            $table->increments('id');
            $table->string('iso_2');
            $table->boolean('is_enabled')->default(false);
        });

        Schema::create('country_translations', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('country_id')
                  ->unsigned();
            $table->string('name');
            $table->string('locale')
                  ->index();

            $table->unique(['country_id', 'locale']);
            $table->foreign('country_id')
                  ->references('id')
                  ->on('countries')
                  ->onDelete('cascade');
        });
    }

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

Zerion Mini Shell 1.0