Ryan Roline
09/21/2022, 5:36 PMven v
09/21/2022, 5:38 PMRyan Roline
09/21/2022, 5:41 PM"crossFileRelations": true
in the prisma-util.config.json
file that is generated when you run npx prisma-util init
Ryan Roline
09/21/2022, 5:41 PMven v
09/21/2022, 5:42 PMRyan Roline
09/21/2022, 5:47 PMRyan Roline
09/21/2022, 5:48 PMven v
09/21/2022, 9:18 PMRyan Roline
09/21/2022, 9:31 PMRyan Roline
09/21/2022, 9:32 PMVladi Stevanovic
David Hancu
09/22/2022, 8:40 AMDavid Hancu
09/22/2022, 8:49 AMschema.table1
and the column test of Table2 from test.table2
uses a relation for Table1, you can remap the relation using the configuration file.
Initial data:
schema.table1
model Table1 {
id Int @id @default(autoincrement())
tableName String
}
test.table2
model Table2 {
id Int @id @default(autoincrement())
tableId Int
table Table1 @relation(fields: [tableId], references: [id])
}
You can add the following lines in your configuration file:
"relations": {
"test.table2:Table2.table": "schema.table1:Table1"
}
If you have an IDE extension that complains about Table1 not being a model in your test.table2
file, you can create a "polyfill" or an empty Table2 model and it will automatically get replaced.
Hope I helped!David Hancu
09/22/2022, 8:50 AM