sunitparekh / data-anonymization

Want to use production data for testing, data-anonymization can help you.
MIT License
459 stars 92 forks source link

Foreign key columns not discovered via Rails #81

Closed josh-levinson closed 1 year ago

josh-levinson commented 1 year ago

Given a schema entry like this:

add_foreign_key "activity_entries", "users"

So per Rails, activity_entries has a user_id table which coincides with the id table in users

But with PostgreSQL I am seeing something like this:

2022-11-29 20:52:02.405 UTC [370] ERROR:  insert or update on table "activity_entries" violates foreign key constraint "fk_rails_abc12345"
2022-11-29 20:52:02.405 UTC [370] DETAIL:  Key (user_id)=(12345) is not present in table "users".

But it SHOULD be looking for an id column in users, not a user_id column. I believe this is the Rails convention.

sunitparekh commented 1 year ago

Please send a pull request with your recommendations and will do it.

On Wed, Nov 30, 2022 at 2:35 AM Josh Levinson @.***> wrote:

Given a schema entry like this:

add_foreign_key "activity_entries", "users"

So per Rails, activity_entries has a user_id table which coincides with the id table in users

But with PostgreSQL I am seeing something like this:

2022-11-29 20:52:02.405 UTC [370] ERROR: insert or update on table "activity_entries" violates foreign key constraint "fk_rails_abc12345" 2022-11-29 20:52:02.405 UTC [370] DETAIL: Key (user_id)=(12345) is not present in table "users".

But it SHOULD be looking for an id column in users, not a user_id column. I believe this is the Rails convention.

— Reply to this email directly, view it on GitHub https://github.com/sunitparekh/data-anonymization/issues/81, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABLNOSG5UV3VYF6HP23DEDWKZVZ5ANCNFSM6AAAAAASO5KW44 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- thanks & regards, Sunit Parekh +91 99237 00662 @.***

josh-levinson commented 1 year ago

This was my mistake, i think source/dest can't be the same w/whitelist strategy so need to rethink how this works, my apologies for the issue.