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

When your auditor table uses UUIDs as Primary Key #47

Open
colinbruce opened this issue Aug 16, 2023 · 1 comment
Open

When your auditor table uses UUIDs as Primary Key #47

colinbruce opened this issue Aug 16, 2023 · 1 comment

Comments

@colinbruce
Copy link

I'm just recording this in case it helps someone else or, after reviewing, the team tell me a better way! 😄

We use GUIDs as primary key for all tables so my Auditor record primary key starts with:

035d675a-0aa8-...

When audit records are created, the auditor_id is set as:

id status session_id auditor_id
1 1 4 35
1 1 3 35
1 1 2 35
1 1 1 35

I rolled back the migration and changed the script to

t.references :auditor, null: false, type: :uuid

After re-migrating, the system successfully records my Auditor account with no, so far, further errors!

@bpurinton
Copy link

Bump. Thank you. That one had me stumped for awhile. Might be worth an add to the README.

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

2 participants