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
------------------- ------------------ -------- ------- ---------- ------------- ---------------------
Comment | File | Size | Author |
---|
Comments
Comment #2
bserem CreditAttribution: bserem as a volunteer commentedComment #3
heddnThis is somewhat intentional. I'm not sure we want to web UI littered with hundreds of drupal provided migrations.
Comment #4
bserem CreditAttribution: bserem as a volunteer commentedOh I see! That actually makes sense.
Thanks
Comment #5
stefan.kornSorry on excavating this. But I am currently also thinking about this and it seems to me it would be a improvement if the Web UI shows the same as drush migrate-status. Though one could probably not get with the current approach of the Web UI and using EntityListBuilder for displaying the list.
How would the web UI get cluttered by this? I think drush migrate-status is not cluttered by hundred of drupal provided migrations?
And as per this change record https://www.drupal.org/node/2668742 it seems that the migrations are now plugins and not config entities anymore. But it seems migrate_plus does introduce migration config entity type (again)? I am a bit confused about this.
Maybe one should at least try to list the migrations from the migrations folder below the migration config entities from migrate_plus.
Comment #6
jigariusI'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?
Comment #7
bserem CreditAttribution: bserem at Annertech commented@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).
Comment #8
nattsI also want my migrations, located in the current correct place (which is 'modulefolder/migrations'), to be listed in the UI.
Moving them to config/install is not best practice any longer. Re-installing modules or writing update hooks is messy, laborious and unnecessary. I don't have to do this for Twig templates, for instance, or new/updated classes in src, so why for migrations?
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.
Comment #9
JonMcL CreditAttribution: JonMcL commentedAdding 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.
Comment #10
jigariusIndeed, 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 adrush 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.
Comment #11
bserem CreditAttribution: bserem at Annertech commentedYou can use hook_install, like this for example:
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.