Meteor Migrations

I searched for “migrations” in the forums and in the docs, but I didn’t find any references there to database migrations. I see that there are a few of packages for migrations in Atmosphere.

Are migrations really necessary in Mongo? I am new to non-relational databases, but it seems as though you just sort of change the schema on the fly as needed. I haven’t read about many people using migrations (in the whole entire 3 weeks I’ve been developing with Meteor, that is). It is nice to have your database schema in source control, but Mongo doesn’t have the rigid, hard to change schema structure that traditional relational databases use.

I’ve also heard the term “Oplog” thrown around a bit. I guess it’s a port-manteau of “operation log” and that it’s a Mongo component. I googled it, but didn’t really get the documentation right away. I mean, how does it fit into Meteor? The Oplog docs say it is more than a log of database transactions. Does it serve the purpose migrations serve?

1 Like

Hey @thebionicman,
Migrations are possible with MongoDB and Meteor.
I highly recommend the usage of migrations.

There are some packages available on Atmosphere https://atmospherejs.com/?q=migration

I’ve used https://atmospherejs.com/percolate/migrations and really like it!

The oplog is a Mongo-Specific log which logs all the database transactions and is used for replica sets (so that they know which data is changed). Meteor uses the oplog to “see” in real time which data has changed so that the UI can update accordingly.

Altough The oplog is not related to migrations.

@pmuens

Awesome, thanks for the info man. I thought Oplog might be the driving force behind the migrations packages, but I was wrong.

Ok, I’ll checkout the migrations packages.

I really love the idea of connection the migration to a schema.

So you basically change the schema in your .js file
and the migration tool will read it and generate the migrations for you.

Rails and Django have implemented that really well.

The tool available in Meteor right now seem to be in beta status
and build on the very popular simple schema package:
https://atmospherejs.com/davidyaha/collection2-migrations

1 Like

You might also want to take a look at

https://atmospherejs.com/bookmd/schema-migrations
and watch

I think the presentation has very good points for the requirements of database migration tool.
However the package is deprecated, is there an alternative for current version of meteor 1.4?
I want to run the migrations independently from meteor inside a CLI, that is my main requirement.

Here are other requirements for a good migration tool, mentioned in the video:

    • Track schema changes
    • Keep schema definition clean
    • Create auto migrations if its possible
    • Allow the programmer to add logic
    • Run as CLI