superfeedr/indexeddb-backbonejs-adapter — pull request #36 by toots (2013-03-12 00:02:37+00:00)
Title: Fix bug with migration. cleanup code.

Hi,

I've been having a bug where `DOM IDBDatabase Exception 11` was being thrown out during my second migration.

Turned out the bug can be fixed by not waiting for `transaction.oncomplete` to fire next migration.

More specifically, `transaction.oncomplete` seems to be dependent upon the GC:

```
The following sentence isn't correct "Transactions today auto-commit when the transaction variable goes out of scope and no more requests can be placed against it".
```

Since the JS GC sucks really bad, it's always a good idea to keep the transaction variable around if one wants to avoid an unfortunate `oncomplete` callback. (indeed calling `this.transaction` will fall out of the GC scope, thus `transaction` may be considered out of scope..)

I have thus added `transaction` as the first variable of the migration function. Also, it turned out that `migrate` was just a proxy for `_migrate_next` so I've removed `_migrate_next`.