在数据库表中,如下所示;
public function up()
{
Schema::create('current_adresses', function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->increments('id');
$table->string('current_name',50)->nullable();
$table->string('current_surname',50)->nullable();
$table->string('telephone',25)->nullable();
$table->timestamps();
});
}
我想做如下;
public function up()
{
Schema::create('current_adresses', function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->increments('id');
$table->string('current_name',50)->nullable();
$table->string('current_surname',50)->nullable();
$table->string('gsm',25)->nullable();
$table->string('telephone',25)->nullable();
$table->timestamps();
});
}
如何在不刷新的情况下更新新列(gsm列)(php artisan migrate:refresh)
答案 0 :(得分:4)
添加new
迁移 -
public function up()
{
Schema::table('current_adresses', function($table) {
$table->string('gsm',25)->nullable();
});
}
public function down()
{
Schema::table('current_adresses', function($table) {
$table->dropColumn('gsm');
});
}
请参阅t his链接以便更好地理解。