Skip to content

Instantly share code, notes, and snippets.

@hanspagel
Last active December 8, 2017 14:43
Show Gist options
  • Save hanspagel/be780866311654c210be34f03e63080d to your computer and use it in GitHub Desktop.
Save hanspagel/be780866311654c210be34f03e63080d to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePostsTable extends Migration
{
public function up()
{
Schema::create('posts', function (Blueprint $table) {
$table->uuid('id')->primary()->default(DB::raw('uuid_generate_v4()'));
$table->uuid('user_id')->index();
$table->string('title');
$table->text('body');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('posts');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment