Fixes migrations to actually rollback all the way.
This commit is contained in:
		
							parent
							
								
									33262cf34c
								
							
						
					
					
						commit
						d695532aa2
					
				| @ -29,6 +29,6 @@ class AddAllocationsTable extends Migration | ||||
|      */ | ||||
|     public function down() | ||||
|     { | ||||
|         Schema::dropIfExsits('allocations'); | ||||
|         Schema::dropIfExists('allocations'); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -28,6 +28,6 @@ class CreateFailedJobsTable extends Migration | ||||
|      */ | ||||
|     public function down() | ||||
|     { | ||||
|         Schema::drop('failed_jobs'); | ||||
|         Schema::dropIfExists('failed_jobs'); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -32,6 +32,6 @@ class CreateJobsTable extends Migration | ||||
|      */ | ||||
|     public function down() | ||||
|     { | ||||
|         Schema::drop('jobs'); | ||||
|         Schema::dropIfExists('jobs'); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -28,8 +28,6 @@ class AddServerVariables extends Migration | ||||
|      */ | ||||
|     public function down() | ||||
|     { | ||||
|         Schema::table('server_variables', function (Blueprint $table) { | ||||
|             //
 | ||||
|         }); | ||||
|         Schema::dropIfExists('server_variables'); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -30,6 +30,6 @@ class AddServiceOptions extends Migration | ||||
|      */ | ||||
|     public function down() | ||||
|     { | ||||
|         Schema::dropIfExsits('service_options'); | ||||
|         Schema::dropIfExists('service_options'); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -32,14 +32,11 @@ class AddForeignServerVariables extends Migration | ||||
|       public function down() | ||||
|       { | ||||
|           Schema::table('server_variables', function (Blueprint $table) { | ||||
|               $table->dropForeign('server_variables_server_id_foreign'); | ||||
|               $table->dropForeign('server_variables_variable_id_foreign'); | ||||
| 
 | ||||
|               $table->dropIndex('server_variables_server_id_foreign'); | ||||
|               $table->dropIndex('server_variables_variable_id_foreign'); | ||||
|               $table->dropForeign(['server_id']); | ||||
|               $table->dropForeign(['variable_id']); | ||||
|           }); | ||||
| 
 | ||||
|           DB::statement('ALTER TABLE allocations | ||||
|           DB::statement('ALTER TABLE server_variables | ||||
|               MODIFY COLUMN server_id MEDIUMINT(8) UNSIGNED NULL, | ||||
|               MODIFY COLUMN variable_id MEDIUMINT(8) UNSIGNED NOT NULL | ||||
|           '); | ||||
|  | ||||
| @ -26,11 +26,7 @@ class AddForeignTasks extends Migration | ||||
|     public function down() | ||||
|     { | ||||
|         Schema::table('tasks', function (Blueprint $table) { | ||||
|             $table->dropForeign('tasks_server_foreign'); | ||||
|             $table->dropForeign('tasks_server_foreign'); | ||||
| 
 | ||||
|             $table->dropIndex('tasks_server_foreign'); | ||||
|             $table->dropIndex('tasks_server_foreign'); | ||||
|             $table->dropForeign(['server']); | ||||
|         }); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -28,8 +28,7 @@ class AddPackColumn extends Migration | ||||
|     public function down() | ||||
|     { | ||||
|         Schema::table('servers', function (Blueprint $table) { | ||||
|             $table->dropForeign('servers_pack_foreign'); | ||||
|             $table->dropIndex('servers_pack_foreign'); | ||||
|             $table->dropForeign(['pack']); | ||||
|             $table->dropColumn('pack'); | ||||
|         }); | ||||
|     } | ||||
|  | ||||
| @ -40,6 +40,9 @@ class UpdateColumnNames extends Migration | ||||
|             $table->foreign('allocation_id')->references('id')->on('allocations'); | ||||
|             $table->foreign('service_id')->references('id')->on('services'); | ||||
|             $table->foreign('option_id')->references('id')->on('service_options'); | ||||
| 
 | ||||
|             // Pack ID was forgotten until multiple releases later, therefore it is
 | ||||
|             // contained in '2017_03_18_204953_AddForeignKeyToPacks'
 | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
| @ -51,19 +54,11 @@ class UpdateColumnNames extends Migration | ||||
|     public function down() | ||||
|     { | ||||
|         Schema::table('servers', function (Blueprint $table) { | ||||
|             $table->dropForeign('servers_node_id_foreign'); | ||||
|             $table->dropForeign('servers_owner_id_foreign'); | ||||
|             $table->dropForeign('servers_allocation_id_foreign'); | ||||
|             $table->dropForeign('servers_service_id_foreign'); | ||||
|             $table->dropForeign('servers_option_id_foreign'); | ||||
|             $table->dropForeign('servers_pack_id_foreign'); | ||||
| 
 | ||||
|             $table->dropIndex('servers_node_id_foreign'); | ||||
|             $table->dropIndex('servers_owner_id_foreign'); | ||||
|             $table->dropIndex('servers_allocation_id_foreign'); | ||||
|             $table->dropIndex('servers_service_id_foreign'); | ||||
|             $table->dropIndex('servers_option_id_foreign'); | ||||
|             $table->dropIndex('servers_pack_id_foreign'); | ||||
|             $table->dropForeign(['node_id']); | ||||
|             $table->dropForeign(['owner_id']); | ||||
|             $table->dropForeign(['allocation_id']); | ||||
|             $table->dropForeign(['service_id']); | ||||
|             $table->dropForeign(['option_id']); | ||||
| 
 | ||||
|             $table->renameColumn('node_id', 'node'); | ||||
|             $table->renameColumn('owner_id', 'owner'); | ||||
| @ -77,6 +72,7 @@ class UpdateColumnNames extends Migration | ||||
|             $table->foreign('allocation')->references('id')->on('allocations'); | ||||
|             $table->foreign('service')->references('id')->on('services'); | ||||
|             $table->foreign('option')->references('id')->on('service_options'); | ||||
|             $table->foreign('pack')->references('id')->on('service_packs'); | ||||
|         }); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -34,7 +34,7 @@ class AddNewServiceOptionsColumns extends Migration | ||||
|     public function down() | ||||
|     { | ||||
|         Schema::table('service_options', function (Blueprint $table) { | ||||
|             $table->dropForeign('config_from'); | ||||
|             $table->dropForeign(['config_from']); | ||||
| 
 | ||||
|             $table->dropColumn('config_from'); | ||||
|             $table->dropColumn('config_stop'); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Dane Everitt
						Dane Everitt