sqlboiler
sqlboiler copied to clipboard
Generated test code uses `queries.Assign` instead of a simple `=` (assign operator)
If you're having a generation problem, please answer these questions before submitting your issue. Thanks!
What version of SQLBoiler are you using (sqlboiler --version)?
SQLBoiler v4.11.0
What is your database and version (e.g. Postgresql 10)
PostgreSQL 13.6 (Debian 13.6-1.pgdg110+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
If this happened at generation time, what was the full SQLBoiler command you used to generate your models? (if not applicable leave blank)
If this happened at runtime what code produced the issue? (if not applicable, leave blank)
Generated tests for one of our models. The model has an ID of enum (string). This enum is also the ID of another model.
For example:
model Balance:
ID (uuid)
Value (int)
Type (BalanceTypes)
model BalanceTypes:
ID (enum.Code)
Description (string)
enum Code:
"a",
"b",
"c"
The code generates a test that created both local and foreign values, inserts the foreign to the DB and tries to use queries.Assign to set the value of local.Type to be the same as the foreign's.
The function Assign doesn't support primitive types (such as string and string, caused by both being enums)
So it panics.
What is the output of the command above with the -d flag added to it? (Provided you are comfortable sharing this, it contains a blueprint of your schema)
See example above
Please provide a relevant database schema, so we can replicate your issue (Provided you are comfortable sharing this)
See example above
Further information. What did you do, what did you expect?
I expect the generator for the code to detect enums and treat them as strings. That way it will not use queries.Assign and will use just a simple = instead