@oliasoft-open-source/node-json-migrator 5.4.0-beta-1 → 5.4.1-beta-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/README.md +12 -0
- package/dist/index.d.mts +10 -9
- package/dist/index.mjs +1379 -1360
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -155,6 +155,18 @@ Or, you can backfit a script earlier in the sequence
|
|
|
155
155
|
- set its sequence to for example `1.1` (subsequence number)
|
|
156
156
|
- the backfitted script _will_ execute one time on all payloads
|
|
157
157
|
|
|
158
|
+
## Checking migration plans in CI
|
|
159
|
+
|
|
160
|
+
`checkMigrationPlan({ directory })` checks that `plan.json` matches the migration files, including hashes and
|
|
161
|
+
active scripts missing from the plan. It throws on an invalid or outdated plan. It does not access a database,
|
|
162
|
+
execute migration scripts, or modify files. JSON formatting differences are ignored.
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
import { checkMigrationPlan } from '@oliasoft-open-source/node-json-migrator';
|
|
166
|
+
|
|
167
|
+
await checkMigrationPlan({ directory: './migrations' });
|
|
168
|
+
```
|
|
169
|
+
|
|
158
170
|
# How to contribute
|
|
159
171
|
|
|
160
172
|
Contribution is welcome via [issue tickets](https://gitlab.com/oliasoft-open-source/node-json-migrator/-/issues)
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { IDatabase, IHelpers, ITask } from "pg-promise";
|
|
2
2
|
|
|
3
|
+
//#region src/plan/check-migration-plan.d.ts
|
|
4
|
+
/** Check the committed plan against migration files without modifying files or accessing a database. */
|
|
5
|
+
declare const checkMigrationPlan: ({
|
|
6
|
+
directory
|
|
7
|
+
}: {
|
|
8
|
+
directory: string;
|
|
9
|
+
}) => Promise<void>;
|
|
10
|
+
//#endregion
|
|
3
11
|
//#region src/create/create.d.ts
|
|
4
12
|
/**
|
|
5
13
|
* Generate a new entity migration
|
|
@@ -100,7 +108,6 @@ declare const getPlannedMigrations: ({
|
|
|
100
108
|
}[];
|
|
101
109
|
nextVersion: string;
|
|
102
110
|
}>;
|
|
103
|
-
type TPreparedPlan = Awaited<ReturnType<typeof getPlannedMigrations>>;
|
|
104
111
|
//#endregion
|
|
105
112
|
//#region src/plan/planned-version.d.ts
|
|
106
113
|
declare const getPlannedVersion: ({
|
|
@@ -112,21 +119,15 @@ declare const getPlannedVersion: ({
|
|
|
112
119
|
//#region src/migrate/migrate.d.ts
|
|
113
120
|
/**
|
|
114
121
|
* Migrates a payload
|
|
115
|
-
*
|
|
116
|
-
* There are two ways to use this function:
|
|
117
|
-
* i) function looks up the pending migrations for you (default)
|
|
118
|
-
* ii) reuse a prepared plan while resolving pending migrations for the current payload version
|
|
119
122
|
*/
|
|
120
123
|
declare const migrate: ({
|
|
121
124
|
payload,
|
|
122
125
|
config,
|
|
123
|
-
metaData
|
|
124
|
-
preparedPlan
|
|
126
|
+
metaData
|
|
125
127
|
}: {
|
|
126
128
|
payload: TPayload;
|
|
127
129
|
config: TConfig;
|
|
128
130
|
metaData?: TMetaData;
|
|
129
|
-
preparedPlan?: TPreparedPlan;
|
|
130
131
|
}) => Promise<{
|
|
131
132
|
nextPayload: TPayload;
|
|
132
133
|
nextVersion: string;
|
|
@@ -171,4 +172,4 @@ declare const printVersionHistory: ({
|
|
|
171
172
|
config: TConfig;
|
|
172
173
|
}) => Promise<void>;
|
|
173
174
|
//#endregion
|
|
174
|
-
export { type TAfterMigrateRecord, type TAfterMigrateRecordPayload, type TBeforeMigrateRecord, type TBeforeMigrateRecordPayload, type TConfig, type TEntityColumnNames, type TMetaData, type TMigration, type TMigrationErrorPayload, type TOnMigrationErrors, type TOnMigrationErrorsPayload, type TPayload, type TPlan, type TPlanEntry, type TRecord, type TRecordDetails, type TRecordDetailsList, createMigration, getPlannedMigrations, getPlannedVersion, getVersions, migrate, migrateAll, pipe, printVersionHistory };
|
|
175
|
+
export { type TAfterMigrateRecord, type TAfterMigrateRecordPayload, type TBeforeMigrateRecord, type TBeforeMigrateRecordPayload, type TConfig, type TEntityColumnNames, type TMetaData, type TMigration, type TMigrationErrorPayload, type TOnMigrationErrors, type TOnMigrationErrorsPayload, type TPayload, type TPlan, type TPlanEntry, type TRecord, type TRecordDetails, type TRecordDetailsList, checkMigrationPlan, createMigration, getPlannedMigrations, getPlannedVersion, getVersions, migrate, migrateAll, pipe, printVersionHistory };
|