Drupal to Rails Migration

I’m planning to migrate a Drupal 7 site to Ruby on Rails 6. The Drupal site is very media heavy. 100K+ nodes (pages) all with images and videos. There are also many categories and users. One complication is that the Drupal database is MySQL and the Rails dabase will be Postgresql.

I was thinking to create a json feed from the Drupal site and then import and re-create the content in Rails. Am I overthinking this? Should I rather import the content directly from the database?

What are my options for migration? Are there any best practices for such jobs?

There are going to be many challenging aspects of this, from actually creating the rails app, to getting the data migrated.

I don’t think whether you are using a json feed or a importing directly from the db is going to be your biggest issue.

I would start out by creating the app in Rails in the first place; that’s going to be a big challenge on it’s own, and you can’t import to an app you don’t have yet!

At least the basic skeleton of the app. Then you can look at importing data to it, and I would do, at least at the start whatever is simplest. Get started, see where you run into troubles.

This is going to be a big project, whether you use a json feed or connect directly to the db won’t be the biggest concern. You won’t know the biggest concerns until you get started on it.

2 Likes

Yes, agreed. Thank you!

Building the Rails app will probably be not a problem. I have built a similar one recently, so I have good recent experience.

In the past I have managed to import information into a Rails site from a Drupal site using a basic json file, which is why I was thinking to take that path again. But I’m uncertain if it’s the most efficient way to do things. I don’t really want to work in Drupal creating complex json feeds that cover all the content, unless there is no better way. On the other hand I also don’t think doing a direct import from MySQL is easy at all, because Drupal’s database structure is not simple, especially when a site uses the ‘fields’ module, which is similar to Active Storage in Rails, in a sense that one table contains multiple field data.

We had a similar project and we ended up importing only part of the content by:

  • importing content from the existing RSS feeds
  • scraping the rest of the web pages

It was much less work than using a database export and figuring out how to map the data to the new schema.

1 Like

Migrating from Drupal to Ruby on Rails consists of two important challenges: the creation of the app and the migration of the data. You should at least have a basic rails app skeleton to be able to import the data in your app. MySQL is a community-driven DBMS and PostgreSQL is an ORDBMS, similarly, there are many differences that make data migration a bit challenging. If you want expert assistance, you can look for the right support for a smooth migration.

@iraszl You could use pgloader to transform your Mysql to PG. If your media files are on any static asset server like s3 there should not be any problem. If they are not, consider moving them to any asset server and give a reference for them on your database.

Before using pgloader please read documentation and be careful about constraints. I think there won’t be any major problem if you did not use views and triggers heavily.

1 Like