pgsync icon indicating copy to clipboard operation
pgsync copied to clipboard

Inconsistent relationship behavior

Open jpughcs opened this issue 3 years ago • 2 comments

  • Leaf relationship with empty dataset causes sync issues with intermediate relationship data
  • Inconsistent relationship trigger behavior (data change not propagating backwards)

I am only experiencing issues with the former, but I am including the full message here by @lehuuthien2 below:

    i don't know if my problem is same as above, but i also have 3 tier relationship. You treat the middle tier (train_stations) like an pivot table, but it's a normal table and has subdata as the 3rd tier (train_station_floors) (3rd tier may or may not have data).

Problems:

  • If there is no data in the 3rd tier, the 2nd tier will not be indexed even though it has data
  • When the 3rd tier changes (insert, update,...) nothing happens, and I have to update the 2nd tier to sync the data
"table": "railway_assets",
"schema": "public",
"columns": [
    "id",
    "company_id",
    "area_id",
    "name",
    "milepost",
    "image"
],
"children": [
    {
        "table": "train_stations",
        "label": "train_station",
        "schema": "public",
        "columns": [
            "id",
            "railway_asset_id",
            "type",
            "area",
        ],
        "relationship": {
            "variant": "object",
            "type": "one_to_one",
            "foreign_key": {
                "child": [
                    "railway_asset_id"
                ],
                "parent": [
                    "id"
                ]
            }
        },
        "children": [
            {
                "table": "train_station_floors",
                "label": "train_station_floors",
                "relationship": {
                    "variant": "object",
                    "type": "one_to_many",
                    "foreign_key": {
                        "child": [
                            "train_station_id"
                        ],
                        "parent": [
                            "id"
                        ]
                    }
                }
            }
        ]
    }
]

Originally posted by @lehuuthien2 in https://github.com/toluaina/pgsync/issues/199#issuecomment-1059002314

jpughcs avatar Oct 28 '22 15:10 jpughcs

Hi, Sorry for the delay. This has been addressed in the main branch. Can you try this out, please?

toluaina avatar Jan 30 '23 17:01 toluaina

This appears to be resolved

jpughcs avatar Jan 30 '23 19:01 jpughcs