EscolaLMS/pages

View on GitHub
database/migrations/2021_05_12_000001_create_pages_table.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

use EscolaLms\Core\Models\User;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePagesTable extends Migration
{
    private string $table = 'pages';

    public function up()
    {
        Schema::create(
            $this->table,
            function (Blueprint $table) {
                $table->id('id');
                $table->string('slug');
                $table->string('title');
                $table->foreignIdFor(User::class, 'author_id');
                $table->longText('content');
                $table->boolean('active')->default(true);
            }
        );
    }

    public function down()
    {
        Schema::dropIfExists($this->table);
    }
}