Problem/Motivation
We will eventually need to migrate Drupal 8 to Drupal 9 (and possibly Drupal 10).
Also while it's less common, there are use-cases for migrating Drupal 8 to Drupal 8 - things like migrating a multi-site to domain module.
Proposed resolution
Summary
- D8 migration sources are not a requirement for opening the Drupal 9 branch.
- D8 migration sources would be necessary to get in at some point in time (e.g., to support 8 -> 10 migrations)
- D8 sources exist for config (d8_config) and content (content_entity)
- JSON:API #3150949: Add a migration source plugin for JSON:API
- Proposed: The actual D8 source plugin that works with a DB connection issue is #2992746: Support for external databases in `content_entity` migration source?
- Contrib module migrate_drupal_d8 provides database queries to the source d8 database.
- For BC reasons, D6 migration sources need to remain in the 8.x branch for the rest of its lifetime.
- D6 migrations sources can be removed from the 9.x branch as soon as that branch is opened.
Original proposal
Add Drupal 8 source plugins, and test coverage for an 8-8 migration.
This will provide the basis for the 8-9 migration path, since these would only change to due to changes in the migrate API in 9.x
If we add this before opening 9.x then we have the potential to keep 9.x in a 100% shippable state with support for 6/7/8-9 migration paths (even if we might move the 6.x sources to contrib at that point).
This is a much lower priority than 6.x/7.x sources, so marking postponed.
Comments
Comment #2
jian he commentedI could not wait for the 8-8 migration, and do not know how to implement it.
Is there any 8.x sources as an example? such as node or user source.
If there has an example, so we can study it and coding the migration for other modules.
Comment #3
mikeryanNo work has yet begun, or is anywhere near beginning, on D8 sources - we're still busy nailing down the D6 and D7 migration paths, hence this is a Postponed Plan rather than an Active Task. My expectation is that we'll do this initially in contrib (like the D5 migration support) with an eye towards merging into core in a later 8.x release.
Comment #4
mikeryanNote that while the migrations themselves, and narrow source plugins for specific cases, will most likely be developed first in contrib, I think a configuration source plugin is broadly useful enough (and a necessary enabler for the contrib work) to go into 8.1 core: #2621500: Configuration source plugin.
Comment #6
xjmThis can be active for the next development minor (currently 8.2.x).
Comment #7
xjmAlso, I think this is major.
Comment #9
quietone commentedIf we follow the existing pattern, we will also need a D8 test fixture. Or even better, more than one, to cover different use cases.
Irregardless of how many there are, I think they need to be built via the UI with the intention of making them once and only once. I mean, with all the modules, settings, data and modifications needed. We should not have to modify the dump for each and every migration. It is time consuming and prone to error. The dumps should only need minimal attention, such as updates.
And probably improve the tools, so that things we test, like timestamps, don't get changed every time a patch is made after using the UI. Or to automatically change text, like the maintenance text, to begin with 'Drupal 8' so we can confirm it migrated to the new destination correctly.
Comment #10
chx commented8-to-8 should replace the exception thrown in SqlContentEntityStorageSchema::onEntityTypeUpdate
Comment #11
xjm(Just trying to fix that this issue has about the most unsearchable title.)
Comment #12
chx commentedIs this a challenge to find an issue with a more unsearchable title?
Comment #13
jibranComment #14
berdirWe started working on something for a project we have, put it on d.o now: https://www.drupal.org/project/migrate_drupal_d8
Not extensively tested yet, we're still developing it.
Comment #16
mikeryanSince the plan is that Drupal 9 will basically be Drupal 8.x with deprecated code/features removed, it seems we won't need an upgrade path to Drupal 9, right? The pain of migrating to a new Drupal instance to achieve an upgrade should be a one-time thing (or at least, not something we'll need to do again for a couple of major releases). So, while it will be good to have D8 sources to support custom D8->D* migrations, I don't think that rises to Major priority.
Comment #17
xjmOh, this is definitely major. The whole policy relies on having D8 sources that are part of the code that gets deprecated and upgraded. Finishing D6/7 migrations of course needs to come first, but this is a key part of making upgrades easier in the future. Edit: already we hear from people that being able to do migrations within D8 would save a lot of pain for experimental modules and so forth. We had a meeting a couple weeks ago with experimental module owners and one of the key takeaways was a need for migrations.
Comment #18
berdirThat's an interesting topic that goes far beyound this issue I think.
Pure API deprecations are fairly easy, we have a new API, both do the same we eventually remove the old, done.
Deprecating configuration or storage is a lot more complicated. I honestly have no clue yet how we're supposed to that. The configuration of rest.settings to configuration entities was one example that we've already done in 8.x and honestly it was/is a mess, broke modules like rest_ui and so on. If we'd been strict/honest about BC in rest.module, that would have never been allowed to happen the way it did. (Not blaming anyone, but that's how it is).
We'd need a sync in both ways, so that the data/configuration can be found in both the old and the new place, but what if the new structure can't even be fully representated in the old structure? Or if it's a change that by defintion conflicts with the old way? so many "interesting" problems.
But I'm not sure if we need migrations because as written, the data needs to be in both places from the beginning, so the only thing would be to automatically run migrations in update functions and I doubt that is easier than just writing code directly.
Comment #19
xjmRight, sorry, the bit about migrations within a D8 site for experimental was just an aside. The main point is that D8 sources are a requirement for the new upgrade and deprecation model to actually work, because otherwise we're stuck with legacy database tables forever again and are back to the pain of D6 upgrades. The expectation will still be that you create a new D9 site and migrate into it; the change is just that you don't have to wait 1-2 years for contrib modules or rewrite all your custom code. Migrate is an essential piece of the puzzle for us.
Comment #20
mikeryanDoes this mean that the expectation is if we have a BC change in data model (database table), at the point we implement the new model we leave the data represented in the old model until D9? My expectation was that data would be upgraded in place as we go if we have such an instance - as Berdir suggests, maintaining two data models at once seems painful.
I think it may be hard to picture how this works in practice until we hit a concrete example (are there any such changes in the works now?).
Comment #23
heddnWe now have a d8 source for content entities. What is left in this? Let's update the issue summary on what is left or is important.
Comment #24
catchWhat we have at the moment is a Drupal current to Drupal current migration. That will cover Drupal 8 -> Drupal 8 and Drupal 9 -> Drupal 9.
To do a raw Drupal 8 to Drupal 9 migration, we'd probably still need a source that directly queries the Drupal 8 database. Following #2822727: [policy, no patch] Adopt a continuous API upgrade path for major version changes this might not be a blocker to releasing Drupal 9 any more though, because we might be able to support update.php again (although people may still want to migrate Drupal 8 sites into Drupal 9 sites for other reasons).
Leaving this as a comment because I'm not sure how to express this in the issue summary.
Comment #25
heddnI've opened #2945181: Beef up Config D8 source plugin. I'm switching this into a meta. I think we still need a plan or next steps of what is needed for this.
Comment #26
heddnSee we don't have any plans to release 9 soon. And we now have a D8=>D8 migrate path, I'm going to drop priority on this meta. There's no urgency on it right now.
Comment #28
heddnThis seems the most applicable for asking some questions about supporting D6 (and D7) when D9 is released.
The later question speaks directly to the statements made in several large Drupal developer gatherings by Dries and others that D8 is the last major Drupal change. From here on out, D9.0.0 and D8.Final will be API equal except for BC removals. If that statement is true, then we /could/ require anyone wanting to upgrade to D9 first upgrade to D8.Final, then upgrade a second time to D9.0.0, then a third time to 9.x.x, or whatever is the latest release at the time.
The upside to not supporting external DB connections upgrades (maybe in contrib?) is that we drastically reduce the code-base core. We wouldn't need to keep CCK/Field plugins. Our Sql based source plugins in Migrate Drupal probably mostly disappear. We don't need to write a DB equivalent of the Entity API for pulling in "all nodes", etc.
The downside, we don't really have a very seamless upgrade path for legacy sites still on D6 or even D7.
Comment #29
gábor hojtsyDoes the existing code need updates/changes to keep that support (ie. is it in the way of new API introductions, etc.)? Or is the main concern with keeping that code that there may be bugs, security issues, etc. that mean more maintenance burden compared to less code?
Comment #30
heddnMy concern is we have D6, D7 db support. If we keep that in D9, then we probably need to have parity and add D8 db support. Adding D8 while still supporting early then very much adds to the support burden. Keeping field plugins in D6/D7 is one thing, but then extending it another time into D8 just keeps adding to the code-base. D6 hasn't been supported for a while and we've given ample time to upgrade to D8.
I'm resigned to keeping all of it, but perhaps we need to consider how to segregate the D6 and D7 code out a little more so at some point we can remove it. Or move it to contrib. Much of migrate is BC shims and with what we are wanting to do in #3004480: Migrate in D9, anything we can do to remove legacy support will make support easier and allow us to remove more BC code.
Comment #31
catchThanks for bumping this, thoughts off the top of my head for now:
So Drupal 7 will have official overlap support, and I think we should allow updating from that directly to Drupal 9, based on usage there could still be hundreds of thousands of Drupal 7 sites when 9.0.0 is released.
Drupal 6 it seems like it a good option might be to move the 6.x migrations to a contributed module? Or worst case a site could go 6.x-8.x then to 9.x.
There seem to be three options:
1. 8.last to 9.x using hook_update_N() - this of course depends on what changes might be made.
2. In-place migration using migrate API.
3. External database connection.
Even if we end up offering #1 as an option, I think we should at least offer #2 as well, or #1 might not be possible.
An issue that is sort of a test case for what we need to do is #2336597: Convert path aliases to full featured entities.
If we end up doing that issue by adding a new path alias system without removing the old one, then deprecate the old system (and storage), it might be necessary to add an opt-in migration from the old to the new storage, which then becomes mandatory for moving from 8.x to 9.x (since the old storage would finally be dropped). However that could theoretically be done using any of the above.
Comment #32
gábor hojtsyRe: Drupal 6 support, even if its slated to be removed in Drupal 9, all the work on it would need to be done with refactoring everything else since it is part of Drupal 8 now. That could be avoided if Drupal 6 support is marked deprecated, then it could use deprecated APIs in Drupal 8 but that means when its removed in Drupal 9 and moved to contrib, it would already not be Drupal 9 compatible. The only way to make it Drupal 9 compatible in contrib when Drupal 9 ships is to keep it up to date in core (even if its marked deprecated).
So actually removing it would only save the work that is anticipated to happen *after* Drupal 9 is released then?
Comment #33
effulgentsia commentedJust wondering... If we're able to drop PHP 5 support mid-cycle (i.e., after 8.0 and before 9.0), why can't we also drop D6 migration support mid-cycle? Suppose we made 8.7 the last version to have D6 migrations, then for any D6 sites that haven't yet migrated, is it unreasonable for them to migrate to 8.7 first, then update.php to later versions of 8?
Comment #34
heddn#33++
Comment #35
gábor hojtsyWell, our minor releases are supposed to be backwards compatible. We unfortunately(?) cannot fabricate a world where PHP 5 is still supported and receives security fixes so that is an outside circumstance we are adopting to to keep our users secure. Does such circumstance exist for Drupal 6 migration support?
Comment #36
effulgentsia commentedI think backwards compatibility is for the ongoing operation of a site, including its administrative tools. But a migration from an unsupported version of Drupal is not part of ongoing site operation. In other words, from the perspective of a site, so long as they can go from D6 -> 8.7 -> Current, isn't that effectively backwards compatible?
Comment #37
gábor hojtsyIf you are working on an incremental migration of a Drupal 6 site to 8.x and then before you are done with that and update to 8.x+1 which drops support for such migrations, then it does affect your ongoing operation yes.
Comment #38
gábor hojtsyOr you are a contributed module that extends the D6 migrations in core, and you stop being able to operate with Drupal 8.x+1, that is also not backwards compatible.
Comment #39
heddnI could make a compelling argument that since we have 12 month security support... upgrading to the latest version isn't needed. Especially if we took 8.last-1 as the last to support D6. There would be at least 6 months of security support overlap + 8.last-1 isn't meant as a landing place but as a temporary place during the migration.
Comment #40
mikelutzComment #41
gábor hojtsyComment #42
effulgentsia commentedI discussed this issue with on a call with @alexpott, @catch, Gábor Hojtsy, @plach, and @webchick, and here's where I think we ended up:
update.phpwill work from 8.LAST to 9.0. Therefore, D8 migration sources are not a requirement for opening the Drupal 9 branch.@group legacyto make the test pass.It's of course possible that we as a group didn't understand the full problem space here, or that I got something wrong in writing this up, so please point out if anything here doesn't seem right. Thanks.
Comment #43
gábor hojtsy@effulgentsia: thanks, created #3010983: Deprecate Drupal 6 and Drupal 7 migrations and move to contrib to track that as a distinct issue. Will update #2608062: [META] Requirements for tagging Drupal 9.0.0-alpha1 accordingly.
Comment #44
heddnThe actual D8 source plugin that works with a DB connection issue is #2992746: Support for external databases in `content_entity` migration source?. There is also contrib module https://www.drupal.org/project/migrate_drupal_d8, which might be what we use as the base.
Comment #45
gábor hojtsyNot a requirement for Drupal 9 release, so removing from its parent.
Comment #48
andypost#14 Berdir
It using database tables to migrate data, but instead it could use entity query factory and iterators over result
this way source may provide upgrades from revisionable and translatable layouts for entities or abstract definition with typed data
Comment #50
benjifisherA lot of people are already using JSON:API for D8 -> D8 migrations. It seems to me that improving support for JSON:API as a migration source fits with the "API first" approach.
If we support JSON:API well enough, then we will not need source plugins for D8+. Anyone with an older version of D8 should be able to upgrade to 8.7, then enable JSON:API, then migrate to the current version.
Comment #51
quietone commentedUpdated the IS.
Comment #52
catch#50 sounds really promising.
Comment #53
quietone commentedAt the migrate meeting early this morning it was decided to pursue using the JSON:API, #3150949: Add a migration source plugin for JSON:API
Comment #56
quietone commentedIs there anything that needs to be done here?
We have source plugins for D8/D9, which are being used successfully. Drupal 9 has been released. And there is one child issue and the usual practice is to close when only one issue is left.
Comment #57
wim leers@quietone There's only one child issues, but there are two issues in the issue summary that aren't child issues. So … it's not clear to me what the state/next steps here are 🤓😅
Comment #58
catchWhen I opened this, we weren't even sure if we'd support hook_update_N() from Drupal 8 to Drupal 9, obviously we do now six years later (it's Drupal 8 to Drupal <= 8.7 that we had trouble with...).
What I had in mind when opening this issue though was the ability to migrate an external Drupal 8 site into a new/different one. For example when doing a major revamp, or merging two sites into one, this kind of thing. To enable a workflow where you build an entirely new site, write a migration, run that migration on the old site and save writing hook_update_N() altogether.
I think that use-case is covered by https://www.drupal.org/project/migrate_drupal_d8, and probably by #3150949: Add a migration source plugin for JSON:API too. With both of those, and the existing 8-8 in-site migrations, that's three approaches to the original issue here all of which have working implementations, and potentially two out of three in core.
So, I think we can just close this one - but is there a general issue for what we want to support with migrate API in core once Drupal 6 and 7 migrations are removed?
Comment #59
catchRemoving tag - added that before realising there was nothing else here. Let's close it.
Comment #60
quietone commented@catch, that would be #3114899: Future of migrate in core in a post Drupal 7 world