Fixed migration to add the type column to the messages table
This commit is contained in:
parent
32de7a50ab
commit
19a209c06b
1 changed files with 3 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\MessageType;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
|
@ -15,8 +16,7 @@ class AddMessageType extends Migration
|
|||
public function up()
|
||||
{
|
||||
Schema::table('messages', function (Blueprint $table) {
|
||||
$table->integer('type')
|
||||
->nullable()
|
||||
$table->unsignedTinyInteger('type')
|
||||
->comment('Message Type defined by an enum.')
|
||||
->after('message');
|
||||
});
|
||||
|
|
@ -24,7 +24,7 @@ class AddMessageType extends Migration
|
|||
$messages = DB::table('messages')->get();
|
||||
collect($messages)->map(function (object $message) {
|
||||
DB::table('messages')->where('id', $message->id)
|
||||
->update(['type' => 2]);
|
||||
->update(['type' => MessageType::public()]);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue