* Fix migrations when table prefix is involved #442 * Formatting
This commit is contained in:
@@ -6,6 +6,7 @@ use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Http\Request;
|
||||
use Laracasts\Flash\Flash;
|
||||
|
||||
/**
|
||||
* Class Controller
|
||||
@@ -26,7 +27,7 @@ abstract class Controller extends \Illuminate\Routing\Controller
|
||||
*/
|
||||
public function flashError($message, $route)
|
||||
{
|
||||
flash()->error($message);
|
||||
Flash::error($message);
|
||||
return redirect(route($route))->withInput();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddReadonlyToRoles extends Migration
|
||||
|
||||
@@ -18,7 +18,7 @@ class UsersAddPilotId extends Migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
Schema::table('users', static function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('pilot_id')
|
||||
->after('id')
|
||||
->unique()
|
||||
@@ -26,8 +26,7 @@ class UsersAddPilotId extends Migration
|
||||
->index('users_pilot_id');
|
||||
});
|
||||
|
||||
// Migrate the current pilot IDs
|
||||
DB::update('UPDATE `users` SET `pilot_id`=`id`');
|
||||
DB::table('users')->update(['pilot_id' => DB::raw('`id`')]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,8 +16,9 @@ class PirepsChangeStateType extends Migration
|
||||
public function up()
|
||||
{
|
||||
// Migrate the old rejected state
|
||||
DB::update('UPDATE `pireps` SET `state`='.PirepState::REJECTED
|
||||
.' WHERE state=-1');
|
||||
DB::table('pireps')
|
||||
->where(['state' => -1])
|
||||
->update(['state' => PirepState::REJECTED]);
|
||||
|
||||
// Change the column type to an unsigned small int (tinyint not supported on all)
|
||||
Schema::table('pireps', function (Blueprint $table) {
|
||||
|
||||
Reference in New Issue
Block a user