Is the Doctrine Migrations project compatible with Doctrine MongoDB?
Asked Answered
P

2

6

Is the Doctrine Migrations project compatible with Doctrine MongoDB?

It isn't clear to me from searching and looking at the Doctrine Migrations project whether it is compatible with ODM solutions (e.g. MongoDB) as well as ORM solutions.

If it is, can anyone suggest examples or articles on how to use the two together?

If it isn't, are there reasonable alternatives?


Question Background:

I understand, marginally, the different approaches to migrating a document's data from one version of the document to another and the pros and cons of each.

I am leaning towards possibly implementing a hybrid approach of gradual schema changes and migration scripts as suggested here. Leveraging the functionality within Doctrine's MongoDB library written about by Jonathan Wage in his post: Doctrine MongoDB ODM Schema Migrations.

Even with that, I need to find some way of creating a migration script or performing the data migration, and Doctrine Migrations seemed like a good first choice.

As an aside, another user warns against using the approach Jonathan Wage presents above for migrating data and instead running commands (JavaScript?) directly against the database.

Prepay answered 28/12, 2013 at 18:7 Comment(0)
G
3

Despite doctrine-migrations is not compabible with MongoDB ODM (it only supports DBAL) you can bet for the alternative mongo-based migration components made by 3rd party teams.

It was firstly developed here https://github.com/antimattr/mongodb-migrations but after it has been abandoned the project continues here https://github.com/doesntmattr/mongodb-migrations

Gradey answered 3/7, 2017 at 7:5 Comment(3)
Interesting. I'll have to keep an eye on this. I've been managing migrations manually with JavaScript files up until now.Prepay
There are 2 ways in mongo. One is the lazy migration (manage different document versions by code) and the other is to use migration scripts. This second one is tricky for huge ammounts of data if you don't want to go offline for long periods.Gradey
Yeah, I'm familiar with the first approach, but I've never been really comfortable with it. It might be a better approach for me to take though in 9 out of 10 cases. Thanks for your thoughts!Prepay
S
0

Ufortunately, it isn't compatible with ODM. It supports ORM only.

Secundine answered 24/6, 2014 at 13:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.