coresmart / persistencejs

persistence.js is an asynchronous Javascript database mapper library. You can use it in the browser, as well on the server (and you can share data models between them).
http://persistencejs.org
1.72k stars 240 forks source link

fixed bug for migration aliases #7

Closed wilkerlucio closed 14 years ago

wilkerlucio commented 14 years ago

I fixed the scope of calling the methods of migration, in previous versions you did like this:

persistence.migrate = Migrator.migrate;

The problem with this is the "migrate" function is running on context of "persistence" and not in context of "Migrator", and it causes to run migration on errors (it can't found this.version for example).

To fix this I made this function to just wrap and call functions in correct context sending same arguments, like this:

persistence.migrate = function() { Migrator.migrate.apply(Migrator, Array.prototype.slice.call(arguments, 0))};

zefhemel commented 14 years ago

Thank you, pushed it to master :)