Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. SFTP a file called secrets.json to your D8's files/private folder.
    1. Just put this in the file to make a legit json file: {}
  2. In your D8 site's settings.php put this at the bottom:

    Code Block
    # When on Pantheon, connect to a D7 database.
    $migrate_settings = __DIR__ . "/settings.migrate-on-pantheon.php";
    if (file_exists($migrate_settings) && isset($_ENV['PANTHEON_ENVIRONMENT'])) {
     include $migrate_settings;
    }
    
    
    


  3. Create a file called settings.migrate-on-pantheon.php in your D8 sites/default folder and put this in it:

    Code Block
    <?php
    
    $secretsFile = $_SERVER['HOME'] . '/files/private/secrets.json';
    if (file_exists($secretsFile)) {
      $secrets = json_decode(file_get_contents($secretsFile), 1);
    }
    if (!empty($secrets['migrate_source_db__url'])) {
      $parsed_url = parse_url($secrets['migrate_source_db__url']);
      if (!empty($parsed_url['port']) && !empty($parsed_url['host']) && !empty($parsed_url['pass'])) {
        $databases['drupal_7migrate']['default'] = array (
          'database' => 'pantheon',
          'username' => 'pantheon',
          'password' => $parsed_url['pass'],
          'host' => $parsed_url['host'],
          'port' => $parsed_url['port'],
          'driver' => 'mysql',
          'prefix' => '',
          'collation' => 'utf8mb4_general_ci',
        );
      }
    }
    
    
    


  4. Install Terminus and the Terminus Secrets Plugin
  5. Run these commands on your local machine:

    Code Block
    export D7_MYSQL_URL=$(terminus connection:info --field=mysql_url D7-PANTHEON-SITE.PANTHEON-ENV)
    terminus secrets:set D8-PANTHEON-SITE.PANTHEON-ENV migrate_source_db__url $D7_MYSQL_URL
    terminus remote:drush D8-PANTHEON-SITE.PANTHEON-ENV -- migrate-upgrade --legacy-db-key=migrate --configure-only