Skip to content

When your auditor table uses UUIDs as Primary Key #47

@colinbruce

Description

@colinbruce

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions