@prisma/migrate 6.6.0-dev.5 → 6.6.0-dev.52

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 (140) 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-GG54LOYV.js → chunk-3PIR4R46.js} +45 -44
  10. package/dist/{chunk-UG7FMNDT.js → chunk-3VPUKOUG.js} +365 -518
  11. package/dist/{chunk-A6PMXMMT.js → chunk-4RKCE4QB.js} +95 -13
  12. package/dist/{chunk-V3ZMNXZC.js → chunk-5LKIRKDL.js} +307 -382
  13. package/dist/{chunk-IR55GBON.js → chunk-5LTDMS3H.js} +18 -18
  14. package/dist/{chunk-LOGAFLCN.js → chunk-5R44VVVX.js} +29 -29
  15. package/dist/{chunk-DJMFXNR4.js → chunk-74LUB4XX.js} +56 -57
  16. package/dist/{chunk-RP2N6UXA.js → chunk-AI6DH66U.js} +6 -6
  17. package/dist/{chunk-G2XUUMKH.js → chunk-B4SUSDC2.js} +31 -39
  18. package/dist/{chunk-Q3ZLC44N.js → chunk-CKRN45WP.js} +57 -66
  19. package/dist/{chunk-ZOEKRXDP.js → chunk-D2DGSPW6.js} +29 -55
  20. package/dist/{chunk-XE57D2AO.js → chunk-DAPW4IMN.js} +366 -519
  21. package/dist/{chunk-W2SZNLK4.js → chunk-EJG7GKM7.js} +37 -39
  22. package/dist/{chunk-5PSO7BDO.js → chunk-EJUXYFV3.js} +15 -15
  23. package/dist/{chunk-N3KYWSX2.js → chunk-GAKKKF5T.js} +55 -49
  24. package/dist/{chunk-N4XTKFY6.js → chunk-GKHRL6AR.js} +39 -38
  25. package/dist/{chunk-CQZFVAXC.js → chunk-HHVLUI3H.js} +42 -41
  26. package/dist/{chunk-MCWCB2AX.js → chunk-IINN7QUV.js} +170 -643
  27. package/dist/{chunk-HCBZB4XC.js → chunk-KN2W5IP7.js} +53 -52
  28. package/dist/{chunk-255BRND3.js → chunk-KRQEFTDT.js} +6 -6
  29. package/dist/{chunk-VVKOFN3Y.js → chunk-LLO7YF56.js} +44 -46
  30. package/dist/{chunk-VZ23KD5C.js → chunk-NGQA5JTN.js} +8 -10
  31. package/dist/{chunk-MKK3GSDF.js → chunk-NIKXBMZL.js} +5 -5
  32. package/dist/{chunk-KS7IEA6Z.js → chunk-O723A5JE.js} +50 -52
  33. package/dist/{chunk-MATFO4ZW.js → chunk-OEWQACEH.js} +38 -39
  34. package/dist/chunk-PDCXVUV3.js +883 -0
  35. package/dist/{chunk-EGPJABTW.js → chunk-QVMYNWAN.js} +257 -103
  36. package/dist/{chunk-V5TUSOJX.js → chunk-SQKGZVG3.js} +45 -45
  37. package/dist/chunk-URKH6SE2.js +479 -0
  38. package/dist/chunk-V6PVGSDJ.js +76 -0
  39. package/dist/{chunk-DLLXDCI2.js → chunk-VAJ4VX67.js} +5 -6
  40. package/dist/{chunk-OCQGHQED.js → chunk-YBX7R3MT.js} +12 -12
  41. package/dist/{chunk-WI2A2TQE.js → chunk-ZJ4IDCRR.js} +90 -91
  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 +1 -1
  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 +8 -4
  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 +5 -3
  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/types.d.ts +1 -1
  79. package/dist/internals/src/utils/extractPreviewFeatures.d.ts +2 -2
  80. package/dist/internals/src/utils/getEnvPaths.d.ts +1 -1
  81. package/dist/internals/src/utils/parseEnvValue.d.ts +1 -1
  82. package/dist/internals/src/utils/schemaFileInput.d.ts +0 -4
  83. package/dist/internals/src/utils/toSchemasContainer.d.ts +2 -3
  84. package/dist/migrate/src/Migrate.d.ts +7 -5
  85. package/dist/migrate/src/SchemaEngine.d.ts +5 -9
  86. package/dist/migrate/src/index.d.ts +0 -1
  87. package/dist/migrate/src/types.d.ts +14 -10
  88. package/dist/migrate/src/utils/createMigration.d.ts +21 -0
  89. package/dist/migrate/src/utils/ensureDatabaseExists.d.ts +4 -6
  90. package/dist/migrate/src/utils/introspectSql.d.ts +3 -2
  91. package/dist/migrate/src/utils/listMigrations.d.ts +9 -0
  92. package/dist/migrate/src/utils/printDatasources.d.ts +1 -1
  93. package/dist/migrate/src/utils/seed.d.ts +0 -2
  94. package/dist/migrate/src/views/handleViewsIO.d.ts +2 -2
  95. package/dist/{multipart-parser-54WEFGGN-NLZG56KM.js → multipart-parser-ASKQAOL4-WZ47HU6G.js} +92 -125
  96. package/dist/{multipart-parser-NDLECNMN.js → multipart-parser-QCI3Y5IB.js} +66 -68
  97. package/dist/types.js +1 -1
  98. package/dist/{typescript-WN4QH2CP.js → typescript-2LKASCMC.js} +33 -33
  99. package/dist/{typescript-AILDXN3I.js → typescript-H3AVJ6KX.js} +32 -32
  100. package/dist/utils/byline.js +1 -1
  101. package/dist/utils/captureStdout.js +3 -3
  102. package/dist/utils/countModelsAndTypes.js +1 -1
  103. package/dist/utils/{getSchemaPathAndPrint.js → createMigration.js} +8 -8
  104. package/dist/utils/customColors.js +1 -1
  105. package/dist/utils/ensureDatabaseExists.js +7 -7
  106. package/dist/utils/errors.js +1 -1
  107. package/dist/utils/flagErrors.js +1 -1
  108. package/dist/utils/getDatabaseVersionSafe.js +5 -5
  109. package/dist/utils/handleEvaluateDataloss.js +1 -1
  110. package/dist/utils/introspectSql.js +5 -5
  111. package/dist/utils/isSchemaEmpty.js +1 -1
  112. package/dist/utils/listMigrations.js +25 -0
  113. package/dist/utils/now.js +1 -1
  114. package/dist/utils/printDatasource.js +1 -1
  115. package/dist/utils/printDatasources.js +5 -5
  116. package/dist/utils/printFiles.js +5 -5
  117. package/dist/utils/printIntrospectedSchema.js +1 -1
  118. package/dist/utils/printMigrationId.js +1 -1
  119. package/dist/utils/promptForMigrationName.js +3 -3
  120. package/dist/utils/removeSchemaFiles.js +1 -1
  121. package/dist/utils/replaceOrAddDatasource.js +1 -1
  122. package/dist/utils/replaceOrAddDatasource.test.js +1 -1
  123. package/dist/utils/saveSchemaFiles.js +1 -1
  124. package/dist/utils/seed.js +4 -7
  125. package/dist/utils/setupCockroach.js +3 -3
  126. package/dist/utils/setupMSSQL.js +1487 -707
  127. package/dist/utils/setupMongo.js +552 -552
  128. package/dist/utils/setupMysql.js +508 -563
  129. package/dist/utils/setupPostgres.js +3 -3
  130. package/dist/utils/spinner.js +4 -3
  131. package/dist/utils/test-handlePanic.js +1 -30
  132. package/dist/utils/unixSocket.js +1 -1
  133. package/dist/views/handleViewsIO.js +3 -3
  134. package/package.json +10 -11
  135. package/dist/chunk-GKDFIHM2.js +0 -45
  136. package/dist/chunk-J46BJQHT.js +0 -268
  137. package/dist/chunk-KOF4LGTS.js +0 -1817
  138. package/dist/chunk-YYPMC5FN.js +0 -1407
  139. package/dist/internals/src/get-generators/utils/check-feature-flags/checkFeatureFlags.d.ts +0 -8
  140. package/dist/migrate/src/utils/getSchemaPathAndPrint.d.ts +0 -10
@@ -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';
@@ -75,7 +77,7 @@ export { longestCommonPathPrefix, pathToPosix } from './utils/path';
75
77
  export { pick } from './utils/pick';
76
78
  export { printConfigWarnings } from './utils/printConfigWarnings';
77
79
  export { isPrismaPostgres, PRISMA_POSTGRES_PROTOCOL, PRISMA_POSTGRES_PROVIDER } from './utils/prismaPostgres';
78
- export { debugMultipleSchemaPaths, debugMultipleSchemas, extractSchemaContent, type SchemaFileInput, toMultipleSchemas, } from './utils/schemaFileInput';
80
+ export { extractSchemaContent, type SchemaFileInput } from './utils/schemaFileInput';
79
81
  export { type MultipleSchemas } from './utils/schemaFileInput';
80
82
  export { serializeQueryEngineName } from './utils/serializeQueryEngineName';
81
83
  export { setClassName } from './utils/setClassName';
@@ -84,7 +86,7 @@ export { type LoadedEnv, tryLoadEnvs } from './utils/tryLoadEnvs';
84
86
  export { vercelPkgPathRegex } from './utils/vercelPkgPathRegex';
85
87
  export { warnOnce } from './warnOnce';
86
88
  export * as wasm from './wasm';
87
- export type { EnvPaths } from '@prisma/generator-helper';
89
+ export type { EnvPaths } from '@prisma/generator';
88
90
  export type { BinaryTarget } from '@prisma/get-platform';
89
91
  export { getBinaryTargetForCurrentPlatform, getNodeAPIName } from '@prisma/get-platform';
90
92
  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 {
@@ -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
  }
@@ -0,0 +1,21 @@
1
+ import type { ActiveConnectorType } from '@prisma/generator';
2
+ import type { MigrateTypes } from '@prisma/internals';
3
+ type CreateMigrationInput = {
4
+ baseDir: string;
5
+ generatedMigrationName: string;
6
+ };
7
+ export declare function createMigration({ baseDir, generatedMigrationName }: CreateMigrationInput): Promise<string>;
8
+ type WriteMigrationScriptInput = {
9
+ baseDir: string;
10
+ migrationName: string;
11
+ extension: string;
12
+ script: string;
13
+ };
14
+ export declare function writeMigrationScript({ baseDir, extension, migrationName, script, }: WriteMigrationScriptInput): Promise<void>;
15
+ type WriteMigrationLockfileInput = {
16
+ baseDir: string;
17
+ connectorType: ActiveConnectorType;
18
+ lockfile: Omit<MigrateTypes.MigrationLockfile, 'content'>;
19
+ };
20
+ export declare function writeMigrationLockfile({ baseDir, connectorType, lockfile }: WriteMigrationLockfileInput): Promise<void>;
21
+ export {};
@@ -1,3 +1,4 @@
1
+ import { DataSource } from '@prisma/generator';
1
2
  import type { DatabaseCredentials } from '@prisma/internals';
2
3
  import { ConnectorType } from './printDatasources';
3
4
  export type MigrateAction = 'create' | 'apply' | 'unapply' | 'dev' | 'push';
@@ -12,12 +13,9 @@ export type DatasourceInfo = {
12
13
  schemas?: string[];
13
14
  configDir?: string;
14
15
  };
15
- export declare function getDatasourceInfo({ schemaPath, throwIfEnvError, }?: {
16
- schemaPath?: string;
17
- throwIfEnvError?: boolean;
18
- }): Promise<DatasourceInfo>;
19
- export declare function ensureCanConnectToDatabase(schemaPath?: string): Promise<Boolean | Error>;
20
- export declare function ensureDatabaseExists(action: MigrateAction, schemaPath?: string): Promise<string | undefined>;
16
+ export declare function parseDatasourceInfo(datasource: DataSource | undefined): DatasourceInfo;
17
+ export declare function ensureCanConnectToDatabase(datasource: DataSource | undefined): Promise<Boolean | Error>;
18
+ export declare function ensureDatabaseExists(datasource: DataSource | undefined): Promise<string | undefined>;
21
19
  export declare function getDbLocation(credentials: DatabaseCredentials): string | undefined;
22
20
  /**
23
21
  * Return a pretty version of a "provider" (with uppercase characters)
@@ -1,4 +1,5 @@
1
- import { SqlQueryOutput } from '@prisma/generator-helper';
1
+ import { SqlQueryOutput } from '@prisma/generator';
2
+ import { SchemaContext } from '@prisma/internals';
2
3
  import { EngineArgs } from '../types';
3
4
  export interface IntrospectSqlInput extends EngineArgs.SqlQueryInput {
4
5
  fileName: string;
@@ -14,4 +15,4 @@ export type IntrospectSqlResult = {
14
15
  ok: false;
15
16
  errors: IntrospectSqlError[];
16
17
  };
17
- export declare function introspectSql(schemaPath: string | undefined, queries: IntrospectSqlInput[]): Promise<IntrospectSqlResult>;
18
+ export declare function introspectSql(schemaContext: SchemaContext, queries: IntrospectSqlInput[]): Promise<IntrospectSqlResult>;
@@ -0,0 +1,9 @@
1
+ import type { MigrateTypes } from '@prisma/internals';
2
+ /**
3
+ * Lists migrations present in the migrations directory, sorted lexicographically by name.
4
+ * Returns an empty array if the directory doesn't exist.
5
+ *
6
+ * @param migrationsDirectoryPath Absolute path to the migrations directory
7
+ * @returns Promise resolving to a sorted list of migrations
8
+ */
9
+ export declare function listMigrations(migrationsDirectoryPath: string): Promise<MigrateTypes.MigrationList>;
@@ -1,4 +1,4 @@
1
- import type { ConnectorType } from '@prisma/generator-helper';
1
+ import type { ConnectorType } from '@prisma/generator';
2
2
  export type { ConnectorType };
3
3
  export interface GeneratorConfig {
4
4
  name: string;
@@ -1,7 +1,5 @@
1
- export declare function verifySeedConfigAndReturnMessage(schemaPath: string | null): Promise<string | undefined>;
2
1
  export declare function getSeedCommandFromPackageJson(cwd: string): Promise<string | null>;
3
2
  export declare function executeSeedCommand({ commandFromConfig, extraArgs, }: {
4
3
  commandFromConfig: string;
5
4
  extraArgs?: string;
6
5
  }): Promise<boolean>;
7
- export declare function legacyTsNodeScriptWarning(): Promise<undefined>;
@@ -5,7 +5,7 @@ export interface IntrospectionViewDefinition {
5
5
  }
6
6
  type HandleViewsIOParams = {
7
7
  views: IntrospectionViewDefinition[];
8
- schemaPath: string;
8
+ viewsDirectoryPath: string;
9
9
  };
10
10
  /**
11
11
  * For any given view definitions, the CLI must either create or update the corresponding view definition files
@@ -13,5 +13,5 @@ type HandleViewsIOParams = {
13
13
  * If some other non ".sql" files or folders exist within the `views` directory, the CLI must preserve them.
14
14
  * In case of empty folders, these are deleted silently.
15
15
  */
16
- export declare function handleViewsIO({ views, schemaPath }: HandleViewsIOParams): Promise<void>;
16
+ export declare function handleViewsIO({ views, viewsDirectoryPath }: HandleViewsIOParams): Promise<void>;
17
17
  export {};