Skip to content

Support real-world quirky schemas#136

Open
blast-hardcheese wants to merge 5 commits intopavlospt:mainfrom
blast-hardcheese:dstewart/bug/support-quirky-schemas
Open

Support real-world quirky schemas#136
blast-hardcheese wants to merge 5 commits intopavlospt:mainfrom
blast-hardcheese:dstewart/bug/support-quirky-schemas

Conversation

@blast-hardcheese
Copy link

Hello, thank you for the tool! I offer this PR after running into some issues using your tool against our schema; it was fairly easy to modify, even without knowing about the organization of the codebase, what I initially lamented as boilerplate was actually helping guide me exactly to the implementation I wanted -- really, really good work.

Features added:

  • Missing quotes strips load-bearing case sensitivity
    Prisma, when left to its own devices, will name tables and columns without any consideration to ergonomics.

    eg: User has a column enrichmentProfileExecutedAt...
    ...which when unquoted get normalized into user.enrichmentprofileexecutedat...
    which are not found.

  • "Squashed" schema migrations are susceptible to columns being out of order.
    Due to some infrastructure challenges trying to bridge the gap between CNPG and RDS, I was unable to use DDL replication, and had to resort to applying prisma migrations to bootstrap prior to starting replication.

    Unfortunately, this meant that my db1 and db2 had columns that were out of order, leading to t.* being different and the resultant hashes being incorrect.
    After adding a new query to select columns and order them explicitly, now validation checks pass with no problems.

  • Finally, we have a few tables without primary keys. This is regrettable, and I would totally understand if this is a bridge too far, but in order to get logical replication set up I had to ALTER TABLE public."..." REPLICA IDENTITY FULL.

    In the same vein, I added --replica-identity full as a fallback strategy to work around No primary key found

In a perfect world we wouldn't need tools like pgdatadiff, but today I was tremendously grateful for it being available. Thank you!

@blast-hardcheese blast-hardcheese force-pushed the dstewart/bug/support-quirky-schemas branch from 277c41d to 9bd99d1 Compare November 16, 2025 00:34
@pavlospt
Copy link
Owner

Thank you very much for your PR!

/// Accept invalid TLS certificates for the second database
#[arg(long, default_value_t = false, required = false)]
accept_invalid_certs_second_db: bool,
/// Accept invalid TLS certificates for the second database
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong comment?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will fix

@pavlospt pavlospt removed the request for review from nikoshet November 16, 2025 19:21
@pavlospt
Copy link
Owner

@blast-hardcheese also please check formatting and tests

@blast-hardcheese
Copy link
Author

check formatting and tests

I have to admit, it's been a few years since I did Rust, I just spun up a small dev environment with nix and found bacon, but other than that I was going to lean on CI to hone in on what was still necessary to do 😁

If you've got a one-liner to get a tight dev loop, that would be amazing.

@pavlospt
Copy link
Owner

check formatting and tests

I have to admit, it's been a few years since I did Rust, I just spun up a small dev environment with nix and found bacon, but other than that I was going to lean on CI to hone in on what was still necessary to do 😁

If you've got a one-liner to get a tight dev loop, that would be amazing.

I don't have a one-liner or something to setup a dev env

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

Successfully merging this pull request may close these issues.

2 participants