This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table): void {
|
||||
$table->softDeletes();
|
||||
});
|
||||
|
||||
DB::table('users')->whereNotNull('ad_guid')->whereNotNull('ad_disabled_at')
|
||||
->update(['deleted_at' => DB::raw('ad_disabled_at')]);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table): void {
|
||||
$table->dropSoftDeletes();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('ad_sync_runs', function (Blueprint $table): void {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('status', 16);
|
||||
$table->boolean('dry_run');
|
||||
$table->boolean('deactivate_missing');
|
||||
$table->json('counts')->nullable();
|
||||
$table->string('failure')->nullable();
|
||||
$table->unsignedInteger('duration_ms');
|
||||
$table->timestamp('finished_at')->index();
|
||||
$table->index(['dry_run', 'status', 'finished_at']);
|
||||
});
|
||||
|
||||
Schema::table('users', function (Blueprint $table): void {
|
||||
$table->string('ad_disabled_reason', 32)->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table): void {
|
||||
$table->dropColumn('ad_disabled_reason');
|
||||
});
|
||||
|
||||
Schema::dropIfExists('ad_sync_runs');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user