Fix revamp api_keys migration (#987)

This commit is contained in:
MartinOscar 2025-03-15 19:42:43 +01:00 committed by GitHub
parent 6bc55b1039
commit 98c36c4cc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -18,8 +18,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @property int $key_type
* @property string $identifier
* @property string $token
* @property string[] $permissions
* @property string[] $allowed_ips
* @property string[]|null $permissions
* @property string[]|null $allowed_ips
* @property string|null $memo
* @property \Illuminate\Support\Carbon|null $last_used_at
* @property \Illuminate\Support\Carbon|null $expires_at

View File

@ -22,7 +22,7 @@ return new class extends Migration
public function up(): void
{
Schema::table('api_keys', function (Blueprint $table) {
$table->json('permissions');
$table->json('permissions')->nullable();
});
foreach (ApiKey::all() as $apiKey) {
@ -72,7 +72,7 @@ return new class extends Migration
$table->unsignedTinyInteger('r_mounts')->default(0);
});
foreach (ApiKey::query() as $apiKey) {
foreach (ApiKey::all() as $apiKey) {
DB::table('api_keys')
->where('id', $apiKey->id)
->update([