@augment-vir/node 31.19.0 → 31.20.0
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.
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
export declare function getPrismaDiff(schemaFilePath: string, env?: Record<string, string>): Promise<string>;
|
|
2
2
|
export declare function doesPrismaDiffExist(schemaFilePath: string, env?: Record<string, string>): Promise<boolean>;
|
|
3
|
-
export declare function resetDevPrismaDatabase(schemaFilePath: string,
|
|
3
|
+
export declare function resetDevPrismaDatabase(schemaFilePath: string, options: {
|
|
4
|
+
/**
|
|
5
|
+
* If you already have migrations created, set this to `true`. If you don't, set it to
|
|
6
|
+
* `false`. If you don't know which one to use, try both, see which one creates a valid
|
|
7
|
+
* database for you (try querying it with PrismaClient after running this; if it errors,
|
|
8
|
+
* this didn't create a valid database).
|
|
9
|
+
*/
|
|
10
|
+
withMigrations: boolean;
|
|
11
|
+
}, env?: Record<string, string>): Promise<void>;
|
|
@@ -17,11 +17,13 @@ export async function getPrismaDiff(schemaFilePath, env = {}) {
|
|
|
17
17
|
export async function doesPrismaDiffExist(schemaFilePath, env = {}) {
|
|
18
18
|
return !!(await getPrismaDiff(schemaFilePath, env));
|
|
19
19
|
}
|
|
20
|
-
export async function resetDevPrismaDatabase(schemaFilePath, env = {}) {
|
|
21
|
-
|
|
22
|
-
command: '
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
export async function resetDevPrismaDatabase(schemaFilePath, options, env = {}) {
|
|
21
|
+
if (options.withMigrations) {
|
|
22
|
+
await runPrismaCommand({ command: 'migrate reset --force --skip-generate --skip-seed' }, schemaFilePath, env);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
await runPrismaCommand({
|
|
26
|
+
command: 'db push --accept-data-loss --skip-generate',
|
|
27
|
+
}, schemaFilePath, env);
|
|
28
|
+
}
|
|
27
29
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@augment-vir/node",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.20.0",
|
|
4
4
|
"description": "A collection of augments, helpers types, functions, and classes only for Node.js (backend) JavaScript environments.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"augment",
|
|
@@ -38,19 +38,19 @@
|
|
|
38
38
|
"test:update": "npm test"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@augment-vir/assert": "^31.
|
|
42
|
-
"@augment-vir/common": "^31.
|
|
41
|
+
"@augment-vir/assert": "^31.20.0",
|
|
42
|
+
"@augment-vir/common": "^31.20.0",
|
|
43
43
|
"@date-vir/duration": "^7.3.1",
|
|
44
44
|
"ansi-styles": "^6.2.1",
|
|
45
45
|
"terminate": "^2.8.0",
|
|
46
46
|
"tsx": "^4.19.4",
|
|
47
47
|
"type-fest": "^4.41.0",
|
|
48
|
-
"typed-event-target": "^4.0
|
|
48
|
+
"typed-event-target": "^4.1.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@augment-vir/test": "^31.
|
|
52
|
-
"@prisma/client": "^6.
|
|
53
|
-
"@types/node": "^22.15.
|
|
51
|
+
"@augment-vir/test": "^31.20.0",
|
|
52
|
+
"@prisma/client": "^6.8.2",
|
|
53
|
+
"@types/node": "^22.15.21",
|
|
54
54
|
"@web/dev-server-esbuild": "^1.0.4",
|
|
55
55
|
"@web/test-runner": "^0.20.1",
|
|
56
56
|
"@web/test-runner-commands": "^0.9.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"c8": "^10.1.3",
|
|
60
60
|
"concurrently": "^9.1.2",
|
|
61
61
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
62
|
-
"prisma": "^6.
|
|
62
|
+
"prisma": "^6.8.2",
|
|
63
63
|
"typescript": "^5.8.3"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
@@ -29,20 +29,30 @@ export async function doesPrismaDiffExist(
|
|
|
29
29
|
|
|
30
30
|
export async function resetDevPrismaDatabase(
|
|
31
31
|
schemaFilePath: string,
|
|
32
|
+
options: {
|
|
33
|
+
/**
|
|
34
|
+
* If you already have migrations created, set this to `true`. If you don't, set it to
|
|
35
|
+
* `false`. If you don't know which one to use, try both, see which one creates a valid
|
|
36
|
+
* database for you (try querying it with PrismaClient after running this; if it errors,
|
|
37
|
+
* this didn't create a valid database).
|
|
38
|
+
*/
|
|
39
|
+
withMigrations: boolean;
|
|
40
|
+
},
|
|
32
41
|
env: Record<string, string> = {},
|
|
33
42
|
) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
command: '
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
if (options.withMigrations) {
|
|
44
|
+
await runPrismaCommand(
|
|
45
|
+
{command: 'migrate reset --force --skip-generate --skip-seed'},
|
|
46
|
+
schemaFilePath,
|
|
47
|
+
env,
|
|
48
|
+
);
|
|
49
|
+
} else {
|
|
50
|
+
await runPrismaCommand(
|
|
51
|
+
{
|
|
52
|
+
command: 'db push --accept-data-loss --skip-generate',
|
|
53
|
+
},
|
|
54
|
+
schemaFilePath,
|
|
55
|
+
env,
|
|
56
|
+
);
|
|
57
|
+
}
|
|
48
58
|
}
|