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

Relax foreign key constraints on Audit logs and reactions #72

Open
theKAKAN opened this issue May 16, 2023 · 0 comments
Open

Relax foreign key constraints on Audit logs and reactions #72

theKAKAN opened this issue May 16, 2023 · 0 comments

Comments

@theKAKAN
Copy link

The problem happens when a user has added some reaction, or has their ID in the audit log, but have left the server. In that case, we get a bunch of errors of foreign key violations because the user doesn't exist in the users table. I'm not sure if the better way is to remove foreign key, or just create a dummy "Unknown user" in the users table...

psycopg2.errors.ForeignKeyViolation: insert or update on table "audit_log" violates foreign key constraint "audit_log_int_user_id_fkey"
DETAIL:  Key (int_user_id)=([REDACTED]) is not present in table "users".

sqlalchemy.exc.IntegrityError: (psycopg2.errors.ForeignKeyViolation) insert or update on table "reactions" violates foreign key constraint "reactions_int_user_id_fkey"
DETAIL:  Key (int_user_id)=([REDACTED]) is not present in table "users".
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