Page 1 of 1

How to make migration flexable in laravel ??

Posted: Sun Jan 01, 2017 9:18 am
by gautamz07
Hey guys i have the following migration file in my laravel app as of now:

Code: Select all

class QualityCheckTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('quality_check', function (Blueprint $table) {
            $table->increments('id');
            $table->text('site-name');
            $table->boolean('favicon');
            $table->boolean('title');
            $table->boolean('image-optimization');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('quality_check');
    }
}
Every now and then i have to add a new property to the migration ... how do i make this migration flexable ?? I.E. Say i want to add the following property to the above migration:

Code: Select all

$table->boolean('favicon');
How do i do it ?? without loosing my earlier data and my earlier migration ??

Thank you.
Gautam.

Re: How to make migration flexable in laravel ??

Posted: Sun Jan 01, 2017 9:30 am
by Celauran
Create a new migration to add the new field only.

Re: How to make migration flexable in laravel ??

Posted: Sun Jan 01, 2017 10:28 am
by Celauran

Re: How to make migration flexable in laravel ??

Posted: Wed Jan 04, 2017 1:25 am
by gautamz07
ok thanks ! :)