laravel migration เปลี่ยนคอลัมน์ที่แอ็กทีฟ:
Schema::table('users', function (Blueprint $table) {
$table->renameColumn('from', 'to');
});
laravel migration จำนวนเต็ม
$table->bigInteger('votes');
NU
$table->bigInteger('votes');
NU
php artisan migrate:rollback --step=1
laravel migration เปลี่ยนคอลัมน์ประเภท
public function up()
{
Schema::table('sometable', function (Blueprint $table) {
$table->text('text')->change();
});
}
migrations ต้องการสนาม laravel
$table->string('foo')->nullable(false)->change();
laravel rollback เมื่อ migration
php artisan migrate:rollback --step=1
laravel สร้าง migration
php artisan make:migration add_votes_to_users_table --table=users
php artisan make:migration create_users_table --create=users