Watermelondb: undefined is not an object (evaluating 'this.schema.version')

Created on 1 Mar 2020  路  7Comments  路  Source: Nozbe/WatermelonDB

Hello,

I am trying to get a minimal react native app with watermelon up and running.
You can check my code here https://github.com/K4stor/AwesomeNativeApe

I get the message

console.error: "[DB] Uh-oh. Database failed to load, we're in big trouble", TypeError: undefined is not an object (evaluating 'this.schema.version')

_construct
    construct.js:30:26
Wrapper
    wrapNativeSuper.js:26:23
SyntheticError
    index.bundle?platform=ios&dev=true&minify=false:28714:111
reactConsoleErrorHandler
    ExceptionsManager.js:135:52
error
    index.js:33:53
$Try_1_Catch
    common.js:66:29
tryCallOne
    core.js:37:14
setImmediate$argument_0
    core.js:123:25
callImmediates
    [native code]:0
flushedQueue
    [native code]:0

Any Idea what to do ?

Most helpful comment

hi, i have the same problem.. just change de export part.

export const mySchema [Remove]
export default mySchema [OK]

or when you called, you should be do this.

import { mySchema } from '[Location]'

regards

All 7 comments

your schema export is wrong

OK, what must it look like ?

hi, i have the same problem.. just change de export part.

export const mySchema [Remove]
export default mySchema [OK]

or when you called, you should be do this.

import { mySchema } from '[Location]'

regards

I think this needs to be fixed in documentation.

@finom please send a quick PR correcting the documentation - look at docs-master/ folder

馃槅馃槅馃槅 My sins were that there was a mismatch in my model fields definition and schema definition

It was like this in the model definition:

@field('medicine') medicine

And my schema was like this

{ name: 'my_medicine', type: 'string' },

To correct this: I changed @field('medicine') medicine to @field('my_medicine') medicine

And my sins were forgiven.....馃檹馃従馃檹馃従馃檹馃従

It started working...

@blackgeneration thanks bro

Was this page helpful?
0 / 5 - 0 ratings