Skip to content

Commit

Permalink
Fixes prisma script
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelurenah committed Nov 10, 2022
1 parent ef1025f commit 9143b51
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
Binary file modified media/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 12 additions & 16 deletions scripts/prisma-migrate-with-views-workaround.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,21 @@ console.log('Removing views from schema... Done');

try {
// Run the migration
console.log('Running `prisma migrate`... ');
console.log('Running `prisma migrate dev`... ');
const productionFlagIndex = argv.indexOf('-p');
let commandError = null;
const runProduction = productionFlagIndex > -1;
if (runProduction) argv.splice(productionFlagIndex, 1);

if (productionFlagIndex > -1) {
const { error } = spawnSync('prisma migrate deploy', spawnOptions);
commandError = error;
} else {
const nameFlagIndex = argv.indexOf('--name');
const { error } = spawnSync(
'prisma migrate dev',
nameFlagIndex > -1 ? argv.slice(nameFlagIndex) : [],
spawnOptions
);
commandError = error;
}
const nameFlagIndex = argv.indexOf('--name');
const hasName = nameFlagIndex > -1;

if (commandError) throw error;
console.log('Running `prisma migrate`... Done');
let { error } = spawnSync(
`prisma migrate ${runProduction ? 'deploy' : 'dev'}`,
hasName && !runProduction ? argv.slice(nameFlagIndex) : [],
spawnOptions
);
if (error) throw error;
console.log('Running `prisma migrate dev`... Done');

// Restore the schema
console.log('Restoring backup and running `npx prisma generate`... ');
Expand Down

0 comments on commit 9143b51

Please sign in to comment.