Home > Backend Development > PHP Tutorial > If you modify the database table definition file in Laravel, how do you modify it to make it take effect?

If you modify the database table definition file in Laravel, how do you modify it to make it take effect?

WBOY
Release: 2016-07-06 13:52:48
Original
1075 people have browsed it

For example, there is such a file 2016_06_21_200145_create_notes_table.php. After modifying the content, if I manually rename and modify the number 200145 and then execute php artisan migrate, it will take effect, but I don’t know if this is standardized.

Reply content:

For example, there is such a file 2016_06_21_200145_create_notes_table.php. After modifying the content, if I manually rename and modify the number 200145 and then execute php artisan migrate, it will take effect, but I don’t know if this is standardized.

Every time php artisan migrate is executed, the migrate file will be recorded in the migrations table in the database. Changing the file name is equivalent to re-creating a file.

If you want to modify the table after creating it, you can change the table structure through the 2016_06_21_222145_update_notes_table.php file.
To modify the table structure multiple times, you need to add the preceding year, month and day after the table (i.e. 2016_06_21_232145_update_notes_table20160621.php). Change the table structure multiple times.

It should be noted that the modified date and random number must be in order.

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