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

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

WBOY
Release: 2016-06-06 20:29:41
Original
966 people have browsed it

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

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

回复内容:

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

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

假设是users表

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

加votes字段

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

最后

<code>php artisan migrate</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template