@oliasoft-open-source/node-json-migrator 5.4.0 → 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 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
@@ -164,4 +172,4 @@ declare const printVersionHistory: ({
164
172
  config: TConfig;
165
173
  }) => Promise<void>;
166
174
  //#endregion
167
- 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 };