Created
August 23, 2018 11:26
-
-
Save hanspagel/154ef69dfecd01556cab9607da642051 to your computer and use it in GitHub Desktop.
Laravel Nova Migration with Postgres Uuid Support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// nova/database/migrations/2018_01_01_000000_create_action_events_table.php | |
use Illuminate\Support\Facades\Schema; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Database\Migrations\Migration; | |
class CreateActionEventsTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::create('action_events', function (Blueprint $table) { | |
$table->uuid('id')->primary()->default(DB::raw('uuid_generate_v4()')); | |
$table->char('batch_id', 36); | |
$table->uuid('user_id')->nullable()->index(); | |
$table->string('name'); | |
$table->string('actionable_type'); | |
$table->uuid('actionable_id')->nullable(); | |
$table->string('target_type'); | |
$table->uuid('target_id')->nullable(); | |
$table->string('model_type'); | |
$table->uuid('model_id')->nullable(); | |
$table->text('fields'); | |
$table->string('status', 25)->default('running'); | |
$table->text('exception'); | |
$table->timestamps(); | |
$table->index(['actionable_type', 'actionable_id']); | |
$table->index(['batch_id', 'model_type', 'model_id']); | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::dropIfExists('action_events'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment