【发布时间】:2014-04-17 00:42:03
【问题描述】:
在发布之前我做了很多研究。
尝试使用 Laravel eloquent ORM 将记录插入 PostgreSQL 时出现以下错误。
这是错误:
Illuminate \ Database \ QueryException
SQLSTATE[42703]: Undefined column:
7 ERROR: column "id" does not exist LINE 1: ...ed_at", "created_at")
values ($1, $2, $3, $4)
returning "id" ^ (SQL: insert into "fb_post_like_counts" ("post_id", "count", "updated_at", "created_at") values (293843523498_10152007721598499, 0, 2014-03-12 16:56:24, 2014-03-12 16:56:24) returning "id")
这是数据库表创建模式:
Schema::create('fb_post_shares_counts', function($table)
{
//
$table->string('post_id');
$table->string('count')->default(0);
// created_at updated_at deleted_at
$table->timestamps();
$table->softDeletes();
// set composite keys
$table->primary(array('post_id', 'updated_at'));
});
这是我要执行的代码:
// SAVE POST SHARES
$post_share_count = new FbPostShareCount;
$post_share_count->post_id = $response['id'];
$post_share_count->count = $fql_post['share_count'];
$post_share_count->save();
我创建了一个模型类 FbPostShareCount 扩展了 Eloquent。
我知道 laravel 不支持复杂的键但是我使用 MySQL 的时候没有出现这个问题
【问题讨论】:
-
等待反馈。解决了吗?
标签: php postgresql laravel laravel-4 eloquent