Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Add fields to a table with a migration - Laravel

php artisan make:migration add_company_id_to_users_table

//in up() method
Schema::table('users', function (Blueprint $table) {
  $table->unsignedBigInteger('company_id');
});

//in down() method
Schema::table('users', function (Blueprint $table) {
  $table->dropColumn('company_id');
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Add #fields #table #migration #Laravel
ADD COMMENT
Topic
Name
8+7 =