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
This foreign keys is wrong in all the orm tests and in the docs. This is what the docs and orm tests use. The vlib/orm/orm_fk_test.v test does not detect the issue because it doesn't check the fields with fkey to make sure they're correct. Took me forever to figure out why I couldn't get arrays to work with my orm structs.
structFoo {
id int @[primary; sql: serial]
children []Child @[fkey: 'parent_id']
}
structChild {
id int @[primary; sql: serial]
parent_id int
}
This is what it should be
structFoo {
id int @[primary; sql: serial]
children []Child @[fkey: 'id']
// ^ This should be the column with the sql PRIMARY constraint on the Child table
}
structChild {
id int @[primary; sql: serial]
}
Describe the issue
This foreign keys is wrong in all the orm tests and in the docs. This is what the docs and orm tests use. The
vlib/orm/orm_fk_test.v
test does not detect the issue because it doesn't check the fields withfkey
to make sure they're correct. Took me forever to figure out why I couldn't get arrays to work with my orm structs.This is what it should be
Links
https://modules.vlang.io/orm.html
Scroll to the usage section.
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
Huly®: V_0.6-21770
The text was updated successfully, but these errors were encountered: