The `content_entity` migration source has been ported from the module `migrate_drupal_d8` which in turn makes the module deprecated. Because this is a port, we would expect the source plugins (deprecated one and core one) to work the same. But, as it turns out, the new core version does not seem to support external Drupal 8 databases, as the module did.
Has this support been dropped intendedly? Is there any other way to get the `content_entity` from Core to connect to a external database? Or is this just a missing feature?
FWIW, I noticed that the deprecated source plugin extends SqlBase (which makes sure we can connect to an external Database) and the core one does not.
Comments
Comment #2
mikeryanGood point! Generally migration is used to pull data into the current Drupal database - if this source plugin is pulling directly out of the current Drupal installation, where are you migrating it *to*?
This source plugin may have some use cases (perhaps to transmogrify data within Drupal, say to convert a node type to a custom entity) - but if we want to migrate into our Drupal install from another one of Drupal 8 and higher, then we need a SqlBase-based class to do that.
Comment #3
quietone commentedYes, there is still work to do for Drupal 8 sources. I think the existing ContentEntity plugin was needed for the entity translation work.
There is a Meta #2607524: [meta] Migrations from Drupal 8 to Drupal 8 and Drupal 8 to Drupal 9 for this and comment-24 there talks about the need for Drupal 8 source plguins.
Comment #4
alanburke commentedYea - this is definitely needed.
Our Drupal 8 projects are at a lifecycle where we are now rebuilding some sites, and need to migrate from old Drupal 8 sites to new Drupal 8 sites [not all data will be retained].
Comment #5
nvakenTo add our use-case: We (mis)use Migrations every now and then to periodically migrate data from one source to the local D8 installation. In our current case, we have a pair of sites that will need to sync one or more content types from a specific central installation. This will be done on-demand. Since these sites could access the central installation's database, it would be a lot easier to be able to just sync directly from that database instead of using JSON / CSV / REST etc... endpoints. This is why we would like to use `content_entity` directly from a external database connection.
Comment #6
heddnI know we can adjust the database dependency. Would overwriting the DB endpoint to use another one during the PHP thread that does the migration make sense? Is it even possible? Then you could just set the db key in the source plugin and when it comes time to read the entity, it just quickly points to the d8 db that is mentioned.
Comment #7
pasqualleI think direct db queries are required to make this works, same as it is done in migrate_drupal_d8 module.
Because as I know it is not possible to use entity queries on a "secondary" database while you are connected to the "primary" database (from where you are running the migration).
Comment #8
pasqualleComment #9
janes_p commentedI would like to add another D8-D8 migration use case (similar to comment #4):
I am stuck with a composer installed D 8.3.9 production site, due to the Symphony dependency issue and with an early drupal-composer/drupal-project setup. I want to migrate to a clean D 8.6 installation with the latest structures.
As my current hosting has memory limitations (SiteGround 1G), I also need to change my hosting (with up to 2G available on A2Hosting) - see memory issue.
Comment #10
janes_p commented"Classic" moving files and DB results in WSOD ("The website encountered an unexpected error. Please try again later.").
I am trying to migrate my D 3.8.9 production site on SiteGround to a clean D 8.6 installation on A2Hosing. So far I was able to set up a migration group and a simple migration (see below), but I can't get to work D8 as source.
migrate_plus.migration_group.santis_general.yml:
migrate_plus.migration.santis_user_role.yml:
I found almost no information about using a D8 database and its entities as a source, e.g. which plugins to use. References to documentation and even better examples would be much appreciated.
Comment #11
pasqualleIf you need an external D8 database as source then the migrate_drupal_d8 module is the only option currently.
Comment #13
darvanenFor anyone following the link above to migrate_drupal_d8, note that the readme *only* exists in the dev branch.
Comment #14
frobWow, this sounds like a problem with the EFQ system. Is there an existing issue to deal with that limitation?
Comment #19
rob230 commentedI'm really confused why the decision was made to make the content_entity migrate source just use entity API of the current site. Seems like a misunderstanding of what migrations are. Why would I need to migrate from the current site to itself? It's useless and I have to use the module that it was ported from instead in order to do a D8>D8 or D8>D9 migration.
Comment #24
acbramley commentedAgree somewhat with #19 (although there definitely are uses for migrate in the current database). Seems very odd not to support D10 -> D10 migrations OOTB.