When Sqlboiler generates models, it has missed composite unique keys #1352
-
Currently, when I have a table with 4 columns such as ABC(x, y, h, z), I specified constrains as the following
After running migration and re-generating this model by SQL boiler command, I discovered that it didn't generate the composite unique keys (h,z) information at this model. It only has the information of the unique key y. I am afraid that it won't work properly if we use the Upsert function in the model to insert/update data in database. Is there anyone knows the root cause? and how can I fix it? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
SQLBoiler does not need to know about the unique keys for the upsert method to work since the query will be passed on the the DB. Or am I missing something? |
Beta Was this translation helpful? Give feedback.
I see this is specific to MySQL upserts. I was thinking of the Postgres upsert method.
Unfortunately, SQLBoiler does not have good support for composite keys so supporting this would be a big change.
If you want to take a look and send in a PR, that would be great. It would likely also make it easier to support composite foreign keys.