Skip to content

Commit

Permalink
perf: add index to posts.ip_address
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland committed Nov 27, 2023
1 parent 71a46ad commit c30b8f1
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/*
* This file is part of fof/ban-ips.
*
* Copyright (c) FriendsOfFlarum.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/


use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder;

return [
'up' => function (Builder $schema) {
$schema->table('posts', function (Blueprint $table) {
$table->index('ip_address');
$table->index(['user_id', 'ip_address']);
});
},
'down' => function (Builder $schema) {
$schema->table('posts', function (Blueprint $table) {
$table->dropIndex(['ip_address']);
$table->dropIndex(['user_id', 'ip_address']);
});
},
];

0 comments on commit c30b8f1

Please sign in to comment.