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

Support String primary key #1000

Merged
merged 6 commits into from
Mar 11, 2024
Merged

Conversation

albertorestifo
Copy link
Contributor

Resumes the work started in #927

This PR adds support for a String primary key, with a required user-specified generator Proc.

Closes #21


Pending from the previous review:

  • Improve compile error when the proc doesn't return a String
  • Ensure correct functioning with autogenerated string ID

src/avram/model.cr Outdated Show resolved Hide resolved
src/avram/model.cr Outdated Show resolved Hide resolved
Copy link
Member

@jwoertink jwoertink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, sorry for the late review. I'm just getting back to this. Looked at it with some fresh eyes, and it looks great. I have an idea for ways you can set the primary key from the DB, but I think for now this is a great start. I don't see anything left to add, so I think I'm ready to merge if you are!

skip_default_columns

table do
primary_key id : String = Random::Secure.hex
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@albertorestifo
Copy link
Contributor Author

@jwoertink sure! Let's start by merging this and we can iterate on it

@jwoertink jwoertink merged commit a88fdbc into luckyframework:main Mar 11, 2024
9 checks passed
@robacarp
Copy link
Contributor

Amazing!

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.

Feature request: Add support for prefixed KSUID primary_key_type
3 participants