6

I am migrating my taxonomy and users from d6 site to d7 site. How can I set the legacy connection of source db of d6 site.

The user is root and password id empty with source database name as d6 for the Drupal 6 site.

hook_flush_caches().

 $common_arguments = array(
        'source_connection' => 'd6_migration',
        'source_version' => 6,
      );

will it migrate data from d6 to d7 when I install the custom migrate_d6 module in Drupal 7 site?

My Settings file of Destination project is

$databases = array (
  'default' => 
  array (
    'default' => 
    array (
      'database' => 'd7',
      'username' => 'root',
      'password' => '',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),  
  'd6_migration' => 
  array (
    'default' => 
    array (
      'database' => 'd6',
      'username' => 'root',
      'password' => '',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);
  • I tried changing the key second key value and I got some errors which is better than nothing at all pastebin.com/LLgxW53X – vishal Sep 30 '13 at 18:37
  • The code you have is correct. From the errors you list below it seems you have issues with your drupal 6 database. Are you sure you have the full database and it is not corrupt in any way and you don't have a prefix for the tables? – rooby Oct 1 '13 at 1:03
10
+50

The migrate module provides basic migrate functionality while the migrate_d2d module extends on that functionality providing interfaces for reading and importing into Drupal 5, 6 and 7. Migrate comes with Drush integration and supports rolling back migrations which is very handy during development.

Add the following code into your settings.php file or you can specify database connection details within your migration scripts:

<?php 
// Our Drupal 7 database configuration.
$databases = array (   
'default' =>
  array (
    'default' =>
    array (
      'database' => 'db_drupal7',
      'username' => 'drupal7_user',
      'password' => '',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
  // Here we add in the connection to our Drupal 6 database.
  'legacy' =>;
  array (
    'default' =>;
    array (
      'database' => 'db_drupal6',
      'username' => 'drupal6_user',
      'password' => '',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

If you want to create the script for migrating the content than please have look at this useful tutorials:

http://devblog.com.au/migrating-drupal-6-to-drupal-7-with-the-migration-framework https://drupal.org/node/1813498


Personal suggestion: Now the migrate_d2d module is providing a stable UI for migration the contents and that is very easy to do as well, have a look at it documentation here: https://drupal.org/node/1813498

Also if you have a larger database than you can use the drush commands to migrate the contents after setting up the database connections, the list of drush commands for migrating the content: https://drupal.org/node/1561820

  • I tried ur method but i am getting an error "PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'source6.filter_formats' doesn't exist: SELECT f.format AS format, f.name AS name FROM {filter_formats} f; Array ( ) in DrupalVersion6->getDefaultFormatMappings() (line 30 of /home/vishal/Dropbox/sites/destination7/sites/all/modules/migrate_d2d/d6/d6.inc)." – vishal Sep 30 '13 at 19:14
  • @vishal It seems you are half done as the source connection is correctly taking place (which was your main concern) otherwise you wont be getting this error. Now coming to error, the reason of this error is "filter format table does not exists in you drupal 6 installaton", Have you manually removed it, otherwise this table is by default created on drupal installation, this is the screenshot of table: awesomescreenshot.com/00a1rx24ec So may you be you try importing only the "format filter" table from the fresh drupal installation of drupal 6. And that must contain the required formats – Ankit Agrawal Oct 1 '13 at 3:00
  • yes the able was deleted that was the issue thank you. – vishal Oct 1 '13 at 13:43
  • its not allowing me for another 2 hrs. will do it once I am allowed :) – vishal Oct 1 '13 at 15:52
3

You can enter the db connection inside the module without having to change the settings.php file, like this:

$common_arguments = array(    
'source_version' => 6,
'source_connection' => 'legacy',
'source_database' =>  array('driver' => 'mysql','database' => 'dbname','username' => 'dbuser','password' => 'dbpass','host' => 'localhost','prefix' => '',)

);

I hope this will help you

Ciao r.

  • does this work for localhost(offline server on my computer) to remote server? – weber85 Jul 3 '13 at 7:56
  • this did not work for me. – vishal Sep 30 '13 at 18:35
  • FWIW, this is essentially what the module documentation describes, here: drupal.org/node/1813498 Works as expected. – Screenack Nov 11 '15 at 19:38
3

Can you please delete the semicolons after 'legacy' => and 'default' =>? This is almost the only settings.php example you find by google. Yeah, the error is already in http://devblog.com.au/migrating-drupal-6-to-drupal-7-with-the-migration-framework where you cited from. It should look like this: 'default' => array ( 'default' => array ( 'database' => 'db_drupal7', 'username' => 'drupal7_user', 'password' => '', 'host' => 'localhost', 'port' => '', 'driver' => 'mysql', 'prefix' => '', ), ), // Here we add in the connection to our Drupal 6 database. 'legacy' => array ( 'default' => array ( 'database' => 'db_drupal6', 'username' => 'drupal6_user', 'password' => '', 'host' => 'localhost', 'port' => '', 'driver' => 'mysql', 'prefix' => '', ), ), ); Thank you for the example. Rare that nobody have noticed this before :-) Drush directly shows errors for the two semicolons. Sorry, that i'm not writting a comment to your post. I've not enough bucks. 50 is minimum.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.