Skip to content

Saving existing model object updates createdAt field  #39

Description

@vladaman

Every time we save model it also updates createdAt and updatedAt field. We'd expect the createdAt field would not be updated for future object updates.

Code sample:

final batch = Batch()
..save(existingObject);
await batch.commit();

We can use Batch()..update() but the behavior is different. It will update just updatedAt field but on the device it will set createdAt field to null. Is this expected behavior?

final batch = Batch()
  ..update(existingObject);
  await batch.commit();
  debugPrint("New Val: ${existingObject.createdAt}"); // here createdAt is null

We believe the issue is here, where createdAt will be set to null:

_createdAt = createdAt;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions