Laravel中大部份對於migrate的操作都只有新增,如下:
1 2 3 4 5 6 7 |
Schema::create('user', function($table){ $table->increments('id'); $table->string('username'); $table->string('email'); $table->string('password'); $table->timestamps(); }); |
但如果是在建立完成後,需要再次異動某個欄位的資料時,可以用下面這個方法直接異動:
1 |
DB::statement('ALTER TABLE `user` MODIFY `id` INTEGER UNSIGNED NULL;'); |
8276 全部 5 今日