Skip to content

Commit

Permalink
perf: add index to posts.ip_address (#33)
Browse files Browse the repository at this point in the history
* perf: add index to posts.ip_address

* Apply fixes from StyleCI

---------

Co-authored-by: StyleCI Bot <[email protected]>
  • Loading branch information
imorland and StyleCIBot authored Nov 27, 2023
1 parent 71a46ad commit f80b48f
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?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 f80b48f

Please sign in to comment.