You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using v4.18.0 (previously tested on 4.16 too)
Using the postgres driver (but not sure it's postgres specific)
given the schema generated by
CREATETABLEA (
id serialPRIMARY KEY,
content textNOT NULL
);
CREATETABLEb (
id serialPRIMARY KEY,
a_id INTNOT NULLREFERENCES A(id) ONDELETE
CASCADE,
content textNOT NULL
);
CREATEUNIQUE INDEXunique_a_idON b(a_id)
WHERE
content ='test';
The generated relationship on A is
...// aR is where relationships are stored.typeaRstruct {
B*B`boil:"B" json:"B" toml:"B" yaml:"B"`
}
...
ie it created a 1:1 relationship, but it should be a 1:many relationship as there could be multiple B linked to the same A, as long as at most one of them has the test content.
if I remove the unique constraint I get the correct relationship
...// aR is where relationships are stored.typeaRstruct {
BSBSlice`boil:"BS" json:"BS" toml:"BS" yaml:"BS"`
}
...
It seems like the issue if with the relationship logic trying to handle the unique constraint and convert the relationship from 1:many to 1:1 but not accounting for the conditional part of it.
The text was updated successfully, but these errors were encountered:
Using v4.18.0 (previously tested on 4.16 too)
Using the postgres driver (but not sure it's postgres specific)
given the schema generated by
The generated relationship on A is
ie it created a 1:1 relationship, but it should be a 1:many relationship as there could be multiple B linked to the same A, as long as at most one of them has the
test
content.if I remove the unique constraint I get the correct relationship
It seems like the issue if with the relationship logic trying to handle the unique constraint and convert the relationship from 1:many to 1:1 but not accounting for the conditional part of it.
The text was updated successfully, but these errors were encountered: