Skip to content

Migrate users and taxonomy from an existing site to a fresh installation of the same configuration

License

Notifications You must be signed in to change notification settings

writecrow/corpus_migrate

Repository files navigation

Summary

This module provides a method for migrating the users and taxonomy terms from an existing Drupal 8+ site to a fresh installation of a site with the same configuration (i.e., content types, taxonomy, etc.). This is useful for contexts where you want to drop all node data but retain user information in order to do a reimport of node data, or a migration of that data to a different data structure.

Notes

  • It is the responsibility of the user to migrate all site configuration. The recommended way of achieving this is through configuration management.
  • As a true installation + migration, artifacts such as database logs, State API data, or environment-specific configuration will not be reflected. Only that which is specified to be migrated will be migrated.

Setup

  1. Register a new database connection that you can use as the source. The following example shows a setup using lando, but the principle is the same for all local development:

In .lando.yml:

services:
  source_database:
    type: mysql

In settings.php:

$databases['migrate']['default'] = [
  'database' => $lando_info['source_database']['creds']['database'],
  'username' => $lando_info['source_database']['creds']['user'],
  'password' => $lando_info['source_database']['creds']['password'],
  'host' => $lando_info['source_database']['internal_connection']['host'],
  'prefix' => '',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
];
  1. Import the source database
lando db-import source.sql.gz --host=source_database
  1. Install the site afresh using configuration IDs
lando drush si -y
lando drush config-get "system.site" uuid
lando drush config-set "system.site" uuid <value>
lando drush config-get "language.entity.en" uuid
lando drush config-set "language.entity.en" uuid <value>
lando drush cim -y
  1. Run the migration
lando drush en corpus_migrate -y && lando drush mim

References/adaptations

About

Migrate users and taxonomy from an existing site to a fresh installation of the same configuration

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages