- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 Laravel 应用程序中工作,并通过 user_id
列将 users
表与 posts
表相关联。 posts
表中已有 user_id
列。但是当我运行 php artisan db:seed
命令时,出现错误:
`SQLSTATE[42S22]: Column not found: 1054 Unknown column 'user_id ' in 'field list'
出现以下错误:
Illuminate\Database\QueryException
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'user_id ' in 'field list' (SQL: insert into `posts` (`user_id `, `title`, `post_image`, `content`, `user_id`, `updated_at`, `created_at`) values (11, Perferendis dolorem eum ex nesciunt., https://lorempixel.com/900/300/?54025, Unde voluptatibus praesentium unde et illum qui quo. Cupiditate pariatur aperiam fugiat perspiciatis. In atque corrupti eius ipsam saepe blanditiis minima., 1, 2020-06-28 08:54:02, 2020-06-28 08:54:02))
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
667| // If an exception occurs when attempting to run a query, we'll format the error
668| // message to include the bindings with SQL, which will make this exception a
669| // lot more helpful to the developer instead of just the database's errors.
670| catch (Exception $e) {
> 671| throw new QueryException(
672| $query, $this->prepareBindings($bindings), $e
673| );
674| }
675|
• A column was not found: You might have forgotten to run your migrations. You can run your migrations using `php artisan migrate`.
https://laravel.com/docs/master/migrations#running-migrations
+13 vendor frames
14 database/seeds/DatabaseSeeder.php:21
Illuminate\Database\Eloquent\Relations\HasOneOrMany::save()
+1 vendor frames
16 database/seeds/DatabaseSeeder.php:22
Illuminate\Support\Collection::each()
最佳答案
关于php - 在 Illuminate\Database\QueryException 处找不到列错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62620900/
我在执行此代码时遇到问题org.hibernate.QueryException:无法解析属性 def show = { def results = PM.createCriteria().l
我在尝试将条目插入包含地理位置数据的表时遇到问题。事实上,该表仅包含一个地理位置列,一种 Point 数据类型。我正在使用 Java JPA 和 MariaDB。最奇怪的部分是,代码曾经可以工作,但应
我正在使用 FluentNHibernate 和 Linq To Nhibernate,以及这些实体(仅相关部分): public class Player : BaseEntity { pr
我使用 NHiberNate 编写了联合查询,但收到 NHibernate.QueryException:not an Association: Id 这就是 NHibernate 库的样子 Tick
我有一个正在尝试执行的 HQL 查询,但我不断收到 QueryException。 我的查询是 SELECT a FROM (SELECT MAX(m.version) maxVersionOp, m
使用oracle DB,我们创建了一个没有PK的表(我们知道这不是一个好的做法,但我们仍然希望有人可以帮助我们),我们需要使用约束作为替代方案。我们能够将数据插入数据库,不幸的是我们无法检索,因为它会
我关闭了 EclipseLink 缓存,因为我正在外部修改数据,并且不希望遇到手动刷新所有内容的麻烦。显然,这是在 persistence.xml 中关闭缓存以避免对象身份问题的正确方法:
使用 JPA 2.0、Java EE 5、Weblogic 10.3 (11g)、JDK 6、EclipseLink。 当我尝试运行它时: CriteriaQuery _criteriaquery
我已经在本地主机中创建了数据库 Illuminate\Database\QueryException : SQLSTATE[HY000] [1045] Access denied for user
我想通过限制在 Hibernate 中的条件添加订单。 我有两个表 Event 和 MainEvent 与一对多的关系(一个 MainEvent 有很多事件)。 final Criteria
我正在尝试使用 Hibernate 连接到数据库。当前表格具有以下布局: (field1, field2, field3, optional1, optional2...) 其中 field1、fie
这是此错误的另一种情况: 21:22:15,881 ERROR [SessionFactoryImpl] Error in named query: ch.software.gvs.TroubleNo
这是我的查询 SQL_QUERY="SELECT review.comment FROM ReviewDO review WHERE title='"+titleName+"'"; 我试图通过使用标题
我有一个 org.hibernate.QueryException,我很难理解为什么。 hibernate 未解析的属性 langue_id 在我的实体 Conditionnement 中定义。 堆栈
我想在laravel中注册时遇到问题。完成注册表后,我看到此错误消息: QueryException in Connection.php line 770:SQLSTATE[HY000] [1045]
这是我尝试处理重复条目的模型代码: $userData = ['name' => $name, 'email' => $email, 'password' => $password]; publ
我在 Laravel 应用程序中工作,并通过 user_id 列将 users 表与 posts 表相关联。 posts 表中已有 user_id 列。但是当我运行 php artisan db:se
我正面临一种奇怪的问题,不知道该往哪个方向解决;-) 我目前正在开发一个 Web 应用程序,用于使用 Hibernate 存储员工。 插入、删除、搜索;一切正常。 但! 每个员工都有一个由字符串列表表
这是我第一次使用JPA。我用 Java 和 JPA 编写代码。我的代码如下。 String queryStr = "SELECT m.title, b.isbn, b.authors"; q
我正在尝试从当前用户获取特定租金的列表。 Controller 中的代码: def index() { if (isLoggedIn()) { String username = getPri
我是一名优秀的程序员,十分优秀!