stepwise-migrations 1.0.18 → 1.0.19
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/.github/workflows/test.yml +1 -2
- package/README.md +1 -1
- package/dist/test/index.test.js +8 -1
- package/package.json +1 -1
- package/src/utils.ts +11 -4
- package/test/index.test.ts +12 -1
- package/test/migrations-invalid/v1_first.sql +6 -1
@@ -14,7 +14,7 @@ jobs:
|
|
14
14
|
|
15
15
|
strategy:
|
16
16
|
matrix:
|
17
|
-
node-version: [18.x, 20.x, 22.x]
|
17
|
+
node-version: [18.x, 20.x, 22.x, 23.x]
|
18
18
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
19
19
|
|
20
20
|
steps:
|
@@ -29,7 +29,6 @@ jobs:
|
|
29
29
|
uses: actions/setup-node@v4
|
30
30
|
with:
|
31
31
|
node-version: ${{ matrix.node-version }}
|
32
|
-
cache: "npm"
|
33
32
|
- run: npm ci
|
34
33
|
- run: npm run build
|
35
34
|
- run: npm test
|
package/README.md
CHANGED
@@ -70,7 +70,7 @@ Options:
|
|
70
70
|
--schema <schema> The schema to use for the migrations
|
71
71
|
--path <path> The path to the migrations directory
|
72
72
|
--ssl true/false Whether to use SSL for the connection (default: false)
|
73
|
-
--napply
|
73
|
+
--napply Number of up migrations to apply (default: all)
|
74
74
|
--nundo Number of undo migrations to apply (default: 1)
|
75
75
|
--filename The filename to get the script for (default: last applied migration)
|
76
76
|
|
package/dist/test/index.test.js
CHANGED
@@ -110,7 +110,7 @@ node_test_1.describe.only("invalid migrations", () => __awaiter(void 0, void 0,
|
|
110
110
|
recursive: true,
|
111
111
|
});
|
112
112
|
}));
|
113
|
-
node_test_1.it
|
113
|
+
(0, node_test_1.it)("missing undo migration", () => __awaiter(void 0, void 0, void 0, function* () {
|
114
114
|
(0, utils_1.assertIncludesAll)(yield executeCommand("migrate", paths.invalid), [
|
115
115
|
"All done!",
|
116
116
|
]);
|
@@ -126,4 +126,11 @@ node_test_1.describe.only("invalid migrations", () => __awaiter(void 0, void 0,
|
|
126
126
|
"Versioned migration v1_first.sql has been altered. Cannot migrate in current state.",
|
127
127
|
]);
|
128
128
|
}));
|
129
|
+
node_test_1.it.only("bad creds", () => __awaiter(void 0, void 0, void 0, function* () {
|
130
|
+
(0, utils_1.assertIncludesAll)(yield (0, utils_1.execute)(`npm exec stepwise-migrations info -- \\
|
131
|
+
--connection=postgresql://postgres:badpassword@127.0.0.1:5432/mydb \\
|
132
|
+
--schema=${schema} \\
|
133
|
+
--path=${paths.invalid}
|
134
|
+
`), ["password authentication failed for user"]);
|
135
|
+
}));
|
129
136
|
}));
|
package/package.json
CHANGED
package/src/utils.ts
CHANGED
@@ -14,26 +14,33 @@ Usage: stepwise-migrations [command] [options]
|
|
14
14
|
Commands:
|
15
15
|
migrate
|
16
16
|
Migrate the database to the latest version
|
17
|
-
|
17
|
+
undo
|
18
18
|
Rollback the database to the previous version
|
19
|
+
validate
|
20
|
+
Validate the migration files and the stepwise_migration_events table
|
21
|
+
audit
|
22
|
+
Show the audit history for the migrations in the database
|
19
23
|
info
|
20
24
|
Show information about the current state of the migrations in the database
|
21
25
|
drop
|
22
|
-
Drop
|
26
|
+
Drop all tables, schema and stepwise_migration_events table
|
27
|
+
get-applied-script
|
28
|
+
Get the script for the last applied migration
|
23
29
|
|
24
30
|
Options:
|
25
31
|
--connection <connection> The connection string to use to connect to the database
|
26
32
|
--schema <schema> The schema to use for the migrations
|
27
33
|
--path <path> The path to the migrations directory
|
28
34
|
--ssl true/false Whether to use SSL for the connection (default: false)
|
29
|
-
--napply
|
35
|
+
--napply Number of up migrations to apply (default: all)
|
30
36
|
--nundo Number of undo migrations to apply (default: 1)
|
37
|
+
--filename The filename to get the script for (default: last applied migration)
|
31
38
|
|
32
39
|
Example:
|
33
40
|
npx stepwise-migrations migrate \\
|
34
41
|
--connection=postgresql://postgres:postgres@127.0.0.1:5432/mydatabase \\
|
35
42
|
--schema=myschema \\
|
36
|
-
--path=./
|
43
|
+
--path=./test/migrations-template/
|
37
44
|
`;
|
38
45
|
|
39
46
|
export const validateArgs = (argv: any) => {
|
package/test/index.test.ts
CHANGED
@@ -136,7 +136,7 @@ describe.only("invalid migrations", async () => {
|
|
136
136
|
});
|
137
137
|
});
|
138
138
|
|
139
|
-
it
|
139
|
+
it("missing undo migration", async () => {
|
140
140
|
assertIncludesAll(await executeCommand("migrate", paths.invalid), [
|
141
141
|
"All done!",
|
142
142
|
]);
|
@@ -163,4 +163,15 @@ describe.only("invalid migrations", async () => {
|
|
163
163
|
"Versioned migration v1_first.sql has been altered. Cannot migrate in current state.",
|
164
164
|
]);
|
165
165
|
});
|
166
|
+
|
167
|
+
it.only("bad creds", async () => {
|
168
|
+
assertIncludesAll(
|
169
|
+
await execute(`npm exec stepwise-migrations info -- \\
|
170
|
+
--connection=postgresql://postgres:badpassword@127.0.0.1:5432/mydb \\
|
171
|
+
--schema=${schema} \\
|
172
|
+
--path=${paths.invalid}
|
173
|
+
`),
|
174
|
+
["password authentication failed for user"]
|
175
|
+
);
|
176
|
+
});
|
166
177
|
});
|