From 05b54564dae9954edb2c458298672ce59ba57a8f Mon Sep 17 00:00:00 2001 From: leuc Date: Wed, 13 Feb 2019 23:30:09 +0100 Subject: [PATCH] Add database indexes for objects using soft delete --- ...9_02_13_221138_add_soft_delete_indexes.php | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 database/migrations/2019_02_13_221138_add_soft_delete_indexes.php diff --git a/database/migrations/2019_02_13_221138_add_soft_delete_indexes.php b/database/migrations/2019_02_13_221138_add_soft_delete_indexes.php new file mode 100644 index 000000000..ed10b82c3 --- /dev/null +++ b/database/migrations/2019_02_13_221138_add_soft_delete_indexes.php @@ -0,0 +1,88 @@ +index('deleted_at','avatars_deleted_at_index'); + }); + + Schema::table('profiles', function (Blueprint $table) { + $table->index('deleted_at','profiles_deleted_at_index'); + }); + + Schema::table('mentions', function (Blueprint $table) { + $table->index('deleted_at','mentions_deleted_at_index'); + }); + + Schema::table('likes', function (Blueprint $table) { + $table->index('deleted_at','likes_deleted_at_index'); + }); + + Schema::table('statuses', function (Blueprint $table) { + $table->index('deleted_at','statuses_deleted_at_index'); + }); + + Schema::table('media', function (Blueprint $table) { + $table->index('deleted_at','media_deleted_at_index'); + }); + + Schema::table('notifications', function (Blueprint $table) { + $table->index('deleted_at','notifications_deleted_at_index'); + }); + + Schema::table('users', function (Blueprint $table) { + $table->index('deleted_at','users_deleted_at_index'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('avatars', function (Blueprint $table) { + $table->dropIndex('deleted_at','avatars_deleted_at_index'); + }); + + Schema::table('profiles', function (Blueprint $table) { + $table->dropIndex('deleted_at','profiles_deleted_at_index'); + }); + + Schema::table('mentions', function (Blueprint $table) { + $table->dropIndex('deleted_at','mentions_deleted_at_index'); + }); + + Schema::table('likes', function (Blueprint $table) { + $table->dropIndex('deleted_at','likes_deleted_at_index'); + }); + + Schema::table('statuses', function (Blueprint $table) { + $table->dropIndex('deleted_at','statuses_deleted_at_index'); + }); + + Schema::table('media', function (Blueprint $table) { + $table->dropIndex('deleted_at','media_deleted_at_index'); + }); + + Schema::table('notifications', function (Blueprint $table) { + $table->dropIndex('deleted_at','notifications_deleted_at_index'); + }); + + Schema::table('users', function (Blueprint $table) { + $table->dropIndex('deleted_at','users_deleted_at_index'); + }); + } +}