Replies: 1 comment
-
Since types can already be replaced by configuration, it means that this can already be achieved by replacing the generated types as desired. I'm not quite sure how many SQLBoiler users need this to justify the additional complexity and maintenance work to support this. Perhaps you can send in a PR which I'll review to see how much changes are needed to do this, but I should be honest that I'm not quite sold on baking this into SQLBoiler. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, all of the generated models use the same primitive types to represent Primary keys and foreign keys.
For example:
I find it useful to have type aliases defined for all of the different PK's, helping me to enforce soundness across the codebase wherever I need to pass an ID of some model.
Now I can use these type alises to, in my opinion, enforce better DX and increase soundness
One obvious benefit of this approach is that it's harder to confuse/mixup ID's of different models. I had this happen to me in a real production codebase and that's what lead me to think about introducing type aliases in the first place.
This mistake has nothing to do with SQLboiler, but it has everything to do with humans/developers who use these models and pass ID's around the codebase, eventually making a mistake of mixing up ID's due to complexity of an ambigious codebase or simply due to a plain mistake for whatever reason.
I'm interested to hear your opinion on this approach and thoughts on implementing this as an optional feature to sqlboiler.
Beta Was this translation helpful? Give feedback.
All reactions