Code Duplication    Length = 16-16 lines in 2 locations

src/database/migrations/2020_05_18_000000_update_schema_0_60_0_to_0_61_0.php 2 locations

@@ 11-26 (lines=16) @@
8
9
class UpdateSchema0600To0610 extends Migration
10
{
11
    public function up(): void
12
    {
13
        Schema::disableForeignKeyConstraints();
14
15
        try {
16
            Schema::table($this->prefix . 'telegram_update', static function (Blueprint $table) {
17
                $table->dropIndex('message_id');
18
                $table->index('message_id', 'message_id');
19
                $table->index(['chat_id', 'message_id'], 'chat_message_id');
20
            });
21
        } catch (Throwable $e) {
22
            return; // Migration may be partly done already...
23
        }
24
25
        Schema::enableForeignKeyConstraints();
26
    }
27
28
    public function down(): void
29
    {
@@ 28-43 (lines=16) @@
25
        Schema::enableForeignKeyConstraints();
26
    }
27
28
    public function down(): void
29
    {
30
        Schema::disableForeignKeyConstraints();
31
32
        try {
33
            Schema::table($this->prefix . 'telegram_update', static function (Blueprint $table) {
34
                $table->dropIndex('chat_message_id');
35
                $table->dropIndex('message_id');
36
                $table->index('message_id', 'message_id');
37
            });
38
        } catch (Throwable $e) {
39
            return; // Migration may be partly done already...
40
        }
41
42
        Schema::enableForeignKeyConstraints();
43
    }
44
}
45