部署后在 Heroku 中插入用户不工作
after deployment In Heroku Insert user not working
我用 Laravel 8 制作了一个普通的 CRUD 应用程序,它在我的本地机器上运行良好,但是当我将它部署到 Heroku 上并尝试插入一个用户时,它给我这个错误:
Illuminate\Database\QueryException:
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "Utilisateurs" does not exist
LINE 1: select count(*) as aggregate from "Utilisateurs" where "emai...
^ (SQL: select count(*) as aggregate from
"Utilisateurs" where "email" = heguwenepe@mailinator.com)
其他一切(编辑、更新、删除)似乎工作正常
出于某种原因,它似乎也在我的控制器中突出显示了这条线:
我试过的:
重新运行迁移
将“”替换为“”
验证规则:
"email" => "required|regex:/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix|unique:Utilisateurs"
您应该完全按照定义使用 table 名称:utilisateurs
而不是 Utilisateurs
。大小写很重要,因为标识符在生成的 SQL 语句中用双引号引起来。
始终假设案例很重要,这样您以后遇到的问题就会更少。
我用 Laravel 8 制作了一个普通的 CRUD 应用程序,它在我的本地机器上运行良好,但是当我将它部署到 Heroku 上并尝试插入一个用户时,它给我这个错误:
Illuminate\Database\QueryException:
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "Utilisateurs" does not exist
LINE 1: select count(*) as aggregate from "Utilisateurs" where "emai...
^ (SQL: select count(*) as aggregate from
"Utilisateurs" where "email" = heguwenepe@mailinator.com)
其他一切(编辑、更新、删除)似乎工作正常
出于某种原因,它似乎也在我的控制器中突出显示了这条线:
我试过的:
重新运行迁移
将“”替换为“”
验证规则:
"email" => "required|regex:/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix|unique:Utilisateurs"
您应该完全按照定义使用 table 名称:utilisateurs
而不是 Utilisateurs
。大小写很重要,因为标识符在生成的 SQL 语句中用双引号引起来。
始终假设案例很重要,这样您以后遇到的问题就会更少。