relaxdiego/redmine_backlogs — Issue #344: Crash on migration to latest version
Author: pauleil
Created: 2011-11-11 19:09:53+00:00
State: open

Having updated to the latest version (today), I get the following when running migration (using RM 1.2.1 and Postgres 8.4.9):

Migrating redmine_backlogs...
== AddStoryPositions: migrating ==============================================
-- create_table(:backlogs_tmp_issue_position)
NOTICE: CREATE TABLE will create implicit sequence "backlogs_tmp_issue_position_id_seq" for serial column "backlogs_tmp_issue_position.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "backlogs_tmp_issue_position_pkey" for table "backlogs_tmp_issue_position"
-> 0.2004s
-- execute("insert into backlogs_tmp_issue_position\n select id, max(position) + id from issues\n where position is null and tracker_id in (1,2,3)")
rake aborted!
An error has occurred, this and all later migrations canceled:

PGError: ERROR: column "issues.id" must appear in the GROUP BY clause or be used in an aggregate function
LINE 2: select id, max(position) + id from issues
^
: insert into backlogs_tmp_issue_position
select id, max(position) + id from issues
where position is null and tracker_id in (1,2,3)
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:520:in `execute'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:352:in `send'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:352:in `method_missing'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:328:in `say_with_time'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:328:in `say_with_time'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:348:in `method_missing'
/usr/local/www/redmine/vendor/plugins/redmine_backlogs/db/migrate/026_add_story_positions.rb:14:in `up_without_benchmarks'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `send'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `migrate'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `migrate'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:365:in `__send__'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:365:in `migrate'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:491:in `migrate'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:565:in `call'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:565:in `ddl_transaction'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:182:in `transaction'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:565:in `ddl_transaction'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:490:in `migrate'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:477:in `each'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:477:in `migrate'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:401:in `up'
/usr/local/www/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:383:in `migrate'
/usr/local/www/redmine/vendor/plugins/engines/lib/engines/plugin/migrator.rb:20:in `migrate_plugin'
/usr/local/www/redmine/config/../vendor/plugins/engines/lib/engines/plugin.rb:93:in `migrate'
/usr/local/www/redmine/lib/tasks/migrate_plugins.rake:8
/usr/local/www/redmine/lib/tasks/migrate_plugins.rake:5:in `each'
/usr/local/www/redmine/lib/tasks/migrate_plugins.rake:5
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19