Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 11-27 (lines=17) @@
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
            \Log::error($e->getMessage ());
23
            return; // Migration may be partly done already...
24
        }
25
26
        Schema::enableForeignKeyConstraints();
27
    }
28
29
    public function down(): void
30
    {
@@ 29-45 (lines=17) @@
26
        Schema::enableForeignKeyConstraints();
27
    }
28
29
    public function down(): void
30
    {
31
        Schema::disableForeignKeyConstraints();
32
33
        try {
34
            Schema::table($this->prefix . 'telegram_update', static function (Blueprint $table) {
35
                $table->dropIndex('chat_message_id');
36
                $table->dropIndex('message_id');
37
                $table->index('message_id', 'message_id');
38
            });
39
        } catch (Throwable $e) {
40
            \Log::error($e->getMessage ());
41
            return; // Migration may be partly done already...
42
        }
43
44
        Schema::enableForeignKeyConstraints();
45
    }
46
}
47