@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.
- package/dist/helper/DbHelper.js +1 -1
- package/dist/helper/db/schema-generator.js +1 -1
- package/dist/helper/db/utils.d.ts +1 -0
- package/dist/helper/db/utils.js +5 -0
- package/package.json +1 -1
- package/src/helper/DbHelper.ts +1 -1
- package/src/helper/db/schema-generator.ts +1 -1
- package/src/helper/db/utils.ts +7 -0
package/dist/helper/DbHelper.js
CHANGED
|
@@ -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.
|
|
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.
|
|
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
|
}
|
package/dist/helper/db/utils.js
CHANGED
|
@@ -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
package/src/helper/DbHelper.ts
CHANGED
|
@@ -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.
|
|
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.
|
|
386
|
+
const [_, schemaPath] = DbUtils.getProcessedSchemaDir();
|
|
387
387
|
|
|
388
388
|
await rwsShell.runCommand(`${DbUtils.detectInstaller()} prisma db push --schema=${schemaPath}`, process.cwd());
|
|
389
389
|
}
|
package/src/helper/db/utils.ts
CHANGED
|
@@ -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
|
*/
|