File tree Expand file tree Collapse file tree 2 files changed +21
-7
lines changed
Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change 1313 "lint" : " eslint --fix --ext .ts src" ,
1414 "db:generate" : " node runWithProvider.js \" npx prisma generate --schema ./prisma/DATABASE_PROVIDER-schema.prisma\" " ,
1515 "db:deploy" : " node runWithProvider.js \" rm -rf ./prisma/migrations && cp -r ./prisma/DATABASE_PROVIDER-migrations ./prisma/migrations && npx prisma migrate deploy --schema ./prisma/DATABASE_PROVIDER-schema.prisma\" " ,
16+ "db:deploy:win" : " node runWithProvider.js \" xcopy /E /I prisma\\ DATABASE_PROVIDER-migrations prisma\\ migrations && npx prisma migrate deploy --schema prisma\\ DATABASE_PROVIDER-schema.prisma\" " ,
1617 "db:studio" : " node runWithProvider.js \" npx prisma studio --schema ./prisma/DATABASE_PROVIDER-schema.prisma\" " ,
17- "db:migrate:dev" : " node runWithProvider.js \" rm -rf ./prisma/migrations && cp -r ./prisma/DATABASE_PROVIDER-migrations ./prisma/migrations && npx prisma migrate dev --schema ./prisma/DATABASE_PROVIDER-schema.prisma && cp -r ./prisma/migrations/* ./prisma/DATABASE_PROVIDER-migrations\" "
18+ "db:migrate:dev" : " node runWithProvider.js \" rm -rf ./prisma/migrations && cp -r ./prisma/DATABASE_PROVIDER-migrations ./prisma/migrations && npx prisma migrate dev --schema ./prisma/DATABASE_PROVIDER-schema.prisma && cp -r ./prisma/migrations/* ./prisma/DATABASE_PROVIDER-migrations\" " ,
19+ "db:migrate:dev:win" : " node runWithProvider.js \" xcopy /E /I prisma\\ DATABASE_PROVIDER-migrations prisma\\ migrations && npx prisma migrate dev --schema prisma\\ DATABASE_PROVIDER-schema.prisma\" "
1820 },
1921 "repository" : {
2022 "type" : " git" ,
115117 "tsconfig-paths" : " ^4.2.0" ,
116118 "typescript" : " ^5.5.4"
117119 }
118- }
120+ }
Original file line number Diff line number Diff line change 11const dotenv = require ( 'dotenv' ) ;
22const { execSync } = require ( 'child_process' ) ;
3+ const { existsSync } = require ( 'fs' ) ;
4+
35dotenv . config ( ) ;
46
57const { DATABASE_PROVIDER } = process . env ;
6- const databaseProviderDefault = DATABASE_PROVIDER ?? " postgresql"
8+ const databaseProviderDefault = DATABASE_PROVIDER ?? ' postgresql' ;
79
810if ( ! DATABASE_PROVIDER ) {
9- console . error ( `DATABASE_PROVIDER is not set in the .env file, using default: ${ databaseProviderDefault } ` ) ;
10- // process.exit(1);
11+ console . warn ( `DATABASE_PROVIDER is not set in the .env file, using default: ${ databaseProviderDefault } ` ) ;
1112}
1213
13- const command = process . argv
14+ let command = process . argv
1415 . slice ( 2 )
1516 . join ( ' ' )
16- . replace ( / \D A T A B A S E _ P R O V I D E R / g, databaseProviderDefault ) ;
17+ . replace ( / D A T A B A S E _ P R O V I D E R / g, databaseProviderDefault ) ;
18+
19+ if ( command . includes ( 'rmdir' ) && existsSync ( 'prisma\\migrations' ) ) {
20+ try {
21+ execSync ( 'rmdir /S /Q prisma\\migrations' , { stdio : 'inherit' } ) ;
22+ } catch ( error ) {
23+ console . error ( `Error removing directory: prisma\\migrations` ) ;
24+ process . exit ( 1 ) ;
25+ }
26+ } else if ( command . includes ( 'rmdir' ) ) {
27+ console . warn ( `Directory 'prisma\\migrations' does not exist, skipping removal.` ) ;
28+ }
1729
1830try {
1931 execSync ( command , { stdio : 'inherit' } ) ;
You can’t perform that action at this time.
0 commit comments