@rws-framework/db 3.3.0 → 3.3.1

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.
@@ -34,7 +34,7 @@ class DbHelper {
34
34
  }
35
35
  static async migrateDBModels(configService, dbService, leaveFile = false) {
36
36
  process.env = { ...process.env, [this.dbUrlVarName]: configService.get('db_url') };
37
- const [_, schemaPath] = db_1.DbUtils.getSchemaDir();
37
+ const [_, schemaPath] = db_1.DbUtils.getProcessedSchemaDir();
38
38
  await console_1.rwsShell.runCommand(`${db_1.DbUtils.detectInstaller()} prisma migrate dev --create-only --schema=${schemaPath}`, process.cwd());
39
39
  }
40
40
  /**
@@ -298,7 +298,7 @@ datasource db {
298
298
  */
299
299
  static async pushDBModels(configService, dbService, leaveFile = false) {
300
300
  process.env = { ...process.env, [this.dbUrlVarName]: configService.get('db_url') };
301
- const [_, schemaPath] = utils_1.DbUtils.getSchemaDir();
301
+ const [_, schemaPath] = utils_1.DbUtils.getProcessedSchemaDir();
302
302
  await console_1.rwsShell.runCommand(`${utils_1.DbUtils.detectInstaller()} prisma db push --schema=${schemaPath}`, process.cwd());
303
303
  }
304
304
  }
@@ -8,6 +8,7 @@ export declare class DbUtils {
8
8
  * Get the directory and path for the Prisma schema file
9
9
  */
10
10
  static getSchemaDir(): [string, string];
11
+ static getProcessedSchemaDir(): [string, string];
11
12
  /**
12
13
  * Detect the package installer (yarn or npx)
13
14
  */
@@ -22,6 +22,11 @@ class DbUtils {
22
22
  const schemaPath = path_1.default.join(schemaDir, 'schema.prisma');
23
23
  return [schemaDir, schemaPath];
24
24
  }
25
+ static getProcessedSchemaDir() {
26
+ const schemaDir = path_1.default.join(workspaceRoot, 'node_modules', '.prisma', 'client');
27
+ const schemaPath = path_1.default.join(schemaDir, 'schema.prisma');
28
+ return [schemaDir, schemaPath];
29
+ }
25
30
  /**
26
31
  * Detect the package installer (yarn or npx)
27
32
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rws-framework/db",
3
3
  "private": false,
4
- "version": "3.3.0",
4
+ "version": "3.3.1",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -46,7 +46,7 @@ export class DbHelper {
46
46
  static async migrateDBModels(configService: IDbConfigHandler, dbService: DBService, leaveFile = false): Promise<void> {
47
47
  process.env = { ...process.env, [this.dbUrlVarName]: configService.get('db_url') };
48
48
 
49
- const [_, schemaPath] = DbUtils.getSchemaDir();
49
+ const [_, schemaPath] = DbUtils.getProcessedSchemaDir();
50
50
 
51
51
  await rwsShell.runCommand(`${DbUtils.detectInstaller()} prisma migrate dev --create-only --schema=${schemaPath}`, process.cwd());
52
52
  }
@@ -383,7 +383,7 @@ datasource db {
383
383
  static async pushDBModels(configService: IDbConfigHandler, dbService: DBService, leaveFile = false): Promise<void> {
384
384
  process.env = { ...process.env, [this.dbUrlVarName]: configService.get('db_url') };
385
385
 
386
- const [_, schemaPath] = DbUtils.getSchemaDir();
386
+ const [_, schemaPath] = DbUtils.getProcessedSchemaDir();
387
387
 
388
388
  await rwsShell.runCommand(`${DbUtils.detectInstaller()} prisma db push --schema=${schemaPath}`, process.cwd());
389
389
  }
@@ -24,6 +24,13 @@ export class DbUtils {
24
24
  return [schemaDir, schemaPath];
25
25
  }
26
26
 
27
+ static getProcessedSchemaDir(): [string, string] {
28
+ const schemaDir = path.join(workspaceRoot, 'node_modules','.prisma', 'client');
29
+ const schemaPath = path.join(schemaDir, 'schema.prisma');
30
+
31
+ return [schemaDir, schemaPath];
32
+ }
33
+
27
34
  /**
28
35
  * Detect the package installer (yarn or npx)
29
36
  */