将 drupal 6 迁移到 drupal 7
基本上我们想将 drupal 6 站点的一部分移动到 drupal 7 版本。使用迁移模块。在迁移 155 个节点及其注释和分类(2 个词汇,一个是固定的,另一个是逗号分隔)时,最后 30 个节点失败,给出以下错误:
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 错误 SQLSTATE[HY000]:一般错误:1366 不正确的整数值:列的“” 'tid' 在第 1 行
我正在使用此查询迁移我的术语:
$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');
我对 2 个词汇表执行此操作,然后仅映射名称、格式和重量。然后我在迁移节点时使用此查询:
$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');
然后我为每个词汇表映射 term_list,如下所示:
$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'));
我知道这是由于术语而发生的,因为当我不映射 term_list 时,所有节点都会被创建,但仅此而已。有什么想法吗?
Basically we wanted to move a portion of our drupal 6 site to our drupal 7 build. Using the migrate module. While migrating 155 nodes with their comments and taxonomy(2 vocabs, one is fixed the other is comma seperated) the last 30 fail giving me this error:
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 Error SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'tid' at row 1
I'm migrating my terms using this query:
$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');
I do this for 2 vocabularies, and then I map just the name, format, and weight. Then i'm using this query while migrating the nodes:
$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');
Then i'm mapping the term_list for each vocabulary like this:
$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'));
I know this is happening due to the terms, as when i don't map the term_list all the nodes get created, but thats about it. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是那些没有分配分类法的节点的问题吗?如果是这种情况,请尝试向分类字段映射添加默认值。
在 beer.inc 示例中,注释中记录了这一点:
Is this an issue with those nodes not having a taxonomy assigned to them? If this is the case, try adding a default value to the taxonomy field mapping.
In the beer.inc example, this is documented in the comments: