Add migration

This commit is contained in:
Daniel Supernault 2022-10-06 23:57:48 -06:00
parent 923dfdbaaa
commit 2feaffa98d
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 37 additions and 6 deletions

View file

@ -14,11 +14,6 @@ class AddReblogOfIdIndexToStatusesTable extends Migration
public function up() public function up()
{ {
Schema::table('statuses', function (Blueprint $table) { Schema::table('statuses', function (Blueprint $table) {
$sc = Schema::getConnection()->getDoctrineSchemaManager();
if(array_key_exists('statuses_in_reply_or_reblog_index', $sc)) {
$table->dropIndex('statuses_in_reply_or_reblog_index');
}
$table->index('in_reply_to_id'); $table->index('in_reply_to_id');
$table->index('reblog_of_id'); $table->index('reblog_of_id');
}); });
@ -32,7 +27,8 @@ class AddReblogOfIdIndexToStatusesTable extends Migration
public function down() public function down()
{ {
Schema::table('statuses', function (Blueprint $table) { Schema::table('statuses', function (Blueprint $table) {
// $table->dropIndex('statuses_in_reply_to_id_index');
$table->dropIndex('statuses_reblog_of_id_index');
}); });
} }
} }

View file

@ -0,0 +1,35 @@
<?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) {
$sc = Schema::getConnection()->getDoctrineSchemaManager();
if(array_key_exists('statuses_in_reply_to_id_reblog_of_id_index', $sc->listTableIndexes('statuses'))) {
$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) {
//
});
}
}