【发布时间】:2018-08-14 06:07:42
【问题描述】:
我在我的表格任务中添加了新的列名标题。但是我收到一个错误,该列在该表中不存在。谁能帮我解决这个错误。这是我的代码:
php artisan make:migration add_title_to_tasks_table --table="tasks" 然后加上这段代码
Schema::table('tasks', function (Blueprint $table) {
$table->string('title');
});
到创建的新表文件
【问题讨论】:
-
你在使用迁移吗?检查 - laravel.com/docs/5.6/migrations
-
是的,我使用了 php artisan make:migration add_title_to_tasks_table --table="tasks"
-
您需要更改表并添加新列。然后再次迁移。
-
如何修改表并添加新列