Nozbe / WatermelonDB

🍉 Reactive & asynchronous database for powerful React and React Native apps ⚡️
https://watermelondb.dev
MIT License
10.62k stars 600 forks source link

Possible to overwrite created_at ? #1809

Closed arnolicious closed 4 months ago

arnolicious commented 4 months ago

Hey all, great library, absolutely loving it so far!

I'm wondering if there's any way to overwrite / pass my own dates into the automatically tracked created_at (and updated_at) fields.

My use case is the import of some external data, which already has an older creation date. I assume I could get around this problem by creating a separate field, but that doesn't seem very elegant :D

radex commented 4 months ago

Sure, you can do record._setRaw('created_at', timestamp)

arnolicious commented 4 months ago

Oh great, thanks!