要將 Trac 的資料要搬移到 Redmine, 要如何做?
從 Trac 轉換到 Redmine 步驟
環境: Debian、Ubuntu Linux
下述步驟參考自: Redmine - RedmineMigrate - Migrating from other systems
- scp /var/lib/trac/trac_project_name redmine.example.com:/tmp/trac_project_name # 把 trac 整個目錄的資料, 全部 scp 到 redmine 的機器上.
- cd /usr/share/redmine
- sudo rake redmine:migrate_from_trac RAILS_ENV="production" # 執行資料轉換, 不用擔心會影響到現在 redmine 的專案, DB 等等, 在建立時, 是會拆開的, 就算重跑也沒關係.
WARNING: a new project will be added to Redmine during this process.
Are you sure you want to continue ? [y/N] yTrac directory []: /tmp/trac_project_name
Trac database adapter (sqlite, sqlite3, mysql, postgresql) [sqlite]: sqlite3 # 0.11 以上都是 sqlite3
Trac database encoding [UTF-8]:
Target project identifier []: trac_project_name # trac 專案名稱, 也是 redmine 的專案名稱This project already exists in your Redmine database. # 若有重複跑, 會問是否要蓋掉 DB
Are you sure you want to append data to this project ? [Y/n]Migrating components..
Migrating milestones....
Migrating custom fieldsMigrating tickets...... # 有多少 ".", 就有多少 Tickets
Migrating wiki.. # 有多少 ".", 就有多少 WikiComponents: 0/2
Milestones: 0/4
Tickets: 170/170
Ticket files: 2/2
Custom values: 0/0
Wiki edits: 600/619
Wiki files: 6/16 - 到此就已經由 Trac 搬移到 Redmine 完成, 再進入 Redmine 把權限, 人員的關係設定起來即可.
問題
- Wiki 有些語法不同, 所以字得大小、List 的排版會有點不同, 不過大致上都正常, 都還在可以接受的範圍
- Milestone 無法對起來, 進度都是空的.
錯誤排除
若上述轉換時, 有下述錯誤的狀況, 可以依照此步驟來解決.
問題
- cd /usr/share/redmine
- sudo rake redmine:migrate_from_trac RAILS_ENV="production" --trace
(in /usr/share/redmine)
rake aborted!
undefined method `find_each' for #<Class:0x7fecebccc718>
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/base.rb:1835:in
`method_missing'
/usr/share/redmine/lib/tasks/migrate_from_trac.rake:461:in `migrate'
/usr/share/redmine/lib/tasks/migrate_from_trac.rake:764
/usr/lib/ruby/1.8/rake.rb:636:in `call' - 此問題可見 Bug: Redmine - Defect #5087: migrate_from_trac not work on Redmine 0.9.1
解法
- sudo vim /usr/share/redmine/lib/tasks/migrate_from_trac.rake
將 461 行
TracTicket.find_each(:batch_size => 200) do |ticket|
改成
TracTicket.find(:all).each do |ticket| - 再重新跑即可.
相關文章
redmine 真的不錯, 有機會我來寫寫我在 EC2 上面怎麼跑的 😀
剛好我也有寫了一篇 http://bit.ly/fQDlXX
Sean: 等你的寫好, 記得跟我說, 我在來補上去. 😛
xfalcons: 加上去了~ 😀
Migrate #Trac to #Redmine 之解決 wiki format 的相容問題(二), http://t.co/qe66vfN
嗯嗯, 我是用 SQLite, 是沒有遇到這個問題, 不過還是先紀錄起來放. 😀
您好,我在做trac的数据导入redmine的时候一直报错这个,麻烦您能帮我解答么,谢谢
E:\Bitnami\redmine-2.6.9-4\apps\redmine\htdocs>bundle exec rake redmine:migrate_from_trac RAILS_ENV="production"
DL is deprecated, please use Fiddle
WARNING: a new project will be added to Redmine during this process.
Are you sure you want to continue ? [y/N] y
Trac directory []: E:\TRAC\TracSanguo
Trac database adapter (sqlite3, mysql2, postgresql) [sqlite3]:
Trac database encoding [UTF-8]:
Target project identifier []: wslw
This project already exists in your Redmine database.
Are you sure you want to append data to this project ? [Y/n] y
rake aborted!
LoadError: Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (sqlite3 is not part of the bundle. Add it to Gemfile.)
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/sqlite3_adapter.rb:3:in `'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `require'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `block in require'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:236:in `load_dependency'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `require'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in `resolve_hash_connection'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_specification.rb:29:in `spec'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_specification.rb:130:in `establish_connection'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/lib/tasks/migrate_from_trac.rake:713:in `block in establish_connection'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/lib/tasks/migrate_from_trac.rake:710:in `each'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/lib/tasks/migrate_from_trac.rake:710:in `establish_connection'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/lib/tasks/migrate_from_trac.rake:375:in `migrate'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/lib/tasks/migrate_from_trac.rake:776:in `block (2 levels) in '
Gem::LoadError: sqlite3 is not part of the bundle. Add it to Gemfile.
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/sqlite3_adapter.rb:3:in `'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `require'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `block in require'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:236:in `load_dependency'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `require'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in `resolve_hash_connection'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_specification.rb:29:in `spec'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/vendor/bundle/ruby/2.1.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_specification.rb:130:in `establish_connection'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/lib/tasks/migrate_from_trac.rake:713:in `block in establish_connection'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/lib/tasks/migrate_from_trac.rake:710:in `each'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/lib/tasks/migrate_from_trac.rake:710:in `establish_connection'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/lib/tasks/migrate_from_trac.rake:375:in `migrate'
E:/Bitnami/redmine-2.6.9-4/apps/redmine/htdocs/lib/tasks/migrate_from_trac.rake:776:in `block (2 levels) in '
Tasks: TOP => redmine:migrate_from_trac
(See full trace by running task with --trace)
看錯誤訊息,要安裝 sqlite3 adapter
Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter`
已经处理好了,首先要下载sqlite3-1.3.11-x86-mingw32.gem,拷贝到目录apps\redmine\htdocs\vendor\cache下,然后打开文件apps\redmine\htdocs、Gemfile文件,添加一行gem "sqlite3", "1.3.11",打开Bitnami Redmine Stack Environment控制台,输入bundle install --no-deployment --local即可,或者输入bundle install --no-deployment,需要连接网络下载sqlite3-1.3.11-x86-mingw32.gem文件