xxxxxxxxxx
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');
});
xxxxxxxxxx
php artisan make:migration add_paid_to_users_table --table=users
public function up()
{
Schema::table('users', function($table) {
$table->integer('paid');
});
}
public function down()
{
Schema::table('users', function($table) {
$table->dropColumn('paid');
});
}
php artisan migrate
xxxxxxxxxx
php artisan make:migration add_store_id_to_users_table --table=users
xxxxxxxxxx
php artisan make:migration add_paid_to_users_table --table=users
public function up()
{
Schema::table('users', function($table) {
$table->integer('paid');
});
}
and don't forget to add the rollback option:
public function down()
{
Schema::table('users', function($table) {
$table->dropColumn('paid');
});
}
xxxxxxxxxx
public function down()
{
Schema::table('users', function($table) {
$table->dropColumn('paid');
});
}
xxxxxxxxxx
Schema::table('table_name', function (Blueprint $table) {
$table->string('column_name', 255)->nullable()->after('previous_column_name');
});
xxxxxxxxxx
public function up()
{
Schema::table('users', function($table) {
$table->integer('paid');
});
}