Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema is not refreshed when child is inserted, but FK doesnt exist #574

Open
rutkowskib opened this issue Aug 27, 2024 · 0 comments
Open

Comments

@rutkowskib
Copy link

rutkowskib commented Aug 27, 2024

PGSync version:
3.2.0

Postgres version:
14.12

Elasticsearch/OpenSearch version:
8.15.0

Redis version:
6.2

Python version:
3.10

Problem Description:
Hi,

I have two tables that are parent and child.
They are connected manually by defining foreign_key instead of having FK in SQL.
pgsync schema looks like this:

{
    "label": "books",
    "table": "book",
    "columns": ["isbn", "title", "description"],
    "children": [
        {
            "label": "reviews",
            "table": "review",
            "columns": ["id", "text"],
            "relationship": {
                "variant": "object",
                "type": "one_to_many",
                "foreign_key": {
                    "child": [
                        "book_isbn"
                    ],
                    "parent": [
                        "isbn"
                    ]
                }
            }
        }
    ]
}

We have noticed that whenever child is inserted parent document is not updated.
In our prod environment we cant add FK because tables are in different schemas and we dont want to create dependencies between them.

I have managed to write failing test, but I lack knowledge how to fix that issue. If you could point me in correct direction, I might be able to fix that. I am going to raise merge request connected to that issue that contains failing test.

Thanks for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant