pixelfed/database/migrations/2022_11_30_123940_update_avatars_table_remove_cdn_url_unique_constraint.php

35 lines
781 B
PHP
Raw Normal View History

2022-12-02 08:12:43 +00:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('avatars', function (Blueprint $table) {
2024-07-01 08:39:42 +00:00
$indexes = Schema::getIndexes('avatars');
$indexesFound = collect($indexes)->map(function($i) { return $i['name']; })->toArray();
if (in_array('avatars_cdn_url_unique', $indexesFound)) {
2022-12-02 08:12:43 +00:00
$table->dropUnique('avatars_cdn_url_unique');
}
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
};