Home >Backend Development >PHP Tutorial >lavarel 怎么给某张已经生成的表增加字段

lavarel 怎么给某张已经生成的表增加字段

WBOY
WBOYOriginal
2016-06-06 20:29:41965browse

lavarel 怎么给某张已经生成的表增加字段

需要全部reset然后修改migrations文件再migrate吗?

回复内容:

lavarel 怎么给某张已经生成的表增加字段

需要全部reset然后修改migrations文件再migrate吗?

假设是users表

<code>php artisan make:migration add_votes_to_users_table --table=users
</code>

加votes字段

<code>Schema::table('users', function ($table) {
    $table->bigInteger('votes');
});</code>

最后

<code>php artisan migrate</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn