![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/syn.corals.io/Corals/modules/CMS/database/migrations/ |
<?php namespace Corals\Modules\CMS\database\migrations; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CmsTables extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('categories', function (Blueprint $table) { $table->increments('id'); $table->string('name')->unique(); $table->string('slug')->unique()->index(); $table->string('belongs_to')->default('post'); $table->enum('status', ['active', 'inactive'])->default('active'); $table->text('properties')->nullable(); $table->unsignedInteger('created_by')->nullable()->index(); $table->unsignedInteger('updated_by')->nullable()->index(); $table->softDeletes(); $table->timestamps(); }); Schema::create('posts', function (Blueprint $table) { $table->increments('id'); $table->string('title'); $table->string('slug')->unique()->index(); $table->text('meta_keywords')->nullable(); $table->text('meta_description')->nullable(); $table->longText('content')->nullable(); $table->text('properties')->nullable(); $table->boolean('published')->default(false); $table->dateTime('published_at')->nullable(); $table->boolean('private')->default(false); $table->boolean('internal')->default(false); $table->enum('type', ['post', 'page', 'news', 'faq', 'testimonial', 'download'])->default('post'); $table->string('template')->nullable(); $table->unsignedInteger('author_id')->nullable(); $table->unsignedInteger('created_by')->nullable()->index(); $table->unsignedInteger('updated_by')->nullable()->index(); $table->softDeletes(); $table->timestamps(); }); Schema::create('category_post', function (Blueprint $table) { $table->unsignedInteger('post_id'); $table->foreign('post_id')->references('id')->on('posts')->onDelete('cascade')->onUpdate('cascade'); $table->unsignedInteger('category_id'); $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade')->onUpdate('cascade'); $table->unique(['post_id', 'category_id']); }); Schema::create('postables', function (Blueprint $table) { $table->increments('id'); $table->integer('content_id'); $table->morphs('postable'); $table->nullableMorphs('sourcable'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('postables'); Schema::dropIfExists('post_tag'); Schema::dropIfExists('category_post'); Schema::dropIfExists('posts'); Schema::dropIfExists('tags'); Schema::dropIfExists('categories'); } }