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

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