@prisma/migrate 6.6.0-dev.4 → 6.6.0-dev.40

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 (123) 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 +48 -47
  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-V3ZMNXZC.js → chunk-5LKIRKDL.js} +307 -382
  11. package/dist/{chunk-IR55GBON.js → chunk-5LTDMS3H.js} +18 -18
  12. package/dist/{chunk-LOGAFLCN.js → chunk-5R44VVVX.js} +29 -29
  13. package/dist/{chunk-ZYKVWZ6H.js → chunk-6UMA6TED.js} +347 -369
  14. package/dist/{chunk-DJMFXNR4.js → chunk-74LUB4XX.js} +56 -57
  15. package/dist/{chunk-RP2N6UXA.js → chunk-AI6DH66U.js} +6 -6
  16. package/dist/{chunk-G2XUUMKH.js → chunk-B4SUSDC2.js} +31 -39
  17. package/dist/{chunk-Q3ZLC44N.js → chunk-CKRN45WP.js} +57 -66
  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-N3KYWSX2.js → chunk-GAKKKF5T.js} +55 -49
  22. package/dist/{chunk-N4XTKFY6.js → chunk-GKHRL6AR.js} +39 -38
  23. package/dist/{chunk-CQZFVAXC.js → chunk-HHVLUI3H.js} +42 -41
  24. package/dist/{chunk-MCWCB2AX.js → chunk-IINN7QUV.js} +170 -643
  25. package/dist/{chunk-HCBZB4XC.js → chunk-KN2W5IP7.js} +53 -52
  26. package/dist/{chunk-255BRND3.js → chunk-KRQEFTDT.js} +6 -6
  27. package/dist/{chunk-VVKOFN3Y.js → chunk-LLO7YF56.js} +44 -46
  28. package/dist/{chunk-VZ23KD5C.js → chunk-NGQA5JTN.js} +8 -10
  29. package/dist/{chunk-MKK3GSDF.js → chunk-NIKXBMZL.js} +5 -5
  30. package/dist/{chunk-KS7IEA6Z.js → chunk-O723A5JE.js} +50 -52
  31. package/dist/{chunk-MATFO4ZW.js → chunk-OEWQACEH.js} +38 -39
  32. package/dist/chunk-PDCXVUV3.js +883 -0
  33. package/dist/{chunk-WI2A2TQE.js → chunk-QJT4H5N6.js} +91 -92
  34. package/dist/{chunk-V5TUSOJX.js → chunk-SQKGZVG3.js} +45 -45
  35. package/dist/{chunk-EGPJABTW.js → chunk-TGV6QGEF.js} +69 -69
  36. package/dist/chunk-URKH6SE2.js +479 -0
  37. package/dist/chunk-V6PVGSDJ.js +76 -0
  38. package/dist/{chunk-DLLXDCI2.js → chunk-VAJ4VX67.js} +5 -6
  39. package/dist/{chunk-OCQGHQED.js → chunk-YBX7R3MT.js} +12 -12
  40. package/dist/{chunk-A6PMXMMT.js → chunk-ZB5NPOJW.js} +13 -13
  41. package/dist/{chunk-2JZLJQDC.js → chunk-ZRHBLHAM.js} +346 -368
  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 +12 -11
  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 +52 -50
  56. package/dist/internals/src/cli/checkUnsupportedDataProxy.d.ts +12 -17
  57. package/dist/internals/src/cli/directoryConfig.d.ts +7 -0
  58. package/dist/internals/src/cli/schemaContext.d.ts +58 -0
  59. package/dist/internals/src/engine-commands/getConfig.d.ts +0 -4
  60. package/dist/internals/src/engine-commands/getDmmf.d.ts +1 -5
  61. package/dist/internals/src/engine-commands/lintSchema.d.ts +1 -1
  62. package/dist/internals/src/errorReporting.d.ts +0 -1
  63. package/dist/internals/src/get-generators/getGenerators.d.ts +7 -3
  64. package/dist/internals/src/index.d.ts +3 -1
  65. package/dist/internals/src/migrateTypes.d.ts +63 -0
  66. package/dist/internals/src/panic.d.ts +1 -4
  67. package/dist/internals/src/utils/extractPreviewFeatures.d.ts +2 -2
  68. package/dist/internals/src/utils/schemaFileInput.d.ts +0 -4
  69. package/dist/internals/src/utils/toSchemasContainer.d.ts +2 -3
  70. package/dist/migrate/src/Migrate.d.ts +7 -5
  71. package/dist/migrate/src/SchemaEngine.d.ts +5 -9
  72. package/dist/migrate/src/types.d.ts +14 -10
  73. package/dist/migrate/src/utils/createMigration.d.ts +21 -0
  74. package/dist/migrate/src/utils/ensureDatabaseExists.d.ts +4 -6
  75. package/dist/migrate/src/utils/introspectSql.d.ts +2 -1
  76. package/dist/migrate/src/utils/listMigrations.d.ts +9 -0
  77. package/dist/migrate/src/utils/seed.d.ts +0 -2
  78. package/dist/migrate/src/views/handleViewsIO.d.ts +2 -2
  79. package/dist/{multipart-parser-54WEFGGN-NLZG56KM.js → multipart-parser-ASKQAOL4-WZ47HU6G.js} +92 -125
  80. package/dist/{multipart-parser-NDLECNMN.js → multipart-parser-QCI3Y5IB.js} +66 -68
  81. package/dist/types.js +1 -1
  82. package/dist/{typescript-WN4QH2CP.js → typescript-2LKASCMC.js} +33 -33
  83. package/dist/{typescript-AILDXN3I.js → typescript-H3AVJ6KX.js} +32 -32
  84. package/dist/utils/byline.js +1 -1
  85. package/dist/utils/captureStdout.js +3 -3
  86. package/dist/utils/countModelsAndTypes.js +1 -1
  87. package/dist/utils/createMigration.js +27 -0
  88. package/dist/utils/customColors.js +1 -1
  89. package/dist/utils/ensureDatabaseExists.js +7 -7
  90. package/dist/utils/errors.js +1 -1
  91. package/dist/utils/flagErrors.js +1 -1
  92. package/dist/utils/getDatabaseVersionSafe.js +5 -5
  93. package/dist/utils/getSchemaPathAndPrint.js +1 -1
  94. package/dist/utils/handleEvaluateDataloss.js +1 -1
  95. package/dist/utils/introspectSql.js +5 -5
  96. package/dist/utils/isSchemaEmpty.js +1 -1
  97. package/dist/utils/listMigrations.js +25 -0
  98. package/dist/utils/now.js +1 -1
  99. package/dist/utils/printDatasource.js +1 -1
  100. package/dist/utils/printDatasources.js +5 -5
  101. package/dist/utils/printFiles.js +5 -5
  102. package/dist/utils/printIntrospectedSchema.js +1 -1
  103. package/dist/utils/printMigrationId.js +1 -1
  104. package/dist/utils/promptForMigrationName.js +3 -3
  105. package/dist/utils/removeSchemaFiles.js +1 -1
  106. package/dist/utils/replaceOrAddDatasource.js +1 -1
  107. package/dist/utils/replaceOrAddDatasource.test.js +1 -1
  108. package/dist/utils/saveSchemaFiles.js +1 -1
  109. package/dist/utils/seed.js +4 -7
  110. package/dist/utils/setupCockroach.js +3 -3
  111. package/dist/utils/setupMSSQL.js +759 -675
  112. package/dist/utils/setupMongo.js +552 -552
  113. package/dist/utils/setupMysql.js +508 -563
  114. package/dist/utils/setupPostgres.js +3 -3
  115. package/dist/utils/spinner.js +4 -3
  116. package/dist/utils/test-handlePanic.js +1 -30
  117. package/dist/utils/unixSocket.js +1 -1
  118. package/dist/views/handleViewsIO.js +3 -3
  119. package/package.json +9 -9
  120. package/dist/chunk-J46BJQHT.js +0 -268
  121. package/dist/chunk-KOF4LGTS.js +0 -1817
  122. package/dist/chunk-YYPMC5FN.js +0 -1407
  123. package/dist/internals/src/get-generators/utils/check-feature-flags/checkFeatureFlags.d.ts +0 -8
@@ -7,11 +7,7 @@ export interface ConfigMetaFormat {
7
7
  warnings: string[];
8
8
  }
9
9
  export type GetDMMFOptions = {
10
- datamodel?: SchemaFileInput;
11
- cwd?: string;
12
- prismaPath?: string;
13
- datamodelPath?: string;
14
- retry?: number;
10
+ datamodel: SchemaFileInput;
15
11
  previewFeatures?: string[];
16
12
  };
17
13
  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,5 +1,6 @@
1
1
  import type { BinaryTargetsEnvValue, EngineType, GeneratorConfig, SqlQueryOutput } from '@prisma/generator-helper';
2
2
  import type { BinaryTarget } from '@prisma/get-platform';
3
+ import { SchemaContext } from '..';
3
4
  import { Generator } from '../Generator';
4
5
  import type { GeneratorPaths } from './generatorResolvers/generatorResolvers';
5
6
  export type ProviderAliases = {
@@ -9,7 +10,12 @@ type BinaryPathsOverride = {
9
10
  [P in EngineType]?: string;
10
11
  };
11
12
  export type GetGeneratorOptions = {
12
- schemaPath: string;
13
+ /** @deprecated Pass a schemaContext instead. Kept for compatibility with prisma studio. */
14
+ schemaPath?: string;
15
+ schemaContext?: SchemaContext;
16
+ /**
17
+ * Aliases like `prisma-client-js` -> `node_modules/@prisma/client/generator-build/index.js`
18
+ */
13
19
  providerAliases?: ProviderAliases;
14
20
  cliVersion?: string;
15
21
  version?: string;
@@ -27,8 +33,6 @@ export type GetGeneratorOptions = {
27
33
  * Makes sure that all generators have the binaries they deserve and returns a
28
34
  * `Generator` class per generator defined in the schema.prisma file.
29
35
  * 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
36
  */
33
37
  export declare function getGenerators(options: GetGeneratorOptions): Promise<Generator[]>;
34
38
  type NeededVersions = {
@@ -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
4
  export { getPrismaConfigFromPackageJson, getSchema, getSchemaDir, type GetSchemaOptions, getSchemaWithPath, getSchemaWithPathOptional, type SchemaPathFromConfig, } 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';
@@ -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,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-helper';
2
+ export declare function extractPreviewFeatures(generators: GeneratorConfig[]): string[];
@@ -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:
@@ -1,4 +1,4 @@
1
- import type { SqlQueryOutput } from '@prisma/generator-helper';
1
+ import type { ActiveConnectorType, SqlQueryOutput } from '@prisma/generator-helper';
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-helper';
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-helper';
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
1
  import { SqlQueryOutput } from '@prisma/generator-helper';
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,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 {};