stubs/migration.stub
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class {CLASS_NAME} extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('{TABLE_NAME}', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('subject_id')->index();
$table->unsignedInteger('user_id')->nullable()->index();
$table->unsignedTinyInteger('event_type')->index();
$table->string('field_name')->index();
$table->string('field_value_old')->nullable()->index();
$table->string('field_value_new')->nullable()->index();
$table->timestamp('occurred_at', {PRECISION})->index();
$table->timestamps();
{PROCESS_IDS_SETUP}
{FOREIGN_KEY_SUBJECT}
{FOREIGN_KEY_USER}
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('{TABLE_NAME}');
}
}