Conditionally run post-attachment migrations
Introduce placeholder migrations for Backbone models so they never implicitly run migrations whenever they are `fetch`ed. We prefer to run our migrations explicitly upon app startup and then let Backbone models be (slightly) dumb(er) models, without inadvertently triggering migrations.
This commit is contained in:
@@ -154,3 +154,12 @@ exports.getDatabase = () => ({
|
||||
name: database.id,
|
||||
version: last(exports.migrations).version,
|
||||
});
|
||||
|
||||
exports.getLatestVersion = () => {
|
||||
const lastMigration = last(migrations);
|
||||
if (!lastMigration) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return lastMigration.version;
|
||||
};
|
||||
|
Reference in New Issue
Block a user