Answers for "what to do if we have to add new column in existing migration"

PHP
4

git commit all changes

#Add all files which have been modified (including tracked and untracked)
git add -A
#Commit changes with a message
git commit -m "some message"
Posted by: Guest on May-29-2020
3

add a new column to existing table in a migration

// for Laravel 5+
php artisan make:migration add_email_to_users_table --table=users

public function up()
{
    Schema::table('users', function($table) {
        $table->integer('email');
    });
}

public function down()
{
    Schema::table('users', function($table) {
        $table->dropColumn('email');
    });
}

php artisan migrate
Posted by: Guest on January-01-2021
0

add new column in existing table in laravel migration

public function up()
{
    Schema::table('users', function($table) {
        $table->integer('paid');
    });
}
Posted by: Guest on August-19-2020

Code answers related to "what to do if we have to add new column in existing migration"

Browse Popular Code Answers by Language