()
| 3 | import path from 'path' |
| 4 | |
| 5 | async function main() { |
| 6 | const packageJsonVersion = '0.0.0' |
| 7 | const enginesVersion = 'prismaEngineVersionHash' |
| 8 | const command = 'something-test' |
| 9 | |
| 10 | try { |
| 11 | const dirPath = path.join(__dirname, '..', '__tests__', 'fixtures', 'introspection', 'postgresql') |
| 12 | |
| 13 | process.chdir(dirPath) |
| 14 | |
| 15 | const schemaContext = await loadSchemaContext({ |
| 16 | schemaPath: { cliProvidedPath: path.join(dirPath, 'schema.prisma') }, |
| 17 | }) |
| 18 | const { viewsDirPath } = inferDirectoryConfig(schemaContext) |
| 19 | |
| 20 | const config = require(path.join(dirPath, 'prisma.config.ts')) |
| 21 | |
| 22 | const migrate = await Migrate.setup({ schemaContext, schemaEngineConfig: config, baseDir: dirPath }) |
| 23 | const engine = migrate.engine |
| 24 | |
| 25 | await engine.introspect({ |
| 26 | schema: toSchemasContainer(schemaContext.schemaFiles), |
| 27 | viewsDirectoryPath: viewsDirPath, |
| 28 | baseDirectoryPath: dirPath, |
| 29 | force: false, |
| 30 | }) |
| 31 | await engine.debugPanic() |
| 32 | } catch (err) { |
| 33 | console.debug({ err }) |
| 34 | |
| 35 | const getDatabaseVersionSafe = () => Promise.resolve(undefined) |
| 36 | handlePanic({ |
| 37 | error: err, |
| 38 | cliVersion: packageJsonVersion, |
| 39 | enginesVersion, |
| 40 | command, |
| 41 | getDatabaseVersionSafe, |
| 42 | }) |
| 43 | .catch((e) => { |
| 44 | console.error('Error: ' + e.stack) |
| 45 | console.error('Error: ' + e.message) |
| 46 | }) |
| 47 | .finally(() => { |
| 48 | process.exit(1) |
| 49 | }) |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | main().catch((e) => { |
| 54 | console.error(e) |
no test coverage detected