madbob/GASdottoNG

View on GitHub
code/database/migrations/2015_11_21_011714_create_bookings_table.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

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

class CreateBookingsTable extends Migration
{
    public function up()
    {
        Schema::create('bookings', function (Blueprint $table) {
            $table->string('id')->primary();
            $table->timestamps();

            $table->string('order_id');
            $table->string('user_id');
            $table->enum('status', ['pending', 'partial', 'shipped', 'saved']);
            $table->text('notes');

            $table->string('deliverer_id')->nullable();
            $table->date('delivery')->nullable();
            $table->integer('payment_id')->nullable();

            $table->foreign('order_id')->references('id')->on('orders')->onDelete('cascade');
        });
    }

    public function down()
    {
        Schema::drop('bookings');
    }
}