%PDF- %PDF-
Direktori : /var/www/html/diaspora/api/database/migrations/ |
Current File : /var/www/html/diaspora/api/database/migrations/2019_05_04_192956_create_sections_table.php |
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateSectionsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('sections', function (Blueprint $table) { $table->bigIncrements('id'); $table->integer('order'); $table->boolean('is_visible') ->default(false); $table->unsignedInteger('country_id'); $table->unique(['country_id', 'order']); $table->foreign('country_id') ->references('id') ->on('countries'); $table->timestamps(); }); Schema::create('section_translations', function (Blueprint $table) { $table->increments('id'); $table->bigInteger('section_id') ->unsigned(); $table->string('title'); $table->longText('description'); $table->string('locale') ->index(); $table->unique(['section_id', 'locale']); $table->foreign('section_id') ->references('id') ->on('sections') ->onDelete('cascade'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('sections'); Schema::dropIfExists('section_translations'); } }