@prisma/migrate 6.6.0-dev.9 → 6.6.0-dev.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/CLI.js +3 -3
  2. package/dist/Migrate.js +8 -6
  3. package/dist/SchemaEngine.js +5 -5
  4. package/dist/bin.js +47 -46
  5. package/dist/chunk-23DZXSTI.js +62 -0
  6. package/dist/{chunk-WWAWV7DQ.js → chunk-2ESYSVXG.js} +3 -27
  7. package/dist/{chunk-LKTTJWFT.js → chunk-2R6DII47.js} +5 -5
  8. package/dist/chunk-33LPBNDX.js +1399 -0
  9. package/dist/{chunk-V3ZMNXZC.js → chunk-5LKIRKDL.js} +307 -382
  10. package/dist/{chunk-IR55GBON.js → chunk-5LTDMS3H.js} +18 -18
  11. package/dist/{chunk-LOGAFLCN.js → chunk-5R44VVVX.js} +29 -29
  12. package/dist/{chunk-Q3ZLC44N.js → chunk-63X7FE2R.js} +57 -66
  13. package/dist/{chunk-DJMFXNR4.js → chunk-74LUB4XX.js} +56 -57
  14. package/dist/{chunk-N4XTKFY6.js → chunk-7RM467G7.js} +39 -38
  15. package/dist/{chunk-RP2N6UXA.js → chunk-AI6DH66U.js} +6 -6
  16. package/dist/{chunk-A6PMXMMT.js → chunk-AUGZZ6RT.js} +105 -13
  17. package/dist/{chunk-G2XUUMKH.js → chunk-B4SUSDC2.js} +31 -39
  18. package/dist/{chunk-ZOEKRXDP.js → chunk-D2DGSPW6.js} +29 -55
  19. package/dist/{chunk-W2SZNLK4.js → chunk-EJG7GKM7.js} +37 -39
  20. package/dist/{chunk-5PSO7BDO.js → chunk-EJUXYFV3.js} +15 -15
  21. package/dist/{chunk-HCBZB4XC.js → chunk-FFPSJTA6.js} +53 -52
  22. package/dist/{chunk-N3KYWSX2.js → chunk-FZGPSDP7.js} +55 -49
  23. package/dist/{chunk-MCWCB2AX.js → chunk-IINN7QUV.js} +170 -643
  24. package/dist/{chunk-QYHXOHG3.js → chunk-IQB54PSS.js} +370 -529
  25. package/dist/{chunk-255BRND3.js → chunk-KRQEFTDT.js} +6 -6
  26. package/dist/{chunk-VVKOFN3Y.js → chunk-LLO7YF56.js} +44 -46
  27. package/dist/{chunk-VZ23KD5C.js → chunk-NGQA5JTN.js} +8 -10
  28. package/dist/{chunk-MKK3GSDF.js → chunk-NIKXBMZL.js} +5 -5
  29. package/dist/{chunk-GG54LOYV.js → chunk-O6RQXRWU.js} +45 -44
  30. package/dist/{chunk-MATFO4ZW.js → chunk-OEWQACEH.js} +38 -39
  31. package/dist/{chunk-EGPJABTW.js → chunk-QVMYNWAN.js} +257 -103
  32. package/dist/{chunk-V5TUSOJX.js → chunk-SQKGZVG3.js} +45 -45
  33. package/dist/{chunk-CQZFVAXC.js → chunk-TN7JMNXD.js} +42 -41
  34. package/dist/chunk-URKH6SE2.js +479 -0
  35. package/dist/chunk-V6PVGSDJ.js +76 -0
  36. package/dist/{chunk-DLLXDCI2.js → chunk-VAJ4VX67.js} +5 -6
  37. package/dist/{chunk-LKOMAN5A.js → chunk-YAYC26BQ.js} +371 -530
  38. package/dist/{chunk-OCQGHQED.js → chunk-YBX7R3MT.js} +12 -12
  39. package/dist/{chunk-KS7IEA6Z.js → chunk-YGBJA7QJ.js} +50 -52
  40. package/dist/{chunk-WI2A2TQE.js → chunk-ZJ4IDCRR.js} +90 -91
  41. package/dist/chunk-ZLHWX5PJ.js +883 -0
  42. package/dist/commands/DbCommand.js +3 -3
  43. package/dist/commands/DbDrop.js +4 -5
  44. package/dist/commands/DbExecute.js +9 -7
  45. package/dist/commands/DbPull.js +11 -10
  46. package/dist/commands/DbPush.js +10 -9
  47. package/dist/commands/DbSeed.js +4 -5
  48. package/dist/commands/MigrateCommand.js +3 -3
  49. package/dist/commands/MigrateDeploy.js +12 -11
  50. package/dist/commands/MigrateDev.js +14 -13
  51. package/dist/commands/MigrateDiff.js +12 -10
  52. package/dist/commands/MigrateReset.js +13 -12
  53. package/dist/commands/MigrateResolve.js +10 -9
  54. package/dist/commands/MigrateStatus.js +10 -9
  55. package/dist/index.js +50 -51
  56. package/dist/internals/src/Generator.d.ts +23 -5
  57. package/dist/internals/src/cli/checkUnsupportedDataProxy.d.ts +12 -17
  58. package/dist/internals/src/cli/directoryConfig.d.ts +7 -0
  59. package/dist/internals/src/cli/getSchema.d.ts +3 -28
  60. package/dist/internals/src/cli/hashes.d.ts +1 -2
  61. package/dist/internals/src/cli/schemaContext.d.ts +59 -0
  62. package/dist/internals/src/client/getClientEngineType.d.ts +1 -1
  63. package/dist/internals/src/convertCredentials.d.ts +1 -1
  64. package/dist/internals/src/engine-commands/getConfig.d.ts +1 -5
  65. package/dist/internals/src/engine-commands/getDmmf.d.ts +3 -6
  66. package/dist/internals/src/engine-commands/lintSchema.d.ts +1 -1
  67. package/dist/internals/src/errorReporting.d.ts +0 -1
  68. package/dist/internals/src/get-generators/getGenerators.d.ts +22 -9
  69. package/dist/internals/src/get-generators/utils/binaryTypeToEngineType.d.ts +1 -1
  70. package/dist/internals/src/get-generators/utils/engineTypeToBinaryType.d.ts +1 -1
  71. package/dist/internals/src/get-generators/utils/fixBinaryTargets.d.ts +1 -1
  72. package/dist/internals/src/get-generators/utils/getBinaryPathsByVersion.d.ts +1 -1
  73. package/dist/internals/src/get-generators/utils/getEngineVersionForGenerator.d.ts +1 -1
  74. package/dist/internals/src/get-generators/utils/printGeneratorConfig.d.ts +1 -1
  75. package/dist/internals/src/index.d.ts +7 -7
  76. package/dist/internals/src/migrateTypes.d.ts +63 -0
  77. package/dist/internals/src/panic.d.ts +1 -4
  78. package/dist/internals/src/resolvePkg.d.ts +7 -0
  79. package/dist/internals/src/types.d.ts +1 -1
  80. package/dist/internals/src/utils/extractPreviewFeatures.d.ts +2 -2
  81. package/dist/internals/src/utils/getEnvPaths.d.ts +1 -1
  82. package/dist/internals/src/utils/parseEnvValue.d.ts +1 -1
  83. package/dist/internals/src/utils/schemaFileInput.d.ts +0 -4
  84. package/dist/internals/src/utils/toSchemasContainer.d.ts +2 -3
  85. package/dist/migrate/src/Migrate.d.ts +7 -5
  86. package/dist/migrate/src/SchemaEngine.d.ts +5 -9
  87. package/dist/migrate/src/index.d.ts +0 -1
  88. package/dist/migrate/src/types.d.ts +14 -10
  89. package/dist/migrate/src/utils/createMigration.d.ts +21 -0
  90. package/dist/migrate/src/utils/ensureDatabaseExists.d.ts +4 -6
  91. package/dist/migrate/src/utils/introspectSql.d.ts +3 -2
  92. package/dist/migrate/src/utils/listMigrations.d.ts +9 -0
  93. package/dist/migrate/src/utils/printDatasources.d.ts +1 -1
  94. package/dist/migrate/src/utils/seed.d.ts +0 -2
  95. package/dist/migrate/src/views/handleViewsIO.d.ts +2 -2
  96. package/dist/{multipart-parser-54WEFGGN-NLZG56KM.js → multipart-parser-ASKQAOL4-WZ47HU6G.js} +92 -125
  97. package/dist/{multipart-parser-NDLECNMN.js → multipart-parser-QCI3Y5IB.js} +66 -68
  98. package/dist/types.js +1 -1
  99. package/dist/{typescript-WN4QH2CP.js → typescript-2LKASCMC.js} +33 -33
  100. package/dist/{typescript-AILDXN3I.js → typescript-H3AVJ6KX.js} +32 -32
  101. package/dist/utils/byline.js +1 -1
  102. package/dist/utils/captureStdout.js +3 -3
  103. package/dist/utils/countModelsAndTypes.js +1 -1
  104. package/dist/utils/{getSchemaPathAndPrint.js → createMigration.js} +8 -8
  105. package/dist/utils/customColors.js +1 -1
  106. package/dist/utils/ensureDatabaseExists.js +7 -7
  107. package/dist/utils/errors.js +1 -1
  108. package/dist/utils/flagErrors.js +1 -1
  109. package/dist/utils/getDatabaseVersionSafe.js +5 -5
  110. package/dist/utils/handleEvaluateDataloss.js +1 -1
  111. package/dist/utils/introspectSql.js +5 -5
  112. package/dist/utils/isSchemaEmpty.js +1 -1
  113. package/dist/utils/listMigrations.js +25 -0
  114. package/dist/utils/now.js +1 -1
  115. package/dist/utils/printDatasource.js +1 -1
  116. package/dist/utils/printDatasources.js +5 -5
  117. package/dist/utils/printFiles.js +5 -5
  118. package/dist/utils/printIntrospectedSchema.js +1 -1
  119. package/dist/utils/printMigrationId.js +1 -1
  120. package/dist/utils/promptForMigrationName.js +3 -3
  121. package/dist/utils/removeSchemaFiles.js +1 -1
  122. package/dist/utils/replaceOrAddDatasource.js +1 -1
  123. package/dist/utils/replaceOrAddDatasource.test.js +1 -1
  124. package/dist/utils/saveSchemaFiles.js +1 -1
  125. package/dist/utils/seed.js +4 -7
  126. package/dist/utils/setupCockroach.js +3 -3
  127. package/dist/utils/setupMSSQL.js +1478 -707
  128. package/dist/utils/setupMongo.js +553 -552
  129. package/dist/utils/setupMysql.js +508 -563
  130. package/dist/utils/setupPostgres.js +3 -3
  131. package/dist/utils/spinner.js +4 -3
  132. package/dist/utils/test-handlePanic.js +1 -30
  133. package/dist/utils/unixSocket.js +1 -1
  134. package/dist/views/handleViewsIO.js +3 -3
  135. package/package.json +11 -11
  136. package/dist/chunk-GKDFIHM2.js +0 -45
  137. package/dist/chunk-J46BJQHT.js +0 -268
  138. package/dist/chunk-KOF4LGTS.js +0 -1817
  139. package/dist/chunk-YYPMC5FN.js +0 -1407
  140. package/dist/internals/src/get-generators/generatorResolvers/generatorResolvers.d.ts +0 -15
  141. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/findPrismaClientDir.d.ts +0 -6
  142. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/getPackageCmd.d.ts +0 -9
  143. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/runPackageCmd.d.ts +0 -8
  144. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.d.ts +0 -6
  145. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/isYarnUsed.d.ts +0 -1
  146. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/resolve.d.ts +0 -20
  147. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.d.ts +0 -7
  148. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.d.ts +0 -20
  149. package/dist/internals/src/get-generators/utils/check-feature-flags/checkFeatureFlags.d.ts +0 -8
  150. package/dist/migrate/src/utils/getSchemaPathAndPrint.d.ts +0 -10
@@ -1,31 +1,10 @@
1
1
  import type { GetSchemaResult, SuccessfulLookupResult } from '@prisma/schema-files-loader';
2
- import type { MultipleSchemas } from '../utils/schemaFileInput';
3
2
  type PackageJsonLookupResult = SuccessfulLookupResult | {
4
3
  ok: false;
5
4
  error: {
6
5
  kind: 'PackageJsonNotConfigured';
7
6
  };
8
7
  };
9
- export type SchemaPathFromConfig = {
10
- /**
11
- * Tell Prisma to use a single `.prisma` schema file.
12
- */
13
- kind: 'single';
14
- /**
15
- * The path to a single `.prisma` schema file.
16
- */
17
- filePath: string;
18
- } | {
19
- /**
20
- * Tell Prisma to use multiple `.prisma` schema files, via the `prismaSchemaFolder` preview feature.
21
- */
22
- kind: 'multi';
23
- /**
24
- * The path to a folder containing multiple `.prisma` schema files.
25
- * All of the files in this folder will be used.
26
- */
27
- folderPath: string;
28
- };
29
8
  export type GetSchemaOptions = {
30
9
  cwd?: string;
31
10
  argumentName?: string;
@@ -36,7 +15,7 @@ export type GetSchemaOptions = {
36
15
  * @param schemaPathFromConfig
37
16
  * @param opts
38
17
  */
39
- export declare function getSchemaWithPath(schemaPathFromArgs?: string, schemaPathFromConfig?: SchemaPathFromConfig, { cwd, argumentName }?: GetSchemaOptions): Promise<GetSchemaResult>;
18
+ export declare function getSchemaWithPath(schemaPathFromArgs?: string, schemaPathFromConfig?: string, { cwd, argumentName }?: GetSchemaOptions): Promise<GetSchemaResult>;
40
19
  /**
41
20
  * Loads the schema, returns null if it is not found
42
21
  * Throws an error if schema is specified explicitly in
@@ -47,7 +26,8 @@ export declare function getSchemaWithPath(schemaPathFromArgs?: string, schemaPat
47
26
  * @param opts
48
27
  * @returns
49
28
  */
50
- export declare function getSchemaWithPathOptional(schemaPathFromArgs?: string, schemaPathFromConfig?: SchemaPathFromConfig, { cwd, argumentName }?: GetSchemaOptions): Promise<GetSchemaResult | null>;
29
+ export declare function getSchemaWithPathOptional(schemaPathFromArgs?: string, schemaPathFromConfig?: string, { cwd, argumentName }?: GetSchemaOptions): Promise<GetSchemaResult | null>;
30
+ export declare function printSchemaLoadedMessage(schemaPath: string): void;
51
31
  export type PrismaConfig = {
52
32
  schema?: string;
53
33
  seed?: string;
@@ -57,9 +37,4 @@ export declare function getPrismaConfigFromPackageJson(cwd: string): Promise<{
57
37
  packagePath: string;
58
38
  } | null>;
59
39
  export declare function getSchemaFromPackageJson(cwd: string): Promise<PackageJsonLookupResult>;
60
- /**
61
- * Small helper that returns the directory which contains the `schema.prisma` file
62
- */
63
- export declare function getSchemaDir(schemaPathFromArgs?: string): Promise<string | null>;
64
- export declare function getSchema(schemaPathFromArgs?: string, schemaPathFromConfig?: SchemaPathFromConfig): Promise<MultipleSchemas>;
65
40
  export {};
@@ -1,9 +1,8 @@
1
- import { type SchemaPathFromConfig } from './getSchema';
2
1
  /**
3
2
  * Get a unique identifier for the project by hashing
4
3
  * the directory with `schema.prisma`
5
4
  */
6
- export declare function getProjectHash(schemaPathFromArgs: string | undefined, schemaPathFromConfig: SchemaPathFromConfig | undefined): Promise<string>;
5
+ export declare function getProjectHash(schemaPathFromArgs: string | undefined, schemaPathFromConfig: string | undefined): Promise<string>;
7
6
  /**
8
7
  * Get a unique identifier for the CLI installation path
9
8
  * which can be either global or local (in project's node_modules)
@@ -0,0 +1,59 @@
1
+ import { DataSource, GeneratorConfig } from '@prisma/generator';
2
+ import { GetSchemaResult, LoadedFile } from '@prisma/schema-files-loader';
3
+ export type SchemaContext = {
4
+ /**
5
+ * All loaded schema files and their paths.
6
+ */
7
+ schemaFiles: LoadedFile[];
8
+ /**
9
+ * The root directory of the schema files.
10
+ * Either set explicitly from a schema folder based config or the parent directory of the schema.prisma file.
11
+ */
12
+ schemaRootDir: string;
13
+ /**
14
+ * The directory of the schema.prisma file that contains the datasource block.
15
+ * Some relative paths like SQLite paths or SSL file paths are resolved relative to it.
16
+ */
17
+ primaryDatasourceDirectory: string;
18
+ /**
19
+ * The path that shall be printed in user facing logs messages informing them from where the schema was loaded.
20
+ */
21
+ loadedFromPathForLogMessages: string;
22
+ /**
23
+ * The datasource extracted from the Prisma schema. So far we only support a single datasource block.
24
+ */
25
+ primaryDatasource: DataSource | undefined;
26
+ /**
27
+ * Warnings that were raised during Prisma schema parsing.
28
+ */
29
+ warnings: string[] | [];
30
+ /**
31
+ * The datasources extracted from the Prisma schema. Prefer to use primaryDatasource for most cases.
32
+ */
33
+ datasources: DataSource[] | [];
34
+ /**
35
+ * The generators extracted from the Prisma schema.
36
+ */
37
+ generators: GeneratorConfig[] | [];
38
+ schemaPath: string;
39
+ };
40
+ type LoadSchemaContextOptions = {
41
+ schemaPathFromArg?: string;
42
+ schemaPathFromConfig?: string;
43
+ printLoadMessage?: boolean;
44
+ ignoreEnvVarErrors?: boolean;
45
+ allowNull?: boolean;
46
+ schemaPathArgumentName?: string;
47
+ cwd?: string;
48
+ };
49
+ export declare function loadSchemaContext(opts: LoadSchemaContextOptions & {
50
+ allowNull: true;
51
+ }): Promise<SchemaContext | null>;
52
+ export declare function loadSchemaContext(opts?: LoadSchemaContextOptions): Promise<SchemaContext>;
53
+ export declare function processSchemaResult({ schemaResult, printLoadMessage, ignoreEnvVarErrors, cwd, }: {
54
+ schemaResult: GetSchemaResult;
55
+ printLoadMessage?: boolean;
56
+ ignoreEnvVarErrors?: boolean;
57
+ cwd?: string;
58
+ }): Promise<SchemaContext>;
59
+ export {};
@@ -1,4 +1,4 @@
1
- import type { GeneratorConfig } from '@prisma/generator-helper';
1
+ import type { GeneratorConfig } from '@prisma/generator';
2
2
  export declare enum ClientEngineType {
3
3
  Library = "library",
4
4
  Binary = "binary",
@@ -1,4 +1,4 @@
1
- import type { ConnectorType } from '@prisma/generator-helper';
1
+ import type { ConnectorType } from '@prisma/generator';
2
2
  import type { DatabaseCredentials } from './types';
3
3
  export declare function credentialsToUri(credentials: DatabaseCredentials): string;
4
4
  export declare function uriToCredentials(connectionString: string): DatabaseCredentials;
@@ -1,4 +1,4 @@
1
- import type { DataSource, EnvValue, GeneratorConfig } from '@prisma/generator-helper';
1
+ import type { DataSource, EnvValue, GeneratorConfig } from '@prisma/generator';
2
2
  import { type SchemaFileInput } from '../utils/schemaFileInput';
3
3
  import { QueryEngineErrorInit } from './queryEngineCommons';
4
4
  export interface GetConfigResponse {
@@ -16,10 +16,6 @@ interface GetConfigValidationError {
16
16
  }
17
17
  export type GetConfigOptions = {
18
18
  datamodel: SchemaFileInput;
19
- cwd?: string;
20
- prismaPath?: string;
21
- datamodelPath?: string;
22
- retry?: number;
23
19
  ignoreEnvVarErrors?: boolean;
24
20
  };
25
21
  export declare class GetConfigError extends Error {
@@ -1,4 +1,5 @@
1
- import type { DataSource, DMMF, GeneratorConfig } from '@prisma/generator-helper';
1
+ import type * as DMMF from '@prisma/dmmf';
2
+ import type { DataSource, GeneratorConfig } from '@prisma/generator';
2
3
  import { type SchemaFileInput } from '../utils/schemaFileInput';
3
4
  import { QueryEngineErrorInit } from './queryEngineCommons';
4
5
  export interface ConfigMetaFormat {
@@ -7,11 +8,7 @@ export interface ConfigMetaFormat {
7
8
  warnings: string[];
8
9
  }
9
10
  export type GetDMMFOptions = {
10
- datamodel?: SchemaFileInput;
11
- cwd?: string;
12
- prismaPath?: string;
13
- datamodelPath?: string;
14
- retry?: number;
11
+ datamodel: SchemaFileInput;
15
12
  previewFeatures?: string[];
16
13
  };
17
14
  export declare class GetDmmfError extends Error {
@@ -19,7 +19,7 @@ export type LintDiagnostic = LintWarning | LintError;
19
19
  * This function may panic, but it won't throw any standard error.
20
20
  */
21
21
  export declare function lintSchema({ schemas }: LintSchemaParams): LintDiagnostic[];
22
- export declare function handleLintPanic<T>(tryCb: () => T, { schemas }: LintSchemaParams): T;
22
+ export declare function handleLintPanic<T>(tryCb: () => T): T;
23
23
  export declare function getLintWarnings(lintDiagnostics: LintDiagnostic[]): LintWarning[];
24
24
  export declare function getLintWarningsAsText(lintDiagnostics: LintDiagnostic[]): string;
25
25
  export declare function warningToString(warning: LintDiagnostic): string;
@@ -16,7 +16,6 @@ export interface CreateErrorReportInput {
16
16
  operatingSystem: string;
17
17
  platform: string;
18
18
  rustStackTrace: string;
19
- schemaFile?: string;
20
19
  fingerprint?: string;
21
20
  sqlDump?: string;
22
21
  dbVersion?: string;
@@ -1,17 +1,32 @@
1
- import type { BinaryTargetsEnvValue, EngineType, GeneratorConfig, SqlQueryOutput } from '@prisma/generator-helper';
1
+ import type { BinaryTargetsEnvValue, EngineType, Generator as IGenerator, GeneratorConfig, SqlQueryOutput } from '@prisma/generator';
2
2
  import type { BinaryTarget } from '@prisma/get-platform';
3
+ import { SchemaContext } from '..';
3
4
  import { Generator } from '../Generator';
4
- import type { GeneratorPaths } from './generatorResolvers/generatorResolvers';
5
- export type ProviderAliases = {
6
- [alias: string]: GeneratorPaths;
7
- };
8
5
  type BinaryPathsOverride = {
9
6
  [P in EngineType]?: string;
10
7
  };
8
+ export type GeneratorRegistryEntry = {
9
+ type: 'rpc';
10
+ generatorPath: string;
11
+ isNode?: boolean;
12
+ } | {
13
+ type: 'in-process';
14
+ generator: IGenerator;
15
+ };
16
+ export type GeneratorRegistry = Record<string, GeneratorRegistryEntry>;
17
+ export type ProviderAliases = {
18
+ [alias: string]: {
19
+ generatorPath: string;
20
+ isNode?: boolean;
21
+ };
22
+ };
11
23
  export type GetGeneratorOptions = {
12
- schemaPath: string;
24
+ /** @deprecated Pass a schemaContext instead. Kept for compatibility with prisma studio. */
25
+ schemaPath?: string;
26
+ schemaContext?: SchemaContext;
27
+ registry: GeneratorRegistry;
28
+ /** @deprecated Use `registry` instead. Kept for compatibility with Prisma Studio. */
13
29
  providerAliases?: ProviderAliases;
14
- cliVersion?: string;
15
30
  version?: string;
16
31
  printDownloadProgress?: boolean;
17
32
  overrideGenerators?: GeneratorConfig[];
@@ -27,8 +42,6 @@ export type GetGeneratorOptions = {
27
42
  * Makes sure that all generators have the binaries they deserve and returns a
28
43
  * `Generator` class per generator defined in the schema.prisma file.
29
44
  * In other words, this is basically a generator factory function.
30
- * @param schemaPath Path to schema.prisma
31
- * @param aliases Aliases like `prisma-client-js` -> `node_modules/@prisma/client/generator-build/index.js`
32
45
  */
33
46
  export declare function getGenerators(options: GetGeneratorOptions): Promise<Generator[]>;
34
47
  type NeededVersions = {
@@ -1,3 +1,3 @@
1
1
  import { BinaryType } from '@prisma/fetch-engine';
2
- import type { EngineType } from '@prisma/generator-helper';
2
+ import type { EngineType } from '@prisma/generator';
3
3
  export declare function binaryTypeToEngineType(binaryType: BinaryType): EngineType;
@@ -1,3 +1,3 @@
1
1
  import { BinaryType } from '@prisma/fetch-engine';
2
- import type { EngineType } from '@prisma/generator-helper';
2
+ import type { EngineType } from '@prisma/generator';
3
3
  export declare function engineTypeToBinaryType(engineType: EngineType): BinaryType;
@@ -1,3 +1,3 @@
1
- import { BinaryTargetsEnvValue } from '@prisma/generator-helper';
1
+ import { BinaryTargetsEnvValue } from '@prisma/generator';
2
2
  import { BinaryTarget } from '@prisma/get-platform';
3
3
  export declare function fixBinaryTargets(schemaBinaryTargets: BinaryTargetsEnvValue[], runtimeBinaryTarget: BinaryTarget | string): BinaryTargetsEnvValue[];
@@ -1,3 +1,3 @@
1
- import type { BinaryPaths } from '@prisma/generator-helper';
1
+ import type { BinaryPaths } from '@prisma/generator';
2
2
  import type { GetBinaryPathsByVersionInput } from '../getGenerators';
3
3
  export declare function getBinaryPathsByVersion({ neededVersions, binaryTarget, version, printDownloadProgress, skipDownload, binaryPathsOverride, }: GetBinaryPathsByVersionInput): Promise<Record<string, BinaryPaths>>;
@@ -1,2 +1,2 @@
1
- import type { GeneratorManifest } from '@prisma/generator-helper';
1
+ import type { GeneratorManifest } from '@prisma/generator';
2
2
  export declare function getEngineVersionForGenerator(manifest?: GeneratorManifest, defaultVersion?: string | undefined): string;
@@ -1,4 +1,4 @@
1
- import type { BinaryTargetsEnvValue, GeneratorConfig } from '@prisma/generator-helper';
1
+ import type { BinaryTargetsEnvValue, GeneratorConfig } from '@prisma/generator';
2
2
  export declare function printGeneratorConfig(config: GeneratorConfig): string;
3
3
  export declare class GeneratorConfigClass {
4
4
  private readonly config;
@@ -1,10 +1,12 @@
1
1
  export { checkUnsupportedDataProxy } from './cli/checkUnsupportedDataProxy';
2
+ export { type DirectoryConfig, inferDirectoryConfig } from './cli/directoryConfig';
2
3
  export { getGeneratorSuccessMessage } from './cli/getGeneratorSuccessMessage';
3
- export { getPrismaConfigFromPackageJson, getSchema, getSchemaDir, type GetSchemaOptions, getSchemaWithPath, getSchemaWithPathOptional, type SchemaPathFromConfig, } from './cli/getSchema';
4
+ export { getPrismaConfigFromPackageJson, type GetSchemaOptions, getSchemaWithPath, getSchemaWithPathOptional, printSchemaLoadedMessage, } from './cli/getSchema';
4
5
  export { getTypescriptVersion } from './cli/getTypescriptVersion';
5
6
  export { getCLIPathHash, getProjectHash } from './cli/hashes';
6
7
  export { unknownCommand } from './cli/Help';
7
8
  export { HelpError } from './cli/Help';
9
+ export { loadSchemaContext, processSchemaResult, type SchemaContext } from './cli/schemaContext';
8
10
  export type { Command, Commands, CompiledGeneratorDefinition, Dictionary, GeneratorConfig, GeneratorDefinition, GeneratorDefinitionWithPackage, GeneratorFunction, GeneratorOptions, } from './cli/types';
9
11
  export { arg, format, isError } from './cli/utils';
10
12
  export { ClientEngineType, DEFAULT_CLIENT_ENGINE_TYPE, getClientEngineType } from './client/getClientEngineType';
@@ -13,10 +15,7 @@ export * from './engine-commands';
13
15
  export { resolveUrl } from './engine-commands/getConfig';
14
16
  export { relativizePathInPSLError } from './engine-commands/relativizePathInPSLError';
15
17
  export { Generator } from './Generator';
16
- export type { GeneratorPaths } from './get-generators/generatorResolvers/generatorResolvers';
17
- export { getPackageCmd } from './get-generators/generatorResolvers/prisma-client-js/auto-installation/getPackageCmd';
18
- export type { ProviderAliases } from './get-generators/getGenerators';
19
- export { getGenerator, getGenerators } from './get-generators/getGenerators';
18
+ export { type GeneratorRegistry, type GeneratorRegistryEntry, getGenerator, getGenerators, } from './get-generators/getGenerators';
20
19
  export { fixBinaryTargets } from './get-generators/utils/fixBinaryTargets';
21
20
  export { printGeneratorConfig } from './get-generators/utils/printGeneratorConfig';
22
21
  export { getPackedPackage } from './getPackedPackage';
@@ -26,6 +25,7 @@ export type { MigrateTypes } from './migrateTypes';
26
25
  export { ErrorArea, isRustPanic, RustPanic } from './panic';
27
26
  export { BinaryType } from './resolveBinary';
28
27
  export { engineEnvVarMap, resolveBinary } from './resolveBinary';
28
+ export { resolvePkg } from './resolvePkg';
29
29
  export type { SchemaEngineLogLine } from './schemaEngineCommands';
30
30
  export { canConnectToDatabase, createDatabase, dropDatabase } from './schemaEngineCommands';
31
31
  export { SchemaEngineExitCode } from './schemaEngineCommands';
@@ -75,7 +75,7 @@ export { longestCommonPathPrefix, pathToPosix } from './utils/path';
75
75
  export { pick } from './utils/pick';
76
76
  export { printConfigWarnings } from './utils/printConfigWarnings';
77
77
  export { isPrismaPostgres, PRISMA_POSTGRES_PROTOCOL, PRISMA_POSTGRES_PROVIDER } from './utils/prismaPostgres';
78
- export { debugMultipleSchemaPaths, debugMultipleSchemas, extractSchemaContent, type SchemaFileInput, toMultipleSchemas, } from './utils/schemaFileInput';
78
+ export { extractSchemaContent, type SchemaFileInput } from './utils/schemaFileInput';
79
79
  export { type MultipleSchemas } from './utils/schemaFileInput';
80
80
  export { serializeQueryEngineName } from './utils/serializeQueryEngineName';
81
81
  export { setClassName } from './utils/setClassName';
@@ -84,7 +84,7 @@ export { type LoadedEnv, tryLoadEnvs } from './utils/tryLoadEnvs';
84
84
  export { vercelPkgPathRegex } from './utils/vercelPkgPathRegex';
85
85
  export { warnOnce } from './warnOnce';
86
86
  export * as wasm from './wasm';
87
- export type { EnvPaths } from '@prisma/generator-helper';
87
+ export type { EnvPaths } from '@prisma/generator';
88
88
  export type { BinaryTarget } from '@prisma/get-platform';
89
89
  export { getBinaryTargetForCurrentPlatform, getNodeAPIName } from '@prisma/get-platform';
90
90
  export type { GetSchemaResult } from '@prisma/schema-files-loader';
@@ -1,4 +1,67 @@
1
1
  export declare namespace MigrateTypes {
2
+ type MigrationDirectory = {
3
+ /**
4
+ * Relative path to a migration directory from `baseDir`.
5
+ * E.g., `./20201117144659_test`.
6
+ */
7
+ path: string;
8
+ /**
9
+ * Description of the migration file in the directory.
10
+ */
11
+ migrationFile: {
12
+ /**
13
+ * Relative path to the migration file from `path`.
14
+ */
15
+ path: 'migration.sql';
16
+ /**
17
+ * Content of the migration file.
18
+ * E.g.,
19
+ * ```sql
20
+ * -- CreateTable
21
+ * CREATE TABLE "Blog" (
22
+ * "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
23
+ *
24
+ * "viewCount20" INTEGER NOT NULL
25
+ * );
26
+ * ```
27
+ */
28
+ content: Tagged<'ok', {
29
+ value: string;
30
+ }> | Tagged<'error', {
31
+ value: Error;
32
+ }>;
33
+ };
34
+ };
35
+ type MigrationLockfile = {
36
+ /**
37
+ * Relative path to the lockfile from `baseDir`.
38
+ */
39
+ path: 'migration_lock.toml';
40
+ /**
41
+ * Content of the lockfile, if it exists.
42
+ * E.g.,
43
+ * ```toml
44
+ * # Please do not edit this file manually
45
+ * provider = "sqlite"
46
+ * ```
47
+ */
48
+ content: string | null;
49
+ };
50
+ type MigrationList = {
51
+ /**
52
+ * Absolute path to the base directory of Prisma migrations.
53
+ * E.g., `/usr/src/app/prisma/migrations`.
54
+ */
55
+ baseDir: string;
56
+ /**
57
+ * Description of the lockfile, which may or may not exist.
58
+ */
59
+ lockfile: MigrationLockfile;
60
+ /**
61
+ * Description of the migration directories.
62
+ */
63
+ migrationDirectories: Array<MigrationDirectory>;
64
+ };
2
65
  type SchemaContainer = {
3
66
  path: string;
4
67
  content: string;
@@ -1,13 +1,10 @@
1
- import { MultipleSchemas } from './utils/schemaFileInput';
2
1
  export declare class RustPanic extends Error {
3
2
  readonly __typename = "RustPanic";
4
3
  request: any;
5
4
  rustStack: string;
6
5
  area: ErrorArea;
7
- schemaPath?: string;
8
- schema?: MultipleSchemas;
9
6
  introspectionUrl?: string;
10
- constructor(message: string, rustStack: string, request: any, area: ErrorArea, schemaPath?: string, schema?: MultipleSchemas, introspectionUrl?: string);
7
+ constructor(message: string, rustStack: string, request: any, area: ErrorArea, introspectionUrl?: string);
11
8
  }
12
9
  export declare function isRustPanic(e: Error): e is RustPanic;
13
10
  export declare enum ErrorArea {
@@ -0,0 +1,7 @@
1
+ import resolve from 'resolve';
2
+ /**
3
+ * Alternative to `require.resolve` that returns undefined instead of throwing.
4
+ * It also enables preserving symlinks, which is not possible with the original
5
+ * `require.resolve`. This variant will find the _root_ of a package.
6
+ */
7
+ export declare function resolvePkg(id: string, options: resolve.AsyncOpts): Promise<string | undefined>;
@@ -1,4 +1,4 @@
1
- import type { ConnectorType } from '@prisma/generator-helper';
1
+ import type { ConnectorType } from '@prisma/generator';
2
2
  export interface DatabaseCredentials {
3
3
  type: ConnectorType;
4
4
  host?: string;
@@ -1,2 +1,2 @@
1
- import type { ConfigMetaFormat } from '../engine-commands';
2
- export declare function extractPreviewFeatures(config: ConfigMetaFormat): string[];
1
+ import type { GeneratorConfig } from '@prisma/generator';
2
+ export declare function extractPreviewFeatures(generators: GeneratorConfig[]): string[];
@@ -1,4 +1,4 @@
1
- import { EnvPaths } from '@prisma/generator-helper';
1
+ import { EnvPaths } from '@prisma/generator';
2
2
  /**
3
3
  * 1. Search in project root
4
4
  * 1. Schema
@@ -1,4 +1,4 @@
1
- import type { BinaryTargetsEnvValue, EnvValue } from '@prisma/generator-helper';
1
+ import type { BinaryTargetsEnvValue, EnvValue } from '@prisma/generator';
2
2
  /**
3
3
  * Parses an EnvValue (example: Provider) and return the string value
4
4
  *
@@ -2,8 +2,4 @@ export type SingleSchema = string;
2
2
  export type MultipleSchemaTuple = [filename: string, content: string];
3
3
  export type MultipleSchemas = Array<MultipleSchemaTuple>;
4
4
  export type SchemaFileInput = SingleSchema | MultipleSchemas;
5
- export declare const schemaToStringDebug: (schemaFileInput: SchemaFileInput | unknown) => string | undefined;
6
- export declare function toMultipleSchemas(input: SchemaFileInput | undefined): MultipleSchemas | undefined;
7
- export declare function debugMultipleSchemas(multipleSchemas: MultipleSchemas): string;
8
- export declare function debugMultipleSchemaPaths(multipleSchemas: MultipleSchemas): string;
9
5
  export declare function extractSchemaContent(multipleSchemas: MultipleSchemas): string[];
@@ -1,6 +1,5 @@
1
- import { GetSchemaResult } from '@prisma/schema-files-loader';
2
- import { ConfigMetaFormat } from '../engine-commands';
1
+ import { SchemaContext } from '../cli/schemaContext';
3
2
  import { MigrateTypes } from '../migrateTypes';
4
3
  import { MultipleSchemas } from './schemaFileInput';
5
4
  export declare function toSchemasContainer(schemas: MultipleSchemas): MigrateTypes.SchemasContainer;
6
- export declare function toSchemasWithConfigDir(getSchemaResult: GetSchemaResult, config: ConfigMetaFormat): MigrateTypes.SchemasWithConfigDir;
5
+ export declare function toSchemasWithConfigDir(schemaContext: SchemaContext): MigrateTypes.SchemasWithConfigDir;
@@ -1,16 +1,18 @@
1
- import { type GetSchemaResult } from '@prisma/internals';
1
+ import { MigrateTypes, SchemaContext } from '@prisma/internals';
2
2
  import { SchemaEngine } from './SchemaEngine';
3
3
  import type { EngineArgs, EngineResults } from './types';
4
4
  import { DatasourceInfo } from './utils/ensureDatabaseExists';
5
5
  export declare class Migrate {
6
6
  engine: SchemaEngine;
7
- private schemaPath?;
7
+ private schemaContext?;
8
8
  migrationsDirectoryPath?: string;
9
- constructor(schemaPath?: string, enabledPreviewFeatures?: string[]);
9
+ constructor(schemaContext?: SchemaContext, migrationsDirPath?: string, enabledPreviewFeatures?: string[]);
10
10
  stop(): void;
11
- getPrismaSchema(): Promise<GetSchemaResult>;
11
+ getPrismaSchema(): MigrateTypes.SchemasContainer;
12
12
  reset(): Promise<void>;
13
- createMigration(params: EngineArgs.CreateMigrationInput): Promise<EngineResults.CreateMigrationOutput>;
13
+ createMigration(params: Omit<EngineArgs.CreateMigrationInput, 'migrationsList'>): Promise<{
14
+ generatedMigrationName: string | undefined;
15
+ }>;
14
16
  diagnoseMigrationHistory({ optInToShadowDatabase, }: {
15
17
  optInToShadowDatabase: boolean;
16
18
  }): Promise<EngineResults.DiagnoseMigrationHistoryOutput>;
@@ -1,7 +1,7 @@
1
- import { type MigrateTypes } from '@prisma/internals';
1
+ import { type MigrateTypes, SchemaContext } from '@prisma/internals';
2
2
  import type { EngineArgs, EngineResults } from './types';
3
3
  export interface SchemaEngineOptions {
4
- schemaPath?: string;
4
+ schemaContext?: SchemaContext;
5
5
  debug?: boolean;
6
6
  enabledPreviewFeatures?: string[];
7
7
  }
@@ -12,7 +12,7 @@ export declare class EngineError extends Error {
12
12
  export declare class SchemaEngine {
13
13
  private debug;
14
14
  private child?;
15
- private schemaPath?;
15
+ private schemaContext?;
16
16
  private listeners;
17
17
  /** _All_ the logs from the engine process. */
18
18
  private messages;
@@ -23,7 +23,7 @@ export declare class SchemaEngine {
23
23
  private enabledPreviewFeatures?;
24
24
  private latestSchema?;
25
25
  isRunning: boolean;
26
- constructor({ debug, schemaPath, enabledPreviewFeatures }: SchemaEngineOptions);
26
+ constructor({ debug, schemaContext, enabledPreviewFeatures }: SchemaEngineOptions);
27
27
  /**
28
28
  * Apply the migrations from the migrations directory to the database.
29
29
  * This is the command behind prisma migrate deploy.
@@ -82,7 +82,7 @@ export declare class SchemaEngine {
82
82
  * Given a Prisma schema, introspect the database definitions and update the schema with the results.
83
83
  * `compositeTypeDepth` is optional, and only required for MongoDB.
84
84
  */
85
- introspect({ schema, force, baseDirectoryPath, compositeTypeDepth, // cannot be undefined
85
+ introspect({ schema, force, baseDirectoryPath, viewsDirectoryPath, compositeTypeDepth, // cannot be undefined
86
86
  namespaces, }: EngineArgs.IntrospectParams): Promise<EngineArgs.IntrospectResult>;
87
87
  /**
88
88
  * Compares two databases schemas from two arbitrary sources,
@@ -94,10 +94,6 @@ export declare class SchemaEngine {
94
94
  * By default, we output a human-readable diff. If you want an executable script, pass the "script": true param.
95
95
  */
96
96
  migrateDiff(args: EngineArgs.MigrateDiffInput): Promise<EngineResults.MigrateDiffOutput>;
97
- /**
98
- * List the names of the migrations in the migrations directory.
99
- */
100
- listMigrationDirectories(args: EngineArgs.ListMigrationDirectoriesInput): Promise<EngineResults.ListMigrationDirectoriesOutput>;
101
97
  /**
102
98
  * Mark a migration as applied in the migrations table.
103
99
  * There are two possible outcomes:
@@ -16,5 +16,4 @@ export { SchemaEngine } from './SchemaEngine';
16
16
  export * from './types';
17
17
  export { default as byline } from './utils/byline';
18
18
  export { getDatabaseVersionSafe } from './utils/getDatabaseVersionSafe';
19
- export { getSchemaPathAndPrint, printSchemaLoadedMessage } from './utils/getSchemaPathAndPrint';
20
19
  export { introspectSql, type IntrospectSqlError, type IntrospectSqlInput, type IntrospectSqlResult, } from './utils/introspectSql';
@@ -1,4 +1,4 @@
1
- import type { SqlQueryOutput } from '@prisma/generator-helper';
1
+ import type { ActiveConnectorType, SqlQueryOutput } from '@prisma/generator';
2
2
  import type { MigrateTypes } from '@prisma/internals';
3
3
  import type { IntrospectionViewDefinition } from './views/handleViewsIO';
4
4
  export interface RpcRequestResponse {
@@ -69,13 +69,13 @@ export declare namespace EngineArgs {
69
69
  * These RPCs need a sourceConfig, therefore a db connection to function
70
70
  */
71
71
  export interface ApplyMigrationsInput {
72
- migrationsDirectoryPath: string;
72
+ migrationsList: MigrateTypes.MigrationList;
73
73
  }
74
74
  export interface CreateMigrationInput {
75
- migrationsDirectoryPath: string;
75
+ migrationsList: MigrateTypes.MigrationList;
76
76
  schema: MigrateTypes.SchemasContainer;
77
77
  draft: boolean;
78
- migrationName?: string;
78
+ migrationName: string;
79
79
  }
80
80
  export interface CreateDatabaseInput {
81
81
  datasource: MigrateTypes.DatasourceParam;
@@ -91,6 +91,7 @@ export declare namespace EngineArgs {
91
91
  export interface IntrospectParams {
92
92
  schema: MigrateTypes.SchemasContainer;
93
93
  baseDirectoryPath: string;
94
+ viewsDirectoryPath: string;
94
95
  force?: Boolean;
95
96
  compositeTypeDepth?: number;
96
97
  namespaces?: string[];
@@ -110,24 +111,24 @@ export declare namespace EngineArgs {
110
111
  views: IntrospectionViewDefinition[] | null;
111
112
  }
112
113
  export interface DevDiagnosticInput {
113
- migrationsDirectoryPath: string;
114
+ migrationsList: MigrateTypes.MigrationList;
114
115
  }
115
116
  export interface DiagnoseMigrationHistoryInput {
116
- migrationsDirectoryPath: string;
117
+ migrationsList: MigrateTypes.MigrationList;
117
118
  optInToShadowDatabase: boolean;
118
119
  }
119
120
  export interface EnsureConnectionValidityInput {
120
121
  datasource: MigrateTypes.DatasourceParam;
121
122
  }
122
123
  export interface EvaluateDataLossInput {
123
- migrationsDirectoryPath: string;
124
+ migrationsList: MigrateTypes.MigrationList;
124
125
  schema: MigrateTypes.SchemasContainer;
125
126
  }
126
127
  export interface ListMigrationDirectoriesInput {
127
128
  migrationsDirectoryPath: string;
128
129
  }
129
130
  export interface MarkMigrationAppliedInput {
130
- migrationsDirectoryPath: string;
131
+ migrationsList: MigrateTypes.MigrationList;
131
132
  migrationName: string;
132
133
  }
133
134
  export interface MarkMigrationRolledBackInput {
@@ -141,7 +142,7 @@ export declare namespace EngineArgs {
141
142
  type MigrateDiffTargetSchemaDatasource = MigrateTypes.Tagged<'schemaDatasource', MigrateTypes.SchemasWithConfigDir>;
142
143
  type MigrateDiffTargetMigrations = {
143
144
  tag: 'migrations';
144
- path: string;
145
+ migrationsList: MigrateTypes.MigrationList;
145
146
  };
146
147
  export type MigrateDiffTarget = MigrateDiffTargetUrl | MigrateDiffTargetEmpty | MigrateDiffTargetSchemaDatamodel | MigrateDiffTargetSchemaDatasource | MigrateDiffTargetMigrations;
147
148
  export interface MigrateDiffInput {
@@ -173,7 +174,10 @@ export declare namespace EngineResults {
173
174
  database_name: string;
174
175
  }
175
176
  interface CreateMigrationOutput {
176
- generatedMigrationName: string | null;
177
+ connectorType: ActiveConnectorType;
178
+ generatedMigrationName: string;
179
+ migrationScript: string | null;
180
+ extension: string;
177
181
  }
178
182
  interface DbExecuteOutput {
179
183
  }