UI will not display migrations that are not in configuration.

Created on 2 November 2019, over 4 years ago
Updated 31 March 2023, about 1 year ago

Problem/Motivation

Migrations (YML) files can be stored either under config/install or under migrations folder.
The first will import migration config into Drupal upon enabling the custom migration module.
The later will make migrations available in drush ms and changes will be understood with a simple drush cr instead of uninstalling/re-installing the migration custom module. I believe this makes it by far more convenient than adding migrations under config/install.

$ tree
.
β”œβ”€β”€ faq_csv_migrate.info.yml
β”œβ”€β”€ migrations
β”‚   └── users.yml
└── README.md

On the second occasion migrations added under the migrations folder are never listed in the UI, although they are executed with the patch in #2924296: Batch (VBO) functionality for Web UI executions β†’ .

Proposed resolution / User interface changes

Also display migrations found under the migrations folder in the UI.

Additional Information

YML under config/install folder:

YML under migrations folder:

Drush (on both cases):

$ drush ms
 ------------------- ------------------ -------- ------- ---------- ------------- --------------------- 
  Group               Migration ID       Status   Total   Imported   Unprocessed   Last Imported        
 ------------------- ------------------ -------- ------- ---------- ------------- --------------------- 
  Users (users)       users              Idle     20      20         0             2019-11-01 23:36:35  

 ------------------- ------------------ -------- ------- ---------- ------------- --------------------- 
✨ Feature request
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡¬πŸ‡·Greece bserem

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¨πŸ‡¦Canada jigarius MontrΓ©al

    I'm facing a similar problem as well. My migrations are all defined in a module like "foo/migrations", however, I want the site's administrators to be able to see and run them in the UI. Thinking aloud, maybe this could be a setting? Show non-config migrations in the UI?

  • πŸ‡¬πŸ‡·Greece bserem

    @jigarius when you are done with developing your migration, assuming it will not change, you can move it to `config/install` and enabled the module that provides it. This way it will be visible in the UI.

    It will become configuration, so any updates on the file itself will not be reflected, but you can re-install the module or write an update hook to force it (I think that's possible).

  • πŸ‡¬πŸ‡§United Kingdom natts London

    I also want my migrations, located in the current correct place (which is 'modulefolder/migrations') β†’ , to be listed in the UI.

    Moving it to config/install is not best practice any longer. Re-installing modules or writing update hooks is messy, laborious and unnecessary.

    If there really is some kind of issue about about having too many migrations shown, then just have tabs or another UI mechanism to filter them.

  • πŸ‡ΊπŸ‡ΈUnited States JonMcL Brooklyn, NY

    Adding my use case for this ..

    We are in active development of a new Drupal application. Migration source is an Oracle database (non Drupal). We do not have any migrations created by Drupal itself. All of our migrations are being created like foo_migrate/migrations/*.yml. These migration configs are very rapidly changing and will go through many rounds of refinement before they can be considered ready for config/install or config/sync directories.

    Our issue is that all our testing and staging environments are in Kubernetes clusters and ssh access is not readily available. So no easy drush execution.

    It would be great to have a UI that can run theses migrations. I fully understand it is not a simple problem to solve. The current lists are based on displaying migrate_plus.migration configs while migrations that exist inside of a migrations/ folder are actually plugins. So maybe a separate UI that only lists plugins might be needed.

  • πŸ‡¨πŸ‡¦Canada jigarius MontrΓ©al

    Indeed, bserem. That's how I had them, but then they need to change so config/install is not possible in my case. I have considered some other solutions which I'll share here.

    After every time I do a drush config:import I can do a drush config:import --partial --source=modules/custom/foo_migrate/config/install to update my migration configuration.

    I have also considered setting up symlinks to all my migration YML files inside Drupal's config sync directory. At the point of writing this comment, I think the config_ignore module can only ignore imports and not exports. Thus, a config:export would overwrite my symlinks. However, if it were to support "ignore during export only" some day then my symlinks approach might work.

    IMHO, all migrations are migrations irrespective of how they're being created. So it'd be great to have a similar UI to manage them all. But maybe some people might want to hide certain "internal" migrations from the UI? In which case, a parameter like "hidden: true" in the migration YML might help.

    That said, for now, I'm just going to live without these migrations in the UI. Sad, but true.

  • πŸ‡¬πŸ‡·Greece bserem

    You can use hook_install, like this for example:

    /**
     * Update config from config/install.
     */
    function hook_update_8201() {
      $message = NULL;
    
      if (\Drupal::moduleHandler()->moduleExists('views')) {
        $config_path = \Drupal::service('extension.list.module')->getPath('EXAMPLE') . '/config/install/views.view.EXAMPLE.yml';
        $data = Yaml::parseFile($config_path);
        \Drupal::configFactory()->getEditable('views.view.EXAMPLE')->setData($data)->save(TRUE);
        $message = 'The EXAMPLE views have been updated.';
      }
      else {
        $message = 'Oh no! Something went wrong! Is views installed?';
      }
      return $message;
    }
    

    This is from a module of mine (admin_feedback) and worked fine. You'll have to update the paths to reflect migrations instead of views.

Production build 0.69.0 2024