feat: Add nullable constraint to 'fingerprint' column in private_keys table

This commit is contained in:
Andras Bacsai
2024-09-19 13:16:08 +02:00
parent 1c5fd8d668
commit c874261c5b

View File

@@ -1,16 +1,16 @@
<?php <?php
use App\Models\PrivateKey;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use App\Models\PrivateKey;
class AddSshKeyFingerprintToPrivateKeysTable extends Migration class AddSshKeyFingerprintToPrivateKeysTable extends Migration
{ {
public function up() public function up()
{ {
Schema::table('private_keys', function (Blueprint $table) { Schema::table('private_keys', function (Blueprint $table) {
$table->string('fingerprint')->after('private_key')->unique(); $table->string('fingerprint')->after('private_key')->nullable();
}); });
PrivateKey::whereNull('fingerprint')->each(function ($key) { PrivateKey::whereNull('fingerprint')->each(function ($key) {