Skip to content

Instantly share code, notes, and snippets.

@em-piguet
Created March 30, 2016 09:59
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save em-piguet/58d4750568845697ae0e49627ee88821 to your computer and use it in GitHub Desktop.
Save em-piguet/58d4750568845697ae0e49627ee88821 to your computer and use it in GitHub Desktop.
How to convert an MODX articles container to a MODX collections container...
# switch ArticlesContainer -> CollectionContainer
# the res. ID I want to migrate is 11
UPDATE `modx_site_content` SET `class_key` = replace(class_key, 'ArticlesContainer', 'CollectionContainer') WHERE id=11;
# switch class_key to go back to default document view for children
UPDATE `modx_site_content` SET `class_key` = replace(class_key, 'Article', 'modDocument') WHERE parent=11;
# Change template 49 -> 57
UPDATE `modx_site_content` SET `template` = replace(template, '49', '57') WHERE parent=11;
@Jako
Copy link

Jako commented May 9, 2016

A little less is more (you only have to change the template id - if needed):

UPDATE `modx_site_content` SET `class_key` = 'CollectionContainer' WHERE `class_key` = 'ArticlesContainer';
UPDATE `modx_site_content` SET `template` = '57' WHERE `class_key` = 'Article';
UPDATE `modx_site_content` SET `class_key` = 'modDocument' WHERE `class_key` = 'Article';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment