diff --git a/web-api/workflow-terraform/migration/main/lambdas/migration-segments.js b/web-api/workflow-terraform/migration/main/lambdas/migration-segments.js index 7b35c3a5257..33d98fad0cc 100644 --- a/web-api/workflow-terraform/migration/main/lambdas/migration-segments.js +++ b/web-api/workflow-terraform/migration/main/lambdas/migration-segments.js @@ -100,6 +100,10 @@ exports.processItems = async ( applicationContext, { documentClient, items, ranMigrations, segment }, ) => { + items = items.filter(item => { + return !item.pk.startsWith('streams-event-id'); + }); + try { items = await exports.migrateRecords(applicationContext, { documentClient, diff --git a/web-api/workflow-terraform/migration/main/lambdas/migration-segments.test.js b/web-api/workflow-terraform/migration/main/lambdas/migration-segments.test.js index e70d29a22d2..953417ec449 100644 --- a/web-api/workflow-terraform/migration/main/lambdas/migration-segments.test.js +++ b/web-api/workflow-terraform/migration/main/lambdas/migration-segments.test.js @@ -44,6 +44,8 @@ jest.mock('./migrationsToRun', () => ({ ], })); +const { migrationsToRun } = require('./migrationsToRun'); + const mockValidationMigration = jest.fn(); jest.mock('./migrations/0000-validate-all-items', () => ({ migrateItems: mockValidationMigration, @@ -95,6 +97,10 @@ describe('migration-segments', () => { pk: 'case|101-20', sk: 'case|101-20', }, + { + pk: 'streams-event-id|abc123', + sk: 'streams-event-id|abc123', + }, ], LastEvaluatedKey: null, }), @@ -147,6 +153,14 @@ describe('migration-segments', () => { ); }); + it('should not try to migrate streams-event-id to the new table', async () => { + await handler(mockLambdaEvent, mockLambdaContext); + + expect(migrationsToRun[0].script.mock.calls[0][0]).toEqual([ + { pk: 'case|101-20', sk: 'case|101-20' }, + ]); + }); + it('should NOT throw an error when an error occurs while attempting to calculate a record`s size', async () => { mockGetRecordSize.mockImplementation(() => { throw new Error();