From 2feaffa98d3a7d268cdb217ec72321d337b70289 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 6 Oct 2022 23:57:48 -0600 Subject: [PATCH] Add migration --- ...d_reblog_of_id_index_to_statuses_table.php | 8 ++--- ...old_compound_index_from_statuses_table.php | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 database/migrations/2022_10_07_055133_remove_old_compound_index_from_statuses_table.php diff --git a/database/migrations/2022_10_07_045520_add_reblog_of_id_index_to_statuses_table.php b/database/migrations/2022_10_07_045520_add_reblog_of_id_index_to_statuses_table.php index 85a055558..b577063fb 100644 --- a/database/migrations/2022_10_07_045520_add_reblog_of_id_index_to_statuses_table.php +++ b/database/migrations/2022_10_07_045520_add_reblog_of_id_index_to_statuses_table.php @@ -14,11 +14,6 @@ class AddReblogOfIdIndexToStatusesTable extends Migration public function up() { 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('reblog_of_id'); }); @@ -32,7 +27,8 @@ class AddReblogOfIdIndexToStatusesTable extends Migration public function down() { Schema::table('statuses', function (Blueprint $table) { - // + $table->dropIndex('statuses_in_reply_to_id_index'); + $table->dropIndex('statuses_reblog_of_id_index'); }); } } diff --git a/database/migrations/2022_10_07_055133_remove_old_compound_index_from_statuses_table.php b/database/migrations/2022_10_07_055133_remove_old_compound_index_from_statuses_table.php new file mode 100644 index 000000000..ae9b84bbc --- /dev/null +++ b/database/migrations/2022_10_07_055133_remove_old_compound_index_from_statuses_table.php @@ -0,0 +1,35 @@ +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) { + // + }); + } +}