mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-01 20:17:35 -04:00 
			
		
		
		
	Check for InnoDB engine
This commit is contained in:
		
							parent
							
								
									efc226c23d
								
							
						
					
					
						commit
						e08f583c3a
					
				| @ -268,6 +268,7 @@ class AppController extends BaseController | ||||
|         if (! Utils::isNinjaProd()) { | ||||
|             try { | ||||
|                 set_time_limit(60 * 5); | ||||
|                 $this->checkInnoDB(); | ||||
|                 Artisan::call('clear-compiled'); | ||||
|                 Artisan::call('cache:clear'); | ||||
|                 Artisan::call('debugbar:clear'); | ||||
| @ -303,6 +304,21 @@ class AppController extends BaseController | ||||
|         return Redirect::to('/'); | ||||
|     } | ||||
| 
 | ||||
|     // MySQL changed the default table type from MyISAM to InnoDB
 | ||||
|     // We need to make sure all tables are InnoDB to prevent migration failures
 | ||||
|     public function checkInnoDB() | ||||
|     { | ||||
|         $tables = DB::select('SHOW TABLES'); | ||||
|         $sql = "SET sql_mode = 'ALLOW_INVALID_DATES';\n"; | ||||
| 
 | ||||
|         foreach($tables as $table) { | ||||
|             $fieldName = 'Tables_in_' . env('DB_DATABASE'); | ||||
|             $sql .= "ALTER TABLE {$table->$fieldName} engine=InnoDB;\n"; | ||||
|         } | ||||
| 
 | ||||
|         DB::unprepared($sql); | ||||
|     } | ||||
| 
 | ||||
|     public function emailBounced() | ||||
|     { | ||||
|         $messageId = Input::get('MessageID'); | ||||
|  | ||||
| @ -14,8 +14,6 @@ If the auto-update fails you can manually run the update with the following comm | ||||
|    php artisan migrate | ||||
|    php artisan db:seed --class=UpdateSeeder | ||||
| 
 | ||||
| We’ve seen some updates fail when moving the app to a new server because the MySQL default storage engine has changed with MySQL 5.7. If you see ``SQLSTATE[HY000]: General error: 1215`` error you may be able to fix it by running this `SQL query <https://www.invoiceninja.com/forums/topic/problem-with-new-install/#post-5313>`_ | ||||
| 
 | ||||
| Version 2.6 | ||||
| """"""""""" | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user