from Ben Hatfield:
Here is the code:
https://gist.github.com/4589676
Here are the step to reproduce the two issues:
Make sure line #16 (migration attribute) in models/book.js is commented. Run code as is on the iOS simulator. Application should run OK. Table version should be at version #2. In console output, the collection data should show title, author, alloy_id and isbn (as null).
Uncomment line #16 in models/book.js. Run code. Application should run OK. Table version should be at version 1. Console output should show collection data with only title, author and alloy_id. Isbn field should be gone.
Recomment line #16 and run code. The preloaded data is displayed twice on the simulator. Table version is at version 2 again. --> Table upgrade is OK except duplicate preload data. Seems to be applying version 1 again despite already being at that state previously.
Uncomment line #16 in models/book.js, and uncomment line #16 (dropTable) and comment out line #15 (DROP TABLE + db.name) in migrations/201300182216120_book.js (second version). Run code. Application throws SQL statement error.
Undo changes to migration file. Recomment line #16 and uncomment line #15. Run code. Application should run OK. All data is gone since the migration was interrupted in the previous step. --> dropTable method is not working for this downgrade.
No comments