fix: collab update violating primary key
This commit is contained in:
parent
c1f8c486fd
commit
2f37f621b2
|
|
@ -1,13 +1,13 @@
|
||||||
{
|
{
|
||||||
"db_name": "PostgreSQL",
|
"db_name": "PostgreSQL",
|
||||||
"query": "UPDATE af_collab SET blob = $2, len = $3, partition_key = $4, encrypt = $5, owner_uid = $6 WHERE oid = $1",
|
"query": "UPDATE af_collab SET blob = $3, len = $4, encrypt = $5, owner_uid = $6 WHERE oid = $1 AND partition_key = $2;",
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [],
|
"columns": [],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"Left": [
|
"Left": [
|
||||||
"Text",
|
"Text",
|
||||||
"Bytea",
|
|
||||||
"Int4",
|
"Int4",
|
||||||
|
"Bytea",
|
||||||
"Int4",
|
"Int4",
|
||||||
"Int4",
|
"Int4",
|
||||||
"Int8"
|
"Int8"
|
||||||
|
|
@ -15,5 +15,5 @@
|
||||||
},
|
},
|
||||||
"nullable": []
|
"nullable": []
|
||||||
},
|
},
|
||||||
"hash": "743186a1098002a840613d70da4e4106d481234bbe868de352100a69aaa8c66d"
|
"hash": "d4ce35ee25927744b46eb4c4a4b6b710669f8059b77e107b60993c939112e3a0"
|
||||||
}
|
}
|
||||||
|
|
@ -76,11 +76,11 @@ pub async fn insert_into_af_collab(
|
||||||
if existing_workspace_id == workspace_id {
|
if existing_workspace_id == workspace_id {
|
||||||
sqlx::query!(
|
sqlx::query!(
|
||||||
"UPDATE af_collab \
|
"UPDATE af_collab \
|
||||||
SET blob = $2, len = $3, partition_key = $4, encrypt = $5, owner_uid = $6 WHERE oid = $1",
|
SET blob = $3, len = $4, encrypt = $5, owner_uid = $6 WHERE oid = $1 AND partition_key = $2;",
|
||||||
params.object_id,
|
params.object_id,
|
||||||
|
partition_key,
|
||||||
params.encoded_collab_v1,
|
params.encoded_collab_v1,
|
||||||
params.encoded_collab_v1.len() as i32,
|
params.encoded_collab_v1.len() as i32,
|
||||||
partition_key,
|
|
||||||
encrypt,
|
encrypt,
|
||||||
uid,
|
uid,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ pub async fn upsert_collab_embeddings(
|
||||||
)
|
)
|
||||||
.bind(&r.fragment_id)
|
.bind(&r.fragment_id)
|
||||||
.bind(&r.object_id)
|
.bind(&r.object_id)
|
||||||
.bind(r.collab_type.clone() as i32)
|
.bind(crate::collab::partition_key_from_collab_type(&r.collab_type))
|
||||||
.bind(r.content_type as i32)
|
.bind(r.content_type as i32)
|
||||||
.bind(&r.content)
|
.bind(&r.content)
|
||||||
.bind(r.embedding.clone().map(Vector::from))
|
.bind(r.embedding.clone().map(Vector::from))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue