diff --git a/src/migrations/migration.data.ts b/src/migrations/migration.data.ts index a99bd4e99eb31bb9d9ebb7b60e9c745cc1038df1..c49f9a02b5eaa9fcf97063d44ad4a69c396392ae 100644 --- a/src/migrations/migration.data.ts +++ b/src/migrations/migration.data.ts @@ -288,6 +288,7 @@ export const migrations: Migration[] = [ releaseNotes: null, docTypes: FLUIDPRICES_DOCTYPE, isCreate: true, + isDeprecated: true, run: async (_client: Client, docs: any[]): Promise<any> => { return null }, @@ -497,9 +498,9 @@ export const migrations: Migration[] = [ description: 'Init new fluidPrices for water -- deprecated --', releaseNotes: null, docTypes: FLUIDPRICES_DOCTYPE, - + isDeprecated: true, run: async (_client: Client, docs: any[]): Promise<any> => { - return null + return {} }, }, { diff --git a/src/migrations/migration.ts b/src/migrations/migration.ts index 6dfe010f6526d38de1c8bfce281de623acb3f1d4..fa923665f993f3c094fdea6a95395a7e1fe1f7bd 100644 --- a/src/migrations/migration.ts +++ b/src/migrations/migration.ts @@ -143,7 +143,9 @@ export async function migrate( migration.docTypes, migration.queryOptions ) - if (docToUpdate.length && !migration.isCreate) { + if (migration.isDeprecated) { + result = migrationNoop() + } else if (docToUpdate.length && !migration.isCreate) { const migratedDocs = await migration.run(_client, docToUpdate) if (migratedDocs.length) { result = await save(_client, migratedDocs) @@ -155,7 +157,7 @@ export async function migrate( } // Handle new doctype creation - if (migration.isCreate) { + if (migration.isCreate && !migration.isDeprecated) { await migration.run(_client, docToUpdate) result = { type: MIGRATION_RESULT_COMPLETE, errors: [] } } diff --git a/src/migrations/migration.type.ts b/src/migrations/migration.type.ts index 84ebe24e5da9640799cecf99296f13018944727d..505363b2f1ec2dc3a33e373f3473742fcd48478e 100644 --- a/src/migrations/migration.type.ts +++ b/src/migrations/migration.type.ts @@ -28,6 +28,7 @@ export type Migration = { releaseNotes: Notes | null docTypes: string isCreate?: boolean + isDeprecated?: boolean queryOptions?: MigrationQueryOptions appVersion: string run: (_client: Client, docs: any[]) => Promise<any[]>