Skip to content

Commit

Permalink
Merge pull request #1070 from Chia-Network/fix/null_sync_fix
Browse files Browse the repository at this point in the history
fix: null fix during sync
  • Loading branch information
TheLastCicada authored May 15, 2024
2 parents b14f181 + 2a28d13 commit 4420194
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 4420194

Please sign in to comment.