After executing
php artisan migrate in laravel, data is also inserted into the database
But now I want to modify the target structure. For example, I want to add a default value of 0 to the title field. If withdrawn, the data will be gone. How can I ensure that the database data is still there? Now you can modify the data table
ps (I tried to create a migration if I added a field, but it didn’t work when I modified the field information)Reply content:
in laravel, data is also inserted into the databaseBut now I want to modify the target structure. For example, I want to add a default value of 0 to the
title field. If withdrawn, the data will be gone. How can I ensure that the database data is still there? Now you can modify the data table
https://laravel-china.org/doc...
<code>Schema::table('users', function ($table) { $table->string('title')->default('1')->change(); });</code>Copy after login