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

UUID's as Primary Keys #480

Open
crimson-knight opened this issue May 20, 2023 · 0 comments
Open

UUID's as Primary Keys #480

crimson-knight opened this issue May 20, 2023 · 0 comments
Labels

Comments

@crimson-knight
Copy link
Member

When you have a model that you want to use a UUID as the primary key with the column id you'll get an error that an overload does not exist:

Error: expected argument #2 to 'Granite::Type.from_rs' to be (Array(Bool) | Nil).class, (Array(Float32) | Nil).class, (Array(Float64) | Nil).class, (Array(Int16) | Nil).class, (Array(Int32) | Nil).class, (Array(Int64) | Nil).class, (Array(Int8) | Nil).class, (Array(String) | Nil).class, (Array(UInt16) | Nil).class, (Array(UInt32) | Nil).class, (Array(UInt64) | Nil).class, (Array(UInt8) | Nil).class, (Bool | Nil).class, (Float32 | Nil).class, (Float64 | Nil).class, (Int16 | Nil).class, (Int32 | Nil).class, (Int64 | Nil).class, (Int8 | Nil).class, (String | Nil).class, (Time | Nil).class, (UInt16 | Nil).class, (UInt32 | Nil).class, (UInt64 | Nil).class, (UInt8 | Nil).class, Array(Bool).class, Array(Float32).class, Array(Float64).class, Array(Int16).class, Array(Int32).class, Array(Int64).class, Array(Int8).class, Array(String).class, Array(UInt16).class, Array(UInt32).class, Array(UInt64).class, Array(UInt8).class, Bool.class, Float32.class, Float64.class, Int16.class, Int32.class, Int64.class, Int8.class, String.class, Time.class, UInt16.class, UInt32.class, UInt64.class or UInt8.class, not UUID.class

Note the not UUID.class at the end.

Following all of the documentation and trying:

column id : UUID, primary: true
# OR
column uuid : UUID, primary: true

Both produce the same error. So somewhere along the line we lost support for UUID's as primary keys.

  1. Let's re-enable this feature
  2. Let's add test coverage to ensure UUID's as primary keys will be stable going forward (supported by MySQL, PG and SQLite3)
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

1 participant