Don't allow null schedule names anymore; ref #2609

This commit is contained in:
Dane Everitt 2020-10-26 19:57:08 -07:00
parent e8e2206a40
commit 200a78d77b
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RemoveNullableFromScheduleNameField extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::update("UPDATE schedules SET name = 'Schedule' WHERE name IS NULL OR name = ''");
Schema::table('schedules', function (Blueprint $table) {
$table->string('name')->nullable(false)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('schedules', function (Blueprint $table) {
$table->string('name')->nullable()->change();
});
}
}