Defect #5154
closedMigrate from Trac with postgresql and more.
0%
Description
When trying to migrate from Trac to Redmine with postgresql database, I received an error:
# rake --trace redmine:migrate_from_trac RAILS_ENV="production" (in /home/redmine-trunk) ** Invoke redmine:migrate_from_trac (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute redmine:migrate_from_trac WARNING: a new project will be added to Redmine during this process. Are you sure you want to continue ? [y/N] y Trac directory []: /home/mike/colstat Trac database adapter (sqlite, sqlite3, mysql, postgresql) [sqlite3]: Trac database encoding [UTF-8]: Target project identifier []: devel Migrating components....rake aborted! incomplete multibyte character /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/postgresql_adapter.rb:400:in `escape' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/postgresql_adapter.rb:400:in `quote_string' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/quoting.rb:19:in `quote' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/postgresql_adapter.rb:391:in `quote' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2392:in `quote_bound_value' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2352:in `replace_bind_variables' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2352:in `gsub' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2352:in `replace_bind_variables' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2341:in `sanitize_sql_array' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2230:in `sanitize_sql' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1494:in `merge_conditions' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1492:in `each' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1492:in `merge_conditions' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1804:in `add_conditions!' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1687:in `construct_finder_sql' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1548:in `find_every' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1505:in `find_initial' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:692:in `exists?' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/validations.rb:827:in `validates_uniqueness_of' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2143:in `with_scope' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2151:in `with_exclusive_scope' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/validations.rb:826:in `validates_uniqueness_of' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/validations.rb:468:in `validates_each' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/validations.rb:465:in `each' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/validations.rb:465:in `validates_each' /var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:182:in `call' /var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:182:in `evaluate_method' /var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:in `call' /var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `run' /var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `each' /var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `send' /var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `run' /var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:276:in `run_callbacks' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/validations.rb:1098:in `valid_without_callbacks?' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/callbacks.rb:315:in `valid?' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/validations.rb:1077:in `save_without_dirty' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/dirty.rb:79:in `save_without_transactions' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:229:in `send' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:229:in `with_transaction_returning_status' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:182:in `transaction' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:228:in `with_transaction_returning_status' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:196:in `save' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:208:in `rollback_active_record_state!' /var/lib/gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:196:in `save' /home/redmine-trunk/lib/tasks/migrate_from_trac.rake:311:in `migrate' /home/redmine-trunk/lib/tasks/migrate_from_trac.rake:306:in `each' /home/redmine-trunk/lib/tasks/migrate_from_trac.rake:306:in `migrate' /home/redmine-trunk/lib/tasks/migrate_from_trac.rake:778 /usr/lib/ruby/1.8/rake.rb:636:in `call' /usr/lib/ruby/1.8/rake.rb:636:in `execute' /usr/lib/ruby/1.8/rake.rb:631:in `each' /usr/lib/ruby/1.8/rake.rb:631:in `execute' /usr/lib/ruby/1.8/rake.rb:597:in `invoke_with_call_chain' /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' /usr/lib/ruby/1.8/rake.rb:590:in `invoke_with_call_chain' /usr/lib/ruby/1.8/rake.rb:583:in `invoke' /usr/lib/ruby/1.8/rake.rb:2051:in `invoke_task' /usr/lib/ruby/1.8/rake.rb:2029:in `top_level' /usr/lib/ruby/1.8/rake.rb:2029:in `each' /usr/lib/ruby/1.8/rake.rb:2029:in `top_level' /usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling' /usr/lib/ruby/1.8/rake.rb:2023:in `top_level' /usr/lib/ruby/1.8/rake.rb:2001:in `run' /usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling' /usr/lib/ruby/1.8/rake.rb:1998:in `run' /usr/bin/rake:28
After studying the issue, I found the cause of the error. It arises from the table "issue_categories".
In our Trac database contains long names for the components, more than 15 characters in the utf8 encoding. And in the database "Redmine" a limit on the size of the column "name" in table "issue_categories" equal to 30 (corresponds to 15 characters in the encoding utf8).
I increased the limit for the column "name" to 255. This immediately decided how this issue, and the problems mentioned earlier: #3392, #4990, maybe #1008.
Potentially, the same problem can arise in the tables: auth_sources, custom_fields, enumerations, issue_statuses, projects, roles, trackers. All these column "name" has a limit of 30.
I propose to make changes in database schema and increase the limit for column "name" to 255.
file migration: 20100323105501_change_name_limit.rb
(put in the directory: db/migrate/)
Files
Related issues