pixelfed/database/migrations/2022_10_07_055133_remove_old_compound_index_from_statuses_table.php

37 lines
930 B
PHP
Raw Permalink Normal View History

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