Skip to content

Commit ab3dd99

Browse files
Update 2024_02_29_111020_update_type_column_in_config_table.php.
1 parent 6a0d91c commit ab3dd99

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

database/migrations/2024_02_29_111020_update_type_column_in_config_table.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,21 @@ class UpdateTypeColumnInConfigTable extends Migration
1414
*/
1515
public function up(): void
1616
{
17-
Schema::table(config('laravel-config.table'), function (Blueprint $table) {
18-
DB::statement("ALTER TABLE laravel_config CHANGE type type varchar(255) DEFAULT 'boolean' NOT NULL");
19-
});
17+
$tableName = config('laravel-config.table');
18+
19+
Schema::table($tableName, function () use($tableName): void {
20+
DB::statement("ALTER TABLE $tableName CHANGE type type varchar(255) DEFAULT 'boolean' NOT NULL"); });
2021
}
2122

2223
/**
2324
* Reverse the migrations.
24-
*
25-
* @return void
2625
*/
2726
public function down(): void
2827
{
29-
Schema::table(config('laravel-config.table'), function (Blueprint $table) {
30-
DB::statement("ALTER TABLE laravel_config CHANGE type type ENUM('boolean','text') DEFAULT 'boolean' NOT NULL ");
28+
$tableName = config('laravel-config.table');
29+
30+
Schema::table($tableName, function () use($tableName): void {
31+
DB::statement("ALTER TABLE $tableName CHANGE type type ENUM('boolean','text') DEFAULT 'boolean' NOT NULL ");
3132
});
3233
}
3334
}

0 commit comments

Comments
 (0)