Answers for "how to alter table column using laravel migration"

PHP
1

add column to migration laravel

class AddProfileToUsers extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->string('profile')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('shop_users', function (Blueprint $table) {
            $table->dropColumn(['profile']);
        });
    }
}
Posted by: Guest on June-08-2020
0

laravel 6 migration add column to existing table

migration add column to existing table in laravel 6
Posted by: Guest on September-09-2020

Code answers related to "how to alter table column using laravel migration"

Browse Popular Code Answers by Language