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

Ambidex created an issue. See original summary.

mikeryan’s picture

Good 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.

quietone’s picture

Yes, 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.

alanburke’s picture

Yea - 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].

nvaken’s picture

To 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.

heddn’s picture

I 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.

pasqualle’s picture

I 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).

pasqualle’s picture

Version: 8.5.6 » 8.7.x-dev
janes_p’s picture

I 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.

janes_p’s picture

"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:

uuid: dc458c8f-fde6-46f6-831c-974842cdba7a
langcode: en
status: true
dependencies:
  enforced:
    module:
      - migrate_tools
id: santis_general
label: 'SANTIS General'
description: 'Common configuration for SANTIS migrations.'
source_type: 'Drupal 8'
module: null
shared_configuration:
  source:
    key: migrate

migrate_plus.migration.santis_user_role.yml:

uuid: bdad0b11-08ae-48ac-b654-63d46989e876
langcode: en
status: true
dependencies:
  required:
    module:
      - migrate_drupal
      - migrate_tools
id: santis_user_role
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags:
  - 'Drupal 8'
  - Configuration
migration_group: santis_general
label: 'SANTIS user roles'
source:
  plugin: 'content_entity:user'
  include_translations: true
process:
  id: id
  permissions: permissions
  weight: weight
  is_admin: is_admin
destination:
  plugin: 'entity:user_role'
migration_dependencies:
  required:
    migration_group: santis_general
santisch@nl1-ls3 [~/public_html/s3]# drush ms
 --------------- ------------------------ -------- ------- ---------- ------------- --------------- 
  Group           Migration ID             Status   Total   Imported   Unprocessed   Last Imported  
 --------------- ------------------------ -------- ------- ---------- ------------- --------------- 
 ...
                                                                                                    
  SANTIS          santis_user_role         Idle     N/A     0          N/A           2019-01-       
  General                                                                            04             
  (santis_gener                                                                      07:49:12       
  al)                                                                                               
 --------------- ------------------------ -------- ------- ---------- ------------- ---------------
santisch@nl1-ls3 [~/public_html/s3]# drush mim santis_user_role
 [notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'santis_user_role'

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.

pasqualle’s picture

If you need an external D8 database as source then the migrate_drupal_d8 module is the only option currently.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

darvanen’s picture

For anyone following the link above to migrate_drupal_d8, note that the readme *only* exists in the dev branch.

frob’s picture

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).

Wow, this sounds like a problem with the EFQ system. Is there an existing issue to deal with that limitation?

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

rob230’s picture

I'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.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

acbramley’s picture

Agree somewhat with #19 (although there definitely are uses for migrate in the current database). Seems very odd not to support D10 -> D10 migrations OOTB.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.