Page tree
Skip to end of metadata
Go to start of metadata

Migrate the definition

Sometimes when updating an older module you might want to take advantage of configuration by file using YAML. If you have already created definitions in JCR it's really easy to move them to YAML. 

  1. Open the Configuration app and find the definition to migrate.

    See Light development in Magnolia for a list of definition types supported by light modules.

  2. Use the Download definition action to export the definition to YAML. This is different then the regular export function which creates bootstrap files.
  3. Rename the file. The action will use the complete path for the filename. It's better to use something shorter. For example, becomes tous.yaml.
  4. Create a registry in the light module if not already existing. In the case of an app then an "apps" registry (or directory) is created. 

    ├── apps
        └── tours.yaml
  5. Delete the JCR based version of the app from configuration. You can also remove the apps registry from JCR (if there are no other JCR apps).
  6. Check to make sure the new YAML based definition does not have any errors in the Definitions app.

Version handling

If you use a version handler then you will need to remove the old JCR app from any system the module get's installed into. 

The current JCR based Tours app is being installed by version 1.5 of the module. So in 1.5.1 the node should be removed (or the entire apps node in the case of all apps being migrated). 

public class ToursModuleVersionHandler extends DefaultModuleVersionHandler {

public ToursModuleVersionHandler() {
    register(DeltaBuilder.update("1.5.1", "Remove JCR based app. Migration to YAML based configuration.")
        .addTask(new RemoveNodeTask("Remove JCR node.", "/modules/tours/apps/tours")));
  • No labels