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

Anonymization fails midway if two tables have a circular referential integrity #7

Closed
satyamag opened this issue Sep 7, 2012 · 3 comments
Assignees
Labels

Comments

@satyamag
Copy link
Collaborator

satyamag commented Sep 7, 2012

Even though it is poor schema design there have been real world examples where it does happen.

@ghost ghost assigned satyamag Sep 7, 2012
@satyamag
Copy link
Collaborator Author

satyamag commented Sep 7, 2012

One workaround is to drop referential integrity checks. In Mysql (similar technique exists for postgres) this can be done by executing the following on the db

SET FOREIGN_KEY_CHECKS = 0

IMPORTANT: Ensure you set it to the original value once anonymization is complete.

@sunitparekh
Copy link
Owner

closing the issue, since we are not working actively on this and there is a work around.

@wasabigeek
Copy link

@sunitparekh it seems the corresponding Postgres options are:

  • run ALTER TABLE on every table or defer each foreign key individually
  • execute 'SET session_replication_role=replica;' for the session

The latter is a lot easier, but I need to set it within the actual session. Is there a way to include commands in the connection?

Also, what is DisableReferentialIntegrityDatabase? Was this an option you were thinking of adding?

class DisableReferentialIntegrityDatabase < ActiveRecord::Base

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

No branches or pull requests

3 participants