2011-07-08 9 views
1

Fondamentalement, nous voulions déplacer une partie de notre site drupal 6 vers notre drupal 7 build. En utilisant le module migrate. Lors de la migration 155 noeuds avec leurs commentaires et taxonomie (2 Vocabs, on est fixé l'autre est séparées par des virgules) les 30 derniers FAIL me donner cette erreur:Migration de drupal 6 vers drupal 7

291 Error PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'tid' at row 1: INSERT INTO {taxonomy_index} (nid, tid, sticky, created) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ([:db_insert_placeholder_0] => 3057 [:db_insert_placeholder_1] => [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => 1282050381) in taxonomy_field_insert() (line 1675 of /u01/facebase/drupal-7.0/modules/taxonomy/taxonomy.module). 

291 Erreur SQLSTATE [HY000]: Erreur générale: 1366 incorrect valeur entière: « » pour la colonne « tid » à la ligne 1

Je migration mes termes en utilisant cette requête:

$query = db_select("$this->_db.term_data", 'td') 
    ->fields('td', array('tid', 'name', 'weight')) 
    ->condition('v.vid', 7); 
    $query->innerJoin("$this->_db.vocabulary", 'v', 'td.vid=v.vid'); 

Je le fais pour 2 vocabulaires, puis je la carte juste le nom, le format , Et poids. Ensuite, j'utilise cette requête lors de la migration des noeuds:

$query = db_select("$this->_db.node", 'n') 
    ->fields('n', array('nid', 'vid', 'type', 'title', 'uid', 'status', 'created', 'changed', 'comment')) 
    ->fields('tn', array('tid')) 
    ->fields('nr', array('title', 'body', 'teaser')) 
    ->condition('n.type', 'dev_content'); 

    $query->leftJoin("$this->_db.term_node", 'tn', 'tn.vid =n.vid'); 
    $query->leftJoin("$this->_db.node_revisions", 'nr', 'nr.vid = n.vid'); 
    $query->addExpression('GROUP_CONCAT(DISTINCT tn.tid)', 'term_list'); 
    $query->groupBy('n.nid'); 

alors je suis la cartographie de la term_list pour chaque vocabulaire comme ceci:

$this->addFieldMapping('field_dev_tags', 'term_list') 
->separator(',') 
->sourceMigration('DevCenterTerm') 
->arguments(array('source_type' => 'tid')); 

$this->addFieldMapping('field_dev_category', 'term_list') 
->separator(',') 
->sourceMigration('DevCenterTermPrep') 
->arguments(array('source_type' => 'tid')); 

Je sais que cela se produit en raison des termes, comme quand je ne cartographie pas le term_list tous les nœuds sont créés, mais c'est à peu près tout. Des idées?

Répondre

0

Est-ce un problème avec les nœuds qui ne sont pas associés à une taxinomie? Si c'est le cas, essayez d'ajouter une valeur par défaut au mappage du champ de taxonomie.

$this->addFieldMapping('field_dev_category', 'term_list') 
->separator(',') 
->sourceMigration('DevCenterTermPrep') 
->arguments(array('source_type' => 'tid'))->defaultValue(12); 

Dans l'exemple beer.inc, cela est documenté dans les commentaires:

You can also use both together - if a default value is provided in addition to a source field, the default value will be applied to any rows where the source field is empty or NULL.