我已经阅读了很多关于这个主题的文章,但没有找到正确的答案。当我编写任何命令php artisan migrate
返回结果时:
[Illuminate'Database'QueryException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'adtmart1.shop_categories' doesn't exist (SQL: select * f
rom `shop_categories`)
[PDOException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'adtmart1.shop_categories' doesn't exist
我想在本地Web服务器上移动使用Laravel制作的成品网站。我使用Web服务器 - opensever。有php版本 - 5.5,Mysql - 5.5。我为控制台编写的所有命令都打开了。在回复时,请注意我是该领域的新手
您使用Schema::table
来更改现有表,您正在寻找用于创建新表Schema::create
。
更改迁移以使用Schema::create
,运行迁移时不会遇到任何问题:
Schema::create('name_of_table', function(Blueprint $table) {
{
$table->increments("id",true);
$table->string("username")->nullable()->default(null);
$table->string("password")->nullable()->default(null);
$table->string("email")->nullable()->default(null);
$table->timestamps();
});
我当然使用过虚拟列,你会使用自己的列。
有关该问题的更多信息,请单击此处。
首先,您需要发布导致错误的迁移代码。为此,请尝试逐个运行迁移。从文件夹中删除/database/migrations
所有迁移,然后将第一个迁移(按创建日期进行的第一个迁移)添加回/database/migrations
。然后运行php artisan migrate
.如果迁移成功,请执行 secons 迁移等的所有步骤。当您看到错误时,您将知道这是迁移导致的。请在此处发布,以便我们提供帮助。