Feuerwehr-eppingen/database/migrations/2024_03_06_080000_update_audits_table.php

38 lines
793 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class UpdateAuditsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('revisions', function (Blueprint $table) {
$table->string('user_type')->nullable();
});
// Set the user_type value and keep the timestamp values.
DB::table('revisions')->update([
'user_type' => \App\Models\User::class,
'created_at' => DB::raw('created_at'),
'updated_at' => DB::raw('updated_at'),
]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// There's no turning back
}
}