Upgrading MODx: Evolution to Revolution

One of the least discussed topics in MODx these days is upgrading from MODx Evolution (0.96+) to Revolution (2.1+). In this blog post I hope to provide a helpful description of one of the tasks in this process: (MySQL) database conversion.


Database Backup

There are a few things that have changed with the DB schema between these two iterations. Watch out for tables in Evo that have fields that are not present in the Revo DB schema. When doing a MySQL export/dump using SequelPro or similar, make sure the export doesn't include drop tables statements, and only export the tables you can't live without. The list below shows tables where all (or most) Evo fields are concurrent with Revo.

  • modx_system_settings
  • modx_site_plugin_events
  • modx_active_users
  • modx_categories
  • modx_document_groups
  • modx_documentgroup_names
  • modx_member_groups
  • modx_membergroup_names
  • modx_site_htmlsnippets
  • modx_site_plugins
  • modx_site_snippets
  • modx_site_templates
  • modx_site_tmplvar_access
  • modx_site_tmplvar_contentvalues
  • modx_site_tmplvar_templates
  • modx_site_tmplvars

Some tables like modx_system_settings probably shouldn't be imported except by hand, only grabbing the necessary settings. Below I've listed the tables I found necessary and columns in Evo that aren't in Revo, but of course it will vary from site to site.

  • modx_site_content
    1. haskeywords
    2. hasmetatags
  • modx_site_htmlsnippets
  • modx_site_plugins
  • modx_site_snippets
  • modx_site_templates
  • modx_site_tmplvar_access
  • modx_site_tmplvar_contentvalues
  • modx_site_tmplvar_templates
  • modx_site_tmplvars
    1. display_params

I've omitted a bunch of the tables that were more complicated to transition. An example would be the users tables: Evo to Revo there have been some relatively major schema changes related to users. One more thing, make sure to use a text format rather than binary when exporting the database as this will allow us to manipulate it using a stream editor of our choice.

Tag Syntax Conversion

Now that we've exported our DB, we can use a stream editor on the exported file to convert all our placeholders, dynamic links, snippet and chunk calls, etc. I have written some sed expressions that seem to do the trick. If anyone feels they could refine them, please do and let me in on it! Run the below in terminal (on Linux or OSX, if you're on Windows you're out of luck. ;-) ) replacing the insqlfile.sql and outsqlfile.sql:

 
sed -e 's/\[\([\*\+~\!]\)/[[\1/g' \
-e 's/\[(/[[++/g' \
-e 's/{{/[[$/g' -e 's/}}/]]/g' \
-e 's/[\+\!\*~)]\]/]]/g' insqlfile.sql > outsqlfile.sql

You may also edit your sql file in-place using sed, but I find it is better to keep both versions, just in case. You can test the above expressions on a simple sql file:

[+test_placeholder+]
[*test_TV*]
{{test_chunk}}

[!test_snippet_uncached!]
[(test_setting)]
[~test_link~]

This does NOT convert PHx stuff, you'll have to do that manually (see Output Filters)

You may also do some snippet and plugin conversion at any time. Check the package management area in Revo to see which packages will be available (such as Wayfinder). This step is necessary as any custom snippets and those unavailable in Revo need to be converted to the new API (api.modx.com) or discarded--possibly in favor of an alternative. One last thing to note, Ditto is not supported in Revo...an option is to install getResources and convert your Ditto calls (perhaps I will cover that in another post).

Database Import

Assuming you have a clean installation MODx Revolution on your destination server, we can import our DB. First step in importing while following this guide is to add the fields to the Revo tables that were present in Evo. This allows us to perform our insert queries quickly. In the Evo table list above, I included the field names to add for each one.

After adding those extra fields to the Revo tables, perform your import. Once that is completed, delete the extra fields as Revo will not use them.

Minor Adjustments

At this point you may need to adjust some system settings, such as site_name, etc. If you haven't converted your necessary custom snippets and installed alternative packages for non-concurrent snippets, now would be the time to do that. I'd recommend going through your site page by page and troubleshooting any errors before calling it done, but otherwise, you're done!


Comments (0)


Add a Comment





Allowed tags: <b><i><br>Add a new comment: