I have Uploads
table.
Uploads
has many-to-many
relation with Parties
table.
the junction table is Uploads_Parties
, it contains: upload_id
& party_id
as fields.
how can i make postgraphile to consider these relation in the schema generation ?
attempts:
Uploads.upload_id -> Uploads_Parties.upload_id
, but then postgraphile throw an error.Server init code
const SmartTagsPlugin = makePgSmartTagsFromFilePlugin(
resolve(__dirname, '../../postgraphile.tags.jsonc'),
);
...
appendPlugins: [
SmartTagsPlugin,
PgManyToManyPlugin]
...
tags.jsonc
"config": {
"class": {
"upload_service.upload": {
"tags": {
"foreignKey": [
"(id) references upload_service.uploads_parties (upload_id)|@fieldName uploadDataSet"
]
}
}
}
}
the solution was the tags.jsonc
, only pointing the fk
the other way around:
uploads.upload_id <- uploads_parties.upload_id
.
"config": {
"class": {
"upload_service.uploads_parties": {
"tags": {
"foreignKey": [
"(upload_id) references upload_service.uploads (id)|@fieldName fileUpload"
]
}
}
}
}
i also have these plugins:
pgSimplifyInflector,
postgraphilePluginConnectionFilter,
pgOrderByRelatedPlugin,
pgAggregatesPlugin,