You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our API stores timestamps (createdAt and updatedAt) as epoch seconds instead of milliseconds. Additionally, the API returns its data using camelCase (updatedAt) rather than snake_case (updated_at). This discrepancy caused us debugging challenges, particularly with errors like the following:
Cannot destructure property 'type' of 'columnSchema' as it is undefined.
Call Stack
_setRaw
node_modules/@nozbe/watermelondb/RawRecord/index.js
setRawSanitized
node_modules/@nozbe/watermelondb/RawRecord/index.js
_setRaw
node_modules/@nozbe/watermelondb/Model/index.js
The error message provided no clear indication of which key or column was causing the issue. To identify the root cause, we had to manually comment out columns one by one until the error disappeared.
Proposed Solutions
Configurable or Self-Managed Timestamps
Can createdAt and updatedAt be made configurable or optionally self-managed?
This would allow us to retain these column names (createdAt and updatedAt) while managing their behavior ourselves.
Current workaround: Renaming columns to createdAt2/updatedAt2 and using adapters to translate between the API, WatermelonDB, and React components.
Improved Error Messaging
Can error messages in _setRaw (or higher up the call stack) include additional context, such as the specific key or column name causing the issue? This would make debugging a bit easier.
Our API stores timestamps (createdAt and updatedAt) as epoch seconds instead of milliseconds. Additionally, the API returns its data using camelCase (updatedAt) rather than snake_case (updated_at). This discrepancy caused us debugging challenges, particularly with errors like the following:
The error message provided no clear indication of which key or column was causing the issue. To identify the root cause, we had to manually comment out columns one by one until the error disappeared.
Proposed Solutions
Configurable or Self-Managed Timestamps
Can createdAt and updatedAt be made configurable or optionally self-managed?
This would allow us to retain these column names (createdAt and updatedAt) while managing their behavior ourselves.
Current workaround: Renaming columns to createdAt2/updatedAt2 and using adapters to translate between the API, WatermelonDB, and React components.
Improved Error Messaging
Can error messages in _setRaw (or higher up the call stack) include additional context, such as the specific key or column name causing the issue? This would make debugging a bit easier.
Example Workaround
Related Issues
#1752
The text was updated successfully, but these errors were encountered: