Skip to content

Commit

Permalink
feat: add assertion to check if staging table is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
frantzarty committed Aug 23, 2022
1 parent 488dba2 commit e2fc4da
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/utils/data-assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,11 @@ export const assertProjectRecordExists = async (

return record.dataValues;
};

export const assertStagingTableIsEmpty = async (customMessage) => {
const count = await Staging.count({ raw: true });

if (count > 0) {
throw new Error(customMessage || `Staging table is not empty.`);
}
};

0 comments on commit e2fc4da

Please sign in to comment.