プロジェクト

全般

プロフィール

Vote #62591

完了

Problem migrating from multiple trac projects

Admin Redmine さんがほぼ2年前に追加. ほぼ2年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Administration_8
対象バージョン:
開始日:
2008/02/03
期日:
進捗率:

0%

予定工数:
category_id:
8
version_id:
1
issue_org_id:
595
author_id:
272
assigned_to_id:
0
comments:
4
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

When multiple trac projects are migrated with @rake redmine:migrate_from_trac@, any project after the first one fails to be migrated. It also appears that no new issues can be created (issues/add page produces 'internal error.') Upon further investigation, both problems appear to be related with the primary key sequences: after the import, the primary key sequence is not reset, and the next object that is created will try to use a duplicate primary key value.

This occurs in a setup using Postgres. I have not tested with any other databases, so it's possible that this problem is particular to Postgres.


journals

I have worked around this problem by modifying @lib/tasks/migrate_from_trac.rake@: I added

<pre>
def self.reset_pk(klass)
klass.connection.reset_pk_sequence!(klass.table_name) if klass.connection.respond_to?('reset_pk_sequence!')
end
</pre>

and for each of the business objects

<pre>
reset_pk WikiContent
reset_pk Wiki
</pre>

etc. After this, I could import multiple projects and create new issues without failure.
--------------------------------------------------------------------------------
This problem was fixed in r1099 for postgresql (it doesn't occur with mysql and sqlite).
Note that only the sequence on the 'issues' table need to be updated.

Btw, I'll change my fix to use reset_sequence! instead. Thanks.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

Admin Redmine さんがほぼ2年前に更新

  • カテゴリAdministration_8 にセット
  • 対象バージョン0.7_1 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0