joli.js icon indicating copy to clipboard operation
joli.js copied to clipboard

Migration problem

Open jamesDin opened this issue 13 years ago • 2 comments

First of all, I love your work !!! You really did a great job.

I tried your demo, and you have a line there that suppose to do "migrate" to database:

       joli.models.migrate(current_migration_version);

Actually, it runs ONLY on the first time, when the emulator/device is cleared. On the second time when I run it again, it gives an error on line 600 (joli.js). I checked it out and seems to be that after calling the next line:

    // use the model specified by as() first, then from()
    var model = joli.models.get(this.data.as || this.data.from);

the "model" is null. Then it fails on line 600:

   result.push(model.newRecord().fromArray(rowData));

When I comment the "migrate", line, the application works fine. But if joli can do this, it will be simply just great!

Thanks a lot.

jamesDin avatar Dec 16 '11 08:12 jamesDin

Pulled the latest version today (25/7/12) calling getVersion() throws the error Result of expression 'model' [undefined] is not an object. at joli.js (line 643)

result.push(model.newRecord().fromArray(rowData));

Which i assume is the same error as above other than the line number

sharpred avatar Jul 25 '12 08:07 sharpred

Yes, that's exactly the problem. I wish there was a good "Data Migration" sample, I'm sure it's useful for all.

jamesDin avatar Aug 07 '12 11:08 jamesDin