Skip to content

Commit

Permalink
fix: null fix during sync
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed May 15, 2024
1 parent b14f181 commit 2a28d13
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/tasks/sync-registries.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,17 @@ const syncOrganizationAudit = async (organization) => {

if (diff.type === 'INSERT') {
logger.info(`UPSERTING: ${modelKey} - ${primaryKeyValue}`);

// Remove updatedAt fields if they exist
// This is because the db will update this field automatically and its not allowed to be null
delete record.updatedAt;

// if createdAt is null, remove it, so that the db will update it automatically
// this field is also not allowed to be null
if (_.isNil(record.createdAt)) {
delete record.createdAt;
}

await ModelKeys[modelKey].upsert(record, {
transaction,
mirrorTransaction,
Expand Down

0 comments on commit 2a28d13

Please sign in to comment.