📌  相关文章
📜  在迁移中向现有表添加新列 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:58.255000             🧑  作者: Mango

代码示例2
// for Laravel 5+
php artisan make:migration add_email_to_users_table --table=users

public function up()
{
    Schema::table('users', function($table) {
        $table->integer('email');
    });
}

public function down()
{
    Schema::table('users', function($table) {
        $table->dropColumn('email');
    });
}

php artisan migrate