Coder Social home page Coder Social logo

drupal8-migrate's Introduction

Usage

  • git clone the repo
  • run "composer install"
  • set up a virtual host pointing to the web folder in apache/nginx

Set the path to the drupal configuration

  • in settings.php adapt the path to the config folder
$config_directories['sync'] = 'sites/default/config_migrate/sync';

Do a site install with drush

Drush 8 ist required.

drush site-install  config_installer \
--db-url=mysql://DBUSERNAME:[email protected]/some_db \
--account-mail="[email protected]" \
--account-name=admin \
--account-pass=some_admin_password \
--site-mail="[email protected]" \
--site-name="Site-Install"

If you correctly set up the path in settings.php to the config folder, all settings will be imported during the site install.

Update configuration yml

Because of the CMI all yml files in the config/install directory are only imported when installing the module. This is very impractical if one want to develop new configuration files. To solve this, a module "Configuration Development" is part of this installation. It is possible to import certain yml files on every request. But unfortunatly drush commands are not supported. So we need to add this files we want to import to a new section in our module.info.yml.

config_devel:
  install:
    - migrate_plus.migration.page_node
    - migrate_plus.migration.menu_item
    - migrate_plus.migration_group.liip

Then we can run the following commands after updating the yml file. This will import the new configuration file into CMI.

drush cdi migrate_menu
drush cr

Migration tasks

drush migrate-status (ms) drush migrate-import (mi)

drush mi page_node
drush mi menu_item --update

Task for the Hackday:

Let's write an importer for a json source, usually a rest interface.

I propose we use this JSON data: http://jsonplaceholder.typicode.com/posts

Import the posts into a node type "post"

Then we import the comments referencing the posts. http://jsonplaceholder.typicode.com/comments

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.