Skip to content

Commit 200a78d

Browse files
committed
Don't allow null schedule names anymore; ref pterodactyl#2609
1 parent e8e2206 commit 200a78d

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\DB;
4+
use Illuminate\Database\Migrations\Migration;
5+
use Illuminate\Database\Schema\Blueprint;
6+
use Illuminate\Support\Facades\Schema;
7+
8+
class RemoveNullableFromScheduleNameField extends Migration
9+
{
10+
/**
11+
* Run the migrations.
12+
*
13+
* @return void
14+
*/
15+
public function up()
16+
{
17+
DB::update("UPDATE schedules SET name = 'Schedule' WHERE name IS NULL OR name = ''");
18+
19+
Schema::table('schedules', function (Blueprint $table) {
20+
$table->string('name')->nullable(false)->change();
21+
});
22+
}
23+
24+
/**
25+
* Reverse the migrations.
26+
*
27+
* @return void
28+
*/
29+
public function down()
30+
{
31+
Schema::table('schedules', function (Blueprint $table) {
32+
$table->string('name')->nullable()->change();
33+
});
34+
}
35+
}

0 commit comments

Comments
 (0)