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

Cast the revisionable ID to a string to overcome issues with Uuids #191

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexhouse
Copy link

We're currently using Revisionable in a project that has Uuids for primary keys. Without this change, the IDs keep getting cast to integers, which don't work

@lloy0076
Copy link

It seems the primary key goes into the revisionable_id column in the revisions table - and this is hard coded to be an integer(11).

I'm not sure the best way to handle primary keys that don't happen to be automatically generated integers or whatever type that is assumed; some concerns including:

  • Downgrading UUIDs to a string and then saving as an integer isn't likely to work properly (imho);
  • The things I'm working with are all unique, primary and they're not convertible to an integer without hashing.

I guess it might be possible to have a somewhat large column (a text/a blob) to store the original primary key {stringified or otherwise encoded] and then hash the that to make the primary key (but this presumes a world where secure hashes don't have collisions).

@joshbrw
Copy link

joshbrw commented Mar 17, 2017

Hi all, I'm going to be maintaining a fork that has complete UUID support at https://github.com/joshbrw/revisionable-uuid.

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

Successfully merging this pull request may close these issues.

3 participants