Check if the column exists before dropping. Also recreate the column in a rollback to make the migrations happy. Also break into two migrations to make sqlite happy.
This commit is contained in:
parent
a6849fc689
commit
c52e3b5f9c
2 changed files with 37 additions and 2 deletions
|
@ -14,8 +14,8 @@ class RemoveOptionKeysFromSettingsTable extends Migration
|
||||||
{
|
{
|
||||||
Schema::table('settings', function (Blueprint $table) {
|
Schema::table('settings', function (Blueprint $table) {
|
||||||
//
|
//
|
||||||
$table->dropColumn('option_name');
|
if(Schema::hasColumn('option_name', 'settings'))
|
||||||
$table->dropColumn('option_value');
|
$table->dropColumn('option_name');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ class RemoveOptionKeysFromSettingsTable extends Migration
|
||||||
{
|
{
|
||||||
Schema::table('Settings', function (Blueprint $table) {
|
Schema::table('Settings', function (Blueprint $table) {
|
||||||
//
|
//
|
||||||
|
$table->string('option_name')->nullable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class RemoveOptionValueFromSettingsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('settings', function (Blueprint $table) {
|
||||||
|
//
|
||||||
|
if(Schema::hasColumn('option_value', 'settings'))
|
||||||
|
$table->dropColumn('option_value');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Schema::table('settings', function (Blueprint $table) {
|
||||||
|
$table->string('option_value')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue