Passed
Push — dev5 ( 26b8d9...de9a93 )
by Ron
05:36
created
database/migrations/2019_10_19_175205_updates_for_version_5_0.php 1 patch
Braces   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -80,7 +80,8 @@  discard block
 block discarded – undo
80 80
     //  Added the ability to set an expiration date for user passwords - will force them to change after this expires
81 81
     private function addPasswordExpiresColumn()
82 82
     {
83
-        if(!Schema::hasColumn('users', 'password_expires')) {
83
+        if(!Schema::hasColumn('users', 'password_expires'))
84
+        {
84 85
             Schema::table('users', function(Blueprint $table) {
85 86
                 $table->timestamp('password_expires')
86 87
                     ->nullable()
@@ -150,7 +151,8 @@  discard block
 block discarded – undo
150 151
     //  Added a 'hidden' attribute to system customer data types to allow passwords to not be viewed unless clicked or focus
151 152
     private function addHiddenColumn()
152 153
     {
153
-        if(!Schema::hasColumn('system_data_field_types', 'hidden')) {
154
+        if(!Schema::hasColumn('system_data_field_types', 'hidden'))
155
+        {
154 156
             Schema::table('system_cust_data_types', function(Blueprint $table) {
155 157
                 $table->boolean('hidden')
156 158
                     ->default(0)
@@ -162,7 +164,8 @@  discard block
 block discarded – undo
162 164
     //  Update the File links table - add cust_id and note column
163 165
     private function addColumnsToFileLinksTable()
164 166
     {
165
-        if(!Schema::hasColumn('file_links', 'cust_id')) {
167
+        if(!Schema::hasColumn('file_links', 'cust_id'))
168
+        {
166 169
             Schema::table('file_links', function(Blueprint $table) {
167 170
                 $table->integer('cust_id')
168 171
                     ->unsigned()
@@ -171,7 +174,8 @@  discard block
 block discarded – undo
171 174
                 $table->foreign('cust_id')->references('cust_id')->on('customers')->onUpdate('cascade')->onDelete('cascade');
172 175
             });
173 176
         }
174
-        if(!Schema::hasColumn('file_links', 'note')) {
177
+        if(!Schema::hasColumn('file_links', 'note'))
178
+        {
175 179
             Schema::table('file_links', function(Blueprint $table) {
176 180
                 $table->longText('note')
177 181
                     ->nullable()
@@ -179,7 +183,8 @@  discard block
 block discarded – undo
179 183
             });
180 184
             //  Migrate the instructions from the old table to the new column
181 185
             $instructions = DB::select('SELECT * FROM `file_link_instructions`');
182
-            foreach($instructions as $ins) {
186
+            foreach($instructions as $ins)
187
+            {
183 188
                 FileLinks::find($ins->link_id)->update([
184 189
                     'note' => $ins->instruction
185 190
                 ]);
@@ -190,7 +195,8 @@  discard block
 block discarded – undo
190 195
     //  Add Notes column to the file links files table
191 196
     private function addNotesColumnToFileLinkFiles()
192 197
     {
193
-        if(!Schema::hasColumn('file_link_files', 'note')) {
198
+        if(!Schema::hasColumn('file_link_files', 'note'))
199
+        {
194 200
             Schema::table('file_link_files', function(Blueprint $table) {
195 201
                 $table->longText('note')
196 202
                     ->nullable()
@@ -198,7 +204,8 @@  discard block
 block discarded – undo
198 204
             });
199 205
             //  Migrate the existing notes to the new table
200 206
             $notes = DB::select('SELECT * FROM `file_link_notes`');
201
-            foreach($notes as $note) {
207
+            foreach($notes as $note)
208
+            {
202 209
                 FileLinkFiles::where('file_id', $note->file_id)->update([
203 210
                     'note' => $note->note
204 211
                 ]);
@@ -209,14 +216,16 @@  discard block
 block discarded – undo
209 216
     //  Add the documentation column to the tech tips table
210 217
     private function addDocumentationColumnToTechTips()
211 218
     {
212
-        if(!Schema::hasColumn('tech_tips', 'documentation')) {
219
+        if(!Schema::hasColumn('tech_tips', 'documentation'))
220
+        {
213 221
             Schema::table('tech_tips', function(Blueprint $table) {
214 222
                 $table->boolean('documentation')->default(0)->nullable()->after('public');
215 223
             });
216 224
 
217 225
             //  Move all of the system files over to the tech tips table
218 226
             $sysFiles = DB::select('SELECT * FROM `system_files`');
219
-            foreach($sysFiles as $sysFile) {
227
+            foreach($sysFiles as $sysFile)
228
+            {
220 229
                 $newTip = TechTips::create([
221 230
                     'user_id'       => $sysFile->user_id,
222 231
                     'public'        => 0,
@@ -310,7 +319,8 @@  discard block
 block discarded – undo
310 319
     //  Remove the system files and system file types table
311 320
     private function removeSystemFilesTables()
312 321
     {
313
-        if(Schema::hasTable('system_files')) {
322
+        if(Schema::hasTable('system_files'))
323
+        {
314 324
             Schema::table('system_files', function(Blueprint $table) {
315 325
                 $table->dropForeign(['sys_id']);
316 326
                 $table->dropForeign(['type_id']);
Please login to merge, or discard this patch.