A look at meteor/meteor-migrations: 243 stars on GitHub, written primarily in JavaScript. Simple migration system for Meteor
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
A simple migration system for Meteor supporting up/downwards migrations and command line usage. There is also a fork available for use outside of Meteor.
Installation
Meteor Migrations can be installed through Meteor's package manager. Type:
$ meteor add percolate:migrations
API
Basics
To write a simple migration, somewhere in the server section of your project define:
Migrations.add({
version: 1,
up: function() {//code to migrate up to version 1}
});
A more complete set of migrations might look like:
Migrations.add({
version: 1,
name: 'Adds pants to some people in the db.',
up: function() {//code to migrate up to version 1}
down: function() {//code to migrate down to version 0}
});
Migrations.add({
version: 2,
name: 'Adds a hat to all people in the db who are wearing pants.',
up: function() {//code to migrate up to version 2}
down: function() {//code to migrate down to version 1}
});
As in 'Basics', you can migrate to the latest by running:
Note: Migrations should be run from Meteor.startup to allow for log output configuration.
By specifying a version, you can migrate directly to that version (if possible). The migrations system will automatically determine which direction to migrate in.
In the above example, you could migrate directly to version 2 by running:
Migrations.migrateTo(2);
If you wanted to undo all of your migrations, you could migrate back down to version 0 by running:
Migrations.migrateTo(0);
Sometimes (usually when somethings gone awry), you may need to re-run a migration. You can do this with the rerun subcommand, like:
Migrations.migrateTo('3,rerun');
NOTE: You cannot create your own migration at version 0. This version is reserved by migrations for a 'vanilla' system, that is, one without any migrations applied.
To see what version the database is at, call:
Migrations.getVersion();
Configuration
You can configure Migrations with the config method. Defaults are:
Migrations.config({
// Log job run details to console
log: true,
// Use a custom logger function (defaults to Meteor's logging package)
logger: null,
// Enable/disable logging "Not migrating, already at version {number}"
logIfLatest: true,
// migrations collection name to use in the database
collectionName: "migrations"
});
Logging
Migrations uses Meteor's logging package by default. If you want to use your
own logger (for sending to other consumers or similar) you can do so by
configuring the logger option.
Migrations expects a function as logger, and will pass arguments to it for
you to take action on.
The opts object passed to MyLogger above includes level, message, and tag.
level will be one of info, warn, error, debug.
message is something like Finished migrating..
tag will always be "Migrations" (handy for filtering).
Custom collection name
By default, the collection name is migrations. There may be cases where this is inadequate such as using the same Mongo database for multiple Meteor applications that each have their own set of migrations that need to be run.
Command line use
*** DEPRECATED ***
This info is for pre 0.9 users as post 0.9 the migrate.sh script is no longer included in the package folder.
You can also run migrations from the command line using the included shell script. This will
Migrations set a lock when they are migrating, to prevent multiple instances of your clustered app from running migrations simultaneously. If your migrations throw an exception, you will need to manually remove the lock (and ensure your db is still consistent) before re-running the migration.
From the mongo shell update the migrations collection like this:
How active is development on meteor/meteor-migrations?
The most recent commit recorded on meteor/meteor-migrations was 8 months ago, based on the GitHub push timestamp. The repository has 58 forks — one of the better signals of community interest.
How many stars does meteor/meteor-migrations have?
meteor/meteor-migrations has 243 GitHub stars — refresh the page for the live number, or check github.com/meteor/meteor-migrations. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is meteor/meteor-migrations open source?
Yes — meteor/meteor-migrations ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/meteor/meteor-migrations.
What topics is meteor/meteor-migrations associated with?
GitHub's repository topics for meteor/meteor-migrations: "hacktoberfest", "meteor". TopGit's editorial category is open-source.
Where can I see meteor/meteor-migrations in action?
The project maintains a homepage at https://atmospherejs.com/percolate/migrations. The README tab on this page also usually contains screenshots and a quickstart.
Where do I read more about meteor/meteor-migrations?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/meteor/meteor-migrations is the definitive source.
Read full README in the tab above.
Still deciding about meteor-migrations?
One click hands the question to an AI along with this page — see what it says about meteor-migrations.