Merge pull request #666 from AppFlowy-IO/workspace-settings-posteffects

chore: disabling indexing on workspace prunes collab embeddings
This commit is contained in:
Bartosz Sypytkowski 2024-06-28 11:01:20 +02:00 committed by GitHub
commit 01f974beee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,14 @@
{
"db_name": "PostgreSQL",
"query": "DELETE FROM af_collab_embeddings e WHERE e.oid in (\n SELECT c.oid\n FROM af_collab c\n WHERE c.partition_key = e.partition_key\n AND c.oid = e.oid\n AND c.workspace_id = $1)",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Uuid"
]
},
"nullable": []
},
"hash": "e5d51236e5c96ac91c70cd1d1b603f63e80e4f05a45a0790dd0bde892429ef14"
}

View File

@ -814,6 +814,20 @@ pub async fn upsert_workspace_settings(
.execute(tx.deref_mut())
.await?;
if settings.disable_search_indexing {
sqlx::query!(
r#"DELETE FROM af_collab_embeddings e WHERE e.oid in (
SELECT c.oid
FROM af_collab c
WHERE c.partition_key = e.partition_key
AND c.oid = e.oid
AND c.workspace_id = $1)"#,
workspace_id
)
.execute(tx.deref_mut())
.await?;
}
Ok(())
}