Skip to content

Instantly share code, notes, and snippets.

@hanspagel
Created December 8, 2017 14:18
Show Gist options
  • Save hanspagel/bcb983801518f4a30989f7111f978870 to your computer and use it in GitHub Desktop.
Save hanspagel/bcb983801518f4a30989f7111f978870 to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
public function up()
{
DB::statement('CREATE EXTENSION IF NOT EXISTS "uuid-ossp";');
Schema::create('users', function (Blueprint $table) {
$table->uuid('id')->primary()->default(DB::raw('uuid_generate_v4()'));
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('users');
DB::statement('DROP EXTENSION IF EXISTS "uuid-ossp";');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment