Skip to content

Commit

Permalink
Update 2024_02_29_111020_update_type_column_in_config_table.php.
Browse files Browse the repository at this point in the history
  • Loading branch information
YunusEmreNalbant committed Mar 7, 2024
1 parent 6a0d91c commit ab3dd99
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,21 @@ class UpdateTypeColumnInConfigTable extends Migration
*/
public function up(): void
{
Schema::table(config('laravel-config.table'), function (Blueprint $table) {
DB::statement("ALTER TABLE laravel_config CHANGE type type varchar(255) DEFAULT 'boolean' NOT NULL");
});
$tableName = config('laravel-config.table');

Schema::table($tableName, function () use($tableName): void {
DB::statement("ALTER TABLE $tableName CHANGE type type varchar(255) DEFAULT 'boolean' NOT NULL"); });
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Schema::table(config('laravel-config.table'), function (Blueprint $table) {
DB::statement("ALTER TABLE laravel_config CHANGE type type ENUM('boolean','text') DEFAULT 'boolean' NOT NULL ");
$tableName = config('laravel-config.table');

Schema::table($tableName, function () use($tableName): void {
DB::statement("ALTER TABLE $tableName CHANGE type type ENUM('boolean','text') DEFAULT 'boolean' NOT NULL ");
});
}
}

0 comments on commit ab3dd99

Please sign in to comment.