Code Duplication    Length = 19-19 lines in 2 locations

database/migrations/2019_10_19_175205_updates_for_version_5_0.php 2 locations

@@ 72-90 (lines=19) @@
69
                $table->foreign('cust_id')->references('cust_id')->on('customers')->onUpdate('cascade')->onDelete('cascade');
70
            });
71
        }
72
        if(!Schema::hasColumn('file_links', 'note'))
73
        {
74
            Schema::table('file_links', function(Blueprint $table) {
75
                $table->longText('note')
76
                    ->nullable()
77
                    ->after('link_name');
78
            });
79
            $instructions = DB::select('SELECT * FROM `file_link_instructions`');
80
            foreach($instructions as $ins)
81
            {
82
                FileLinksDB::find($ins->link_id)->update([
83
                    'note' => $ins->instruction
84
                ]);
85
            }
86
            Schema::table('file_link_instructions', function (Blueprint $table) {
87
                $table->dropForeign(['link_id']);
88
            });
89
            Schema::dropIfExists('file_link_instructions');
90
        }
91
        //  Add "notes" column to the file link files table
92
        if (!Schema::hasColumn('file_link_files', 'note')) {
93
            Schema::table('file_link_files', function (Blueprint $table) {
@@ 92-110 (lines=19) @@
89
            Schema::dropIfExists('file_link_instructions');
90
        }
91
        //  Add "notes" column to the file link files table
92
        if (!Schema::hasColumn('file_link_files', 'note')) {
93
            Schema::table('file_link_files', function (Blueprint $table) {
94
                $table->longText('note')
95
                    ->nullable()
96
                    ->after('upload');
97
            });
98
            $notes = DB::select('SELECT * FROM `file_link_notes`');
99
            foreach($notes as $note)
100
            {
101
                FileLinkFiles::where('file_id', $note->file_id)->update([
102
                    'note' => $note->note
103
                ]);
104
            }
105
            Schema::table('file_link_notes', function (Blueprint $table) {
106
                $table->dropForeign(['link_id']);
107
                $table->dropForeign(['file_id']);
108
            });
109
            Schema::dropIfExists('file_link_notes');
110
        }
111
112
        //  Add the 'documentation' column in the tech_tips table
113
        if(!Schema::hasColumn('tech_tips', 'documentation'))