Просмотр файла database/migrations/2018_06_16_231307_create_items_table.php

Размер файла: 1.12Kb
<?php

declare(strict_types=1);

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

final class CreateItemsTable extends Migration
{
    /**
     * Migrate Up.
     */
    public function up(): void
    {
        if (! Schema::hasTable('items')) {
            Schema::create('items', function (Blueprint $table) {
                $table->increments('id');
                $table->integer('board_id');
                $table->string('title', 100);
                $table->text('text');
                $table->integer('user_id');
                $table->integer('price')->default(0);
                $table->string('phone', 15)->nullable();
                $table->integer('created_at');
                $table->integer('updated_at');
                $table->integer('expires_at');

                $table->index('board_id');
                $table->index('expires_at');
                $table->index('created_at');
            });
        }
    }

    /**
     * Migrate Down.
     */
    public function down(): void
    {
        Schema::dropIfExists('items');
    }
}