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 using custom primary key #9

Closed
wants to merge 3 commits into from

Conversation

jensjeflensje
Copy link

@jensjeflensje jensjeflensje commented Aug 29, 2023

As raised in #8 (by me :p), using a custom primary key is not supported. I've added this functionality, as well as some other changes:

  • Separate StormModel into StormModel and BaseStormModel, with StormModel still containing the same things as before. BaseStormModel just doesn't have the primary key (id field)
  • Made methods for obtaining the primary key field and value, as this isn't always the id field anymore
  • Changed all relevant references of the getId method to getPk

Other changes:

  • A where clause is now also using the fields toSql method to convert the value into a usable format for querying. This worked for most datatypes before my PR, but not UUID
  • I've added the memory file to the .gitignore as it's a temporary database for tests (right?)
  • The save method doesn't return anything anymore, as the returned value was inconsistent in nature before (sometimes the generated key, sometimes the changed rows). I personally don't think it's needed

@Mindgamesnl
Copy link
Owner

Please see the comment on the accompanying issue for details; #8 (comment).

@Mindgamesnl Mindgamesnl closed this Sep 1, 2023
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.

2 participants