Skip to content

Commit

Permalink
::migrate:: Tmp migration will be reverted
Browse files Browse the repository at this point in the history
  • Loading branch information
istarkov committed May 1, 2024
1 parent cf46142 commit a88339a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/prisma-client/migrations-cli/prisma-migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ export const resetDatabase = async () => {
await $`"prisma migrate diff --from-schema-datasource ${schemaFilePath} --to-empty --script`;

await $({
env: process.env,
verbose: true,
cwd: prismaDir,
input: sqlToDeleteEverything,
})`prisma db execute --stdin --schema ${schemaFilePath}`;

Expand All @@ -262,14 +265,21 @@ export const resetDatabase = async () => {

// https://www.prisma.io/docs/reference/api-reference/command-reference#migrate-diff
export const cliDiff = async () => {
const { stdout } =
await $`prisma migrate diff --from-schema-datasource ${schemaFilePath} --to-schema-datamodel ${schemaFilePath} --script`;
const { stdout } = await $({
env: process.env,
verbose: true,
cwd: prismaDir,
})`prisma migrate diff --from-schema-datasource ${schemaFilePath} --to-schema-datamodel ${schemaFilePath} --script`;
return stdout;
};

// https://www.prisma.io/docs/reference/api-reference/command-reference#db-execute
export const cliExecute = async (filePath: string) => {
await $`prisma db execute --file ${filePath} --schema ${schemaFilePath}`;
await $({
env: process.env,
verbose: true,
cwd: prismaDir,
})`prisma db execute --file ${filePath} --schema ${schemaFilePath}`;
};

export const generateMigrationClient = async (migrationName: string) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SELECT 1;

0 comments on commit a88339a

Please sign in to comment.