<?php

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

return new class () extends Migration {
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('post_translations', function (Blueprint $table) {
            $table->id();
            $table->foreignId('post_id')->constrained()->onDelete('cascade');
            $table->string('locale', 6)->index();
            $table->string('slug')->unique();
            $table->string('title')->nullable();
            $table->text('excerpt')->nullable();
            $table->longtext('content')->nullable();
            $table->integer('status')->unsigned()->default(1);
            $table->integer('updated_by_user_id')->unsigned()->nullable();
            $table->dateTime('from')->nullable();
            $table->dateTime('till')->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }

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