Closed NickyMateev closed 5 years ago
I have 3 join tables in the whole schema (approvers, commenters, idlers). Without them everything is okay - the moment I introduce at least one of them, I start getting problems with redeclared blocks.
This happens when inferred names collide which is possible when you have bad names, pluralization fails, or you have many similar relationships.
See Aliases in the Readme to be able to rename the relationships. Typically this isn't only the tests that will fail though. So maybe this is something Aliases won't fix. Please take a look and reopen if there's a problem after applying Aliases.
@aarondl I was just experimenting with the aliases functionality.
I got it working with the following alias definitions in my sqlboiler.toml
:
[aliases.tables.approvers.relationships.approvers_user_id_fkey]
local = "ApprovedPullRequests"
foreign = "Approvers"
[aliases.tables.commenters.relationships.commenters_user_id_fkey]
local = "CommentedPullRequests"
foreign = "Commenters"
[aliases.tables.idlers.relationships.idlers_user_id_fkey]
local = "IdledPullRequests"
foreign = "Idlers"
Since my users
table had multiple relationships with the pull_requests
table sqlboiler generated the same PullRequest
structs for each type of relationship which resulted in conflicts.
The aliases documentation helped me with fixing the issue, but I had a hard time understanding some of the concepts, so I tried to improve on the documentation with this PR: #468
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 v3.2.0
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)
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)Please provide a relevant database schema so we can replicate your issue (Provided you are comfortable sharing this)
Further information. What did you do, what did you expect?
After running the
sqlboiler psql
I went on to test withgo test ./models
to see if everything is ok, but I got the following error:I would really appreciate it if you had any ideas what could be happening!