long2ice / meilisync

Realtime sync data from MySQL/PostgreSQL/MongoDB to Meilisearch
https://github.com/long2ice/meilisync
Apache License 2.0
247 stars 37 forks source link

Fix: Delete Failures in Postgres Handled #35

Closed GnosisAI closed 9 months ago

GnosisAI commented 9 months ago

This pull request fixes an issue in our Postgres consumer's handling of delete events, which was reported in issue #22.

In delete events, Postgres does not provide columnnames or columnvalues but instead only sends the id of the deleted row along with all column values. Our consumer now correctly captures the id from oldkeys to construct the necessary data for delete events.

Changes:

Here's an example of a delete event change object that this fix accommodates:


{
  "kind": "delete",
  "schema": "public",
  "table": "products",
  "oldkeys": {
    "keynames": ["id"],
    "keytypes": ["integer"],
    "keyvalues": [25]
  }
}
long2ice commented 9 months ago

Thanks!