aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/migrator/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/lib/migrator/index.js')
-rw-r--r--app/scripts/lib/migrator/index.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/app/scripts/lib/migrator/index.js b/app/scripts/lib/migrator/index.js
new file mode 100644
index 000000000..02d8c2335
--- /dev/null
+++ b/app/scripts/lib/migrator/index.js
@@ -0,0 +1,31 @@
+const asyncQ = require('async-q')
+
+class Migrator {
+
+ constructor (opts = {}) {
+ let migrations = opts.migrations || []
+ this.migrations = migrations.sort((a, b) => a.version - b.version)
+ let lastMigration = this.migrations.slice(-1)[0]
+ // use specified defaultVersion or highest migration version
+ this.defaultVersion = opts.defaultVersion || lastMigration && lastMigration.version || 0
+ }
+
+ // run all pending migrations on meta in place
+ migrateData (meta = { version: this.defaultVersion }) {
+ let remaining = this.migrations.filter(migrationIsPending)
+
+ return (
+ asyncQ.eachSeries(remaining, (migration) => migration.migrate(meta))
+ .then(() => meta)
+ )
+
+ // migration is "pending" if hit has a higher
+ // version number than currentVersion
+ function migrationIsPending(migration) {
+ return migration.version > meta.version
+ }
+ }
+
+}
+
+module.exports = Migrator
freebsd-ports-gnome/commit/x11/libgnomemm26?h=gnome-3.24&id=43bd9f14d9ce11690e9538bf3b03d3462faa6dbe'>Presenting GNOME 2.20.1 and all related works for FreeBSD. The officialmarcus2007-10-252-6/+5 * Allow these ports to build with GCC 4.2.marcus2007-05-241-1/+1 * - Welcome X.org 7.2 \o/.flz2007-05-201-0/+1 * Presenting GNOME 2.18 for FreeBSD. GNOME 2.18 is a departure from recent GNOMEmarcus2007-03-192-5/+5 * Chase the GNOME X11BASE to LOCALBASE move, and fix the build with themarcus2006-10-142-7/+7 * Presenting GNOME 2.14.1 for FreeBSD! Checkoutmarcus2006-04-302-7/+6 * Conversion to a single libtool environment.ade2006-02-232-10/+3 * Switch to <target>:: convention for both patch-autotools and run-autotools,ade2005-11-191-1/+1 * - Update to 2.12.1bland2005-11-182-3/+4 * Mass-conversion to the USE_AUTOTOOLS New World Order. The code presentade2005-11-151-1/+1 * Update to 2.12.0.marcus2005-11-052-3/+4 * Update to 2.10.0. Note: this release is API and ABI compatible withmarcus2005-03-122-6/+14 * Bump PORTREVISIONS for all ports that depend on atk or pango to ease in themarcus2004-11-08