Skip to content

Commit

Permalink
filter out streams-event-id from migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
codyseibert committed Jun 23, 2023
1 parent eb7f38d commit 35be6c6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jest.mock('./migrationsToRun', () => ({
],
}));

const { migrationsToRun } = require('./migrationsToRun');

const mockValidationMigration = jest.fn();
jest.mock('./migrations/0000-validate-all-items', () => ({
migrateItems: mockValidationMigration,
Expand Down Expand Up @@ -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,
}),
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 35be6c6

Please sign in to comment.