tethys/database/migrations/2019_08_28_160330_create_pages_table.php

55 lines
1.7 KiB
PHP
Raw Normal View History

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePagesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pages', function (Blueprint $table) {
$table->increments('id');
//$table->string('title', 191);
$table->string('page_slug', 191)->unique();
//$table->text('description')->nullable();
$table->string('cannonical_link', 191)->nullable();
$table->string('seo_title', 191)->nullable();
$table->string('seo_keyword', 191)->nullable();
$table->text('seo_description')->nullable();
$table->boolean('status')->default(true);
$table->integer('created_by');
$table->integer('updated_by')->nullable();
$table->dateTime('created_at')->unsigned();
$table->dateTime('updated_at')->unsigned()->nullable();
});
Schema::create('page_translations', function (Blueprint $table) {
$table->increments('id');
$table->integer('page_id')->unsigned();
$table->unique(['page_id','locale']);
$table->foreign('page_id')->references('id')->on('pages')->onDelete('cascade');
$table->string('locale')->index();
$table->string('title');
$table->text('description');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('page_translations');
Schema::dropIfExists('pages');
}
}