d | r | b | m | property | type | ref
example | |
| |
| | | Language | |
| | | | name@en | text |
| | | | countries[] | backref | Country
| |
| | | Country | |
| | | | name@en | text |
| | | | languages | array | CountryLanguage
| | | | languages[] | ref | Language
| |
| | | CountryLanguage | |
| | | | country | ref | Country
| | | | language | ref | Language
By default for many-to-many relations, under the hood a .../:table intermediate table is used for internal backends, to create many-to-many relation.
For external backends, such intermediate tables must be specified explicitly like in example above.
In the example language array CountryLanguage specifies the explicit intermediate table. ref column can also specify which columns should be used to associate two tables.
Following examples below, are identical:
languages array CountryLanguage
languages array CountryLanguage[country, language]
In [ ... ] brackets, we specify properties from CountryLanguage model. Order of columns in [], first always goes column from ref side, and the second from backref side.
By default for many-to-many relations, under the hood a
.../:table
intermediate table is used for internal backends, to create many-to-many relation.For external backends, such intermediate tables must be specified explicitly like in example above.
In the example
language array CountryLanguage
specifies the explicit intermediate table.ref
column can also specify which columns should be used to associate two tables.Following examples below, are identical:
In
[
...]
brackets, we specify properties fromCountryLanguage
model. Order of columns in[]
, first always goes column fromref
side, and the second frombackref
side.Related