How can I modify a migration in Laravel?

前端 未结 5 633
眼角桃花
眼角桃花 2020-12-29 23:49

I\'m trying to modify a existing migration. Here is my current migration class:

class CreateLogForUserTable extends Migration
{
    public function up()
             


        
5条回答
  •  误落风尘
    2020-12-30 00:40

    There are 2 ways to do this:

    1. Run php artisan migrate:refresh. This will rollback all your migrations and migrate all your migrations. If you run this command, all the data inserted in your database will be lost.
    2. Run php artisan make:migration enter_your_migration_name_here. Then insert this in your migration:

      $table->string('error_message')->nullable()->change();

      Then run php artisan migrate to make your table changes. (Take note that when you do this, you have require composer require doctrine/dbal in your composer)

提交回复
热议问题