How to make migration flexable in laravel ??

Discussion for various published PHP frameworks, including Zend Framework, CodeIgniter, Kohana, CakePHP, Yii, Symfony, and others.

Moderator: General Moderators

Post Reply
User avatar
gautamz07
Forum Contributor
Posts: 331
Joined: Wed May 14, 2014 12:18 pm

How to make migration flexable in laravel ??

Post 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.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: How to make migration flexable in laravel ??

Post by Celauran »

Create a new migration to add the new field only.
User avatar
gautamz07
Forum Contributor
Posts: 331
Joined: Wed May 14, 2014 12:18 pm

Re: How to make migration flexable in laravel ??

Post by gautamz07 »

ok thanks ! :)
Post Reply