mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 17:54:30 -04:00
Check for InnoDB engine
This commit is contained in:
parent
43d15aface
commit
d06ea6c72e
@ -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');
|
||||
|
Loading…
x
Reference in New Issue
Block a user