Comments (5)
Did you manage to solve this?
Didn't go into detail but there is explicit check for updatedAt. I don't think these fields are mandatory but if defined they should be defined both in model and in schema.
Yes, I added updated_at
and created_at
to my schema's and that solved the issue for me. But that is interesting, I assumed that it would be checking for updated_at
and not updatedAt
. I break from naming conventions in my database and use camelcase instead of snake case, which is why I used updatedAt
from watermelondb.
Overall I don't like that Watermelon uses naming conventions like this. In my opinion you should be able to configure the columns you want to attach advanced field behaviors to. To my knowledge Sqlite doesn't care if you use snake-case or camelcase naming
from watermelondb.
The only thing I've read that would cause a pushed object not to marked as synced is if it changed during the sync and that hasn't happened in this case. All records are never marked as synced. Very Frustrating
from watermelondb.
Ok, so I wrapped my entire sync function in a try catch and get an error inside watermelon
TypeError: Cannot read property 'type' of undefined
Top of stack inside _setRaw.
at _setRaw (http://10.0.0.14:8081/../../node_modules/@nozbe/watermelondb/RawRecord/index.bundle//&platform=ios&hot=false&lazy=true&transform.engine=hermes&transform.routerRoot=app&dev=true&minify=false&modulesOnly=true&runModule=false&shallow=true:20:28)
at setRawSanitized (http://10.0.0.14:8081/../../node_modules/@nozbe/watermelondb/RawRecord/index.bundle//&platform=ios&hot=false&lazy=true&transform.engine=hermes&transform.routerRoot=app&dev=true&minify=false&modulesOnly=true&runModule=false&shallow=true:95:12)
When I debug further I found that the error was here
function _setRaw(raw, key, value, columnSchema) {
console.log(raw, key, value, columnSchema)
var {
type: type,
isOptional: isOptional
} = columnSchema;
...
The result of that console.log is
[object] updated_at 1708213289147 undefined
What is interesting is I don't use updated_at
in my schema. I elected to go with all camel cased fields in my schema and not use the updated_at
or created_at
fields as the docs said they weren't required. So why does this function get called with updated_at
even though the columSchema
is undefined
?
I think this may be a bug in Watermelon.
However, I do have updatedAt
, createdAt
, and deletedAt
fields in my database, so maybe I should just map those fields and take advantage of watermelon db's built in advanced fields handling.
from watermelondb.
Did you manage to solve this?
Didn't go into detail but there is explicit check for updatedAt. I don't think these fields are mandatory but if defined they should be defined both in model and in schema.
from watermelondb.
Related Issues (20)
- [question] How to install extensions
- Web Bundling failed
- TypeError: Super expression must either be null or a function HOT 2
- Can we get current migration versions like fromVersion and toVersion
- Different between using `@lazy` decorator vs getter?
- Support for Expo SDK50 HOT 1
- Error: [withObservable] Value passed to withObservables doesn't appear to be observable. See console for details
- Observer with pagination not working
- Unable to resolve module ./internal/operators/timeout from E:\eventual-mvp-app\node_modules\rxjs\dist\cjs\index.js:
- Installation guide HOT 1
- Sync pull HOT 1
- Unable to run between query Because number field in schema treated as string in SQLite DB HOT 2
- Unable to use sortBy option for joining table with use of clause HOT 1
- Automatic create/update tracking not working in react native 0.73.1 HOT 6
- [Question] 0.27.1 does not export "action" from Database any more HOT 1
- "TypeError: SQLiteAdapter is not a constructor" when using Svelte(Kit) and CapacitorJS HOT 2
- @leejunhui I have the same problem. Just migrated to Vite + Typescript and the _raw fields are empty. Did you get it running in the end?
- Developing a Tauri Database Adapter, multiple errors HOT 1
- Wrong type definition in LocalStorage get HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from watermelondb.