Bottaajat/cultura

View on GitHub
database/migrations/2016_06_08_112217_create_users_table.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

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

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamps();

            $table->string('firstname');
            $table->string('lastname');
            $table->boolean('is_admin');
            $table->string('email')->unique();
            $table->string('phone')->nullable();
            $table->string('intro')->nullable();
            $table->string('src')->nullable();

            $table->string('password');
            $table->rememberToken();

            $table->integer('school_id')->unsigned()->nullable();
            $table->foreign('school_id')->references('id')->on('schools');
        });
    }

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