()
| 6 | // can be used to generate schema for this benchmark |
| 7 | // generated schema needs `format` pass to be valid |
| 8 | async function main() { |
| 9 | const models = Array.from({ length: MODELS_COUNT }).map((v, i) => `Model${i}`) |
| 10 | const modelsStr = models |
| 11 | .map((modelName, currentModelIdx) => { |
| 12 | const fields = ['id Int @id'] |
| 13 | for (let i = 0; i < fieldsCount; i++) { |
| 14 | const modelIdx = (currentModelIdx + i + 1) % MODELS_COUNT |
| 15 | fields.push(`model${modelIdx}Id Int`) |
| 16 | fields.push(`model${modelIdx} Model${modelIdx} @relation(fields: [model${modelIdx}Id], references: [id])`) |
| 17 | } |
| 18 | |
| 19 | return ` |
| 20 | model ${modelName} { |
| 21 | ${fields.join('\n')} |
| 22 | } |
| 23 | ` |
| 24 | }) |
| 25 | .join('\n') |
| 26 | |
| 27 | const str = ` |
| 28 | generator client { |
| 29 | provider = "prisma-client-js" |
| 30 | } |
| 31 | |
| 32 | datasource db { |
| 33 | provider = "postgresql" |
| 34 | } |
| 35 | |
| 36 | ${modelsStr} |
| 37 | ` |
| 38 | |
| 39 | await fs.writeFile('schema.prisma', str) |
| 40 | } |
| 41 | |
| 42 | void main() |
no test coverage detected