PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Dec 12, 2017 5:22 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Jan 01, 2017 10:18 am 
Offline
Forum Contributor
User avatar

Joined: Wed May 14, 2014 12:18 pm
Posts: 331
Hey guys i have the following migration file in my laravel app as of now:

Syntax: [ Download ] [ Hide ]
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:

Syntax: [ Download ] [ Hide ]
$table->boolean('favicon');


How do i do it ?? without loosing my earlier data and my earlier migration ??

Thank you.
Gautam.


Top
 Profile  
 
PostPosted: Sun Jan 01, 2017 10:30 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6402
Location: Montreal, Canada
Create a new migration to add the new field only.

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
PostPosted: Sun Jan 01, 2017 11:28 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6402
Location: Montreal, Canada
https://laravel.com/docs/5.3/migrations

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
PostPosted: Wed Jan 04, 2017 2:25 am 
Offline
Forum Contributor
User avatar

Joined: Wed May 14, 2014 12:18 pm
Posts: 331
ok thanks ! :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group