Project

General

Profile

db migration error

Added by Klaus-Peter Webersinke over 14 years ago

Hi,

after upgrading to the latest trunk via svn and running the db migration, i got the following error:

rake db:migrate RAILS_ENV=production --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
==  ChangeChangesPathLengthLimit: migrating ===================================
-- change_column(:changes, :path, :text, {:null=>false})
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: BLOB/TEXT column 'path' can't have a default value: ALTER TABLE `changes` CHANGE `path` `path` text DEFAULT '' NOT NULL
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract_adapter.rb:219:in `log'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:323:in `execute'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:511:in `change_column'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:352:in `send'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:352:in `method_missing'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:328:in `say_with_time'
c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:328:in `say_with_time'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:348:in `method_missing'
./db/migrate//20100705164950_change_changes_path_length_limit.rb:3:in `up_without_benchmarks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:282:in `send'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:282:in `migrate'
c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:282:in `migrate'
c:1:in `__send__'
c:1:in `migrate'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:486
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:562:in `call'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:562:in `ddl_transaction'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:485:in `migrate'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:472:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:472:in `migrate'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:400:in `up'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:383:in `migrate'
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/databases.rake:116
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
c:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
c:/ruby/bin/rake:19:in `load'
c:/ruby/bin/rake:19

Any idea's how to fix that ?

Many regards
kpw


Replies (39)

RE: db migration error - Added by Felix Schäfer over 14 years ago

There was a problem in trunk with MySQL that should have been corrected by a subsequent revision. What exact svn revision and MySQL version are you using?

RE: db migration error - Added by Felix Schäfer over 14 years ago

There was a problem in trunk with MySQL that should have been corrected by a subsequent revision. What exact svn revision and MySQL version are you using?

RE: db migration error - Added by Klaus-Peter Webersinke over 14 years ago

output from svn info :

URL: http://redmine.rubyforge.org/svn/trunk
Repository Root: http://redmine.rubyforge.org/svn
Repository UUID: e93f8b46-1217-0410-a6f0-8f06a7374b81
Revision: 3840
Node Kind: directory
Schedule: normal
Last Changed Author: edavis10
Last Changed Rev: 3840
Last Changed Date: 2010-07-09 15:46:20 +0200 (Fr, 09 Jul 2010)

RE: db migration error - Added by Klaus-Peter Webersinke over 14 years ago

forgot the mysql version, server mysql version 5.0.67

after getting revision 3854 from svn and running the db migration again, the error still exists.

many regards,
kpw

RE: db migration error - Added by Holger Just over 14 years ago

This is odd...

The migration was created in r3828 and changed in r3830 to please MySQL. The fix then worked for all developers that tested it. It removes the default value for the column. Unless your mysql adapter does something strange, the error you observed should be seen on a fully updated system.

Please mak sure, the content of your db/migrate/20100705164950_change_changes_path_length_limit.rb is exactly the same as this one: source:trunk/db/migrate/20100705164950_change_changes_path_length_limit.rb

If (and only if) this is the case, you could try to add :default => nil to line 3. But as I said, this should really not be needed, as the current version of the migration works good for many people.

--Holger

RE: db migration error - Added by Evgeny Martynenkov over 14 years ago

I have the same problem.
File 20100705164950_change_changes_path_length_limit.rb is the same from trunk
I'm updating from Redmine 0.8 to 1.0 (1.0.0 (RC) (2010-07-18))

May be it halps: At the start of my migration I had problem with plugin http://www.redmine.org/boards/3/topics/4701 . But I solved it install modif. plugin http://www.redmine.org/boards/3/topics/4701#message-14933

How can I do?

RE: db migration error - Added by Evgeny Martynenkov over 14 years ago

And I try to modify 20100705164950_change_changes_path_length_limit.rb like Holger say:

class ChangeChangesPathLengthLimit < ActiveRecord::Migration
  def self.up
    change_column :changes, :path, :text, :null => false, :default => nil
    change_column :changes, :from_path, :text
  end

  def self.down
    change_column :changes, :path, :string, :default => "", :null => false
    change_column :changes, :from_path, :string
  end
end

Not working...

Sorry for my english and my not deep knowledge of Redmine's insides

RE: db migration error - Added by Evgeny Martynenkov over 14 years ago

F:\redmine>set RAILS_ENV=production

F:\redmine>ruby script/about
./script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warn
ing: Gem::Dependency#version_requirements is deprecated and will be removed on o
r after August 2010. Use #requirement
About your application's environment
Ruby version 1.8.7 (i386-mingw32)
RubyGems version 1.3.7
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Application root F:/redmine
Environment production
Database adapter mysql
Database schema version 20100313171051

About your Redmine plugins
ezFAQ plugin 0.3.5
Redmine Queries Group plugin 0.1.7

RE: db migration error - Added by Holger Just over 14 years ago

Evgeny, please tell us which version of MySQL you are using. It seems, Rails ActiveRecord does not fully follow its own standard of not allowing a default value of text columns on mysql...

Could you try to change the migration to the following:

class ChangeChangesPathLengthLimit < ActiveRecord::Migration
  def self.up
    change_column :changes, :path, :text
    change_column :changes, :from_path, :text
  end

  def self.down
    change_column :changes, :path, :string, :default => "", :null => false
    change_column :changes, :from_path, :string
  end
end

With this change, there are no DB constraints on the path column anymore. This should please even the most stubborn MySQL. It should also be enough to enforce db consistency as it is checked in the model class.

If there are any errors, please post a full description here.

RE: db migration error - Added by Felix Prüll over 14 years ago

Hi Holger,

i have exactly the same problem while db-migrating to version 1.0.0 and followed your instructions, but still the same error occurs (see below).

Installed Versions:

C:\redmine_100>mysql --version
mysql Ver 14.12 Distrib 5.0.67, for Win32 (ia32)

C:\redmine_100>ruby script/about
About your application's environment
Ruby version 1.8.6 (i386-mswin32)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Application root C:/redmine_100
Environment production
Database adapter mysql
Database schema version 20100313171051

Errormessage:

C:\redmine_100>rake db:migrate RAILS_ENV=production --trace
(in C:/redmine_100)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
==  ChangeChangesPathLengthLimit: migrating ===================================
-- change_column(:changes, :path, :text)
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: BLOB/TEXT column 'path' can't have a default value: ALTER TABLE `changes` CHANGE `path
` `path` text DEFAULT '' NOT NULL
C:/redmine_100/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:2
19:in `log'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:323:
in `execute'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:511:
in `change_column'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/migration.rb:352:in `send'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/migration.rb:352:in `method_missing'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/migration.rb:328:in `say_with_time'
C:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/migration.rb:328:in `say_with_time'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/migration.rb:348:in `method_missing'
./db/migrate//20100705164950_change_changes_path_length_limit.rb:3:in `up_without_benchmarks'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `send'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `migrate'
C:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `migrate'
C:1:in `__send__'
C:1:in `migrate'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/migration.rb:486:in `migrate'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/migration.rb:562:in `call'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/migration.rb:562:in `ddl_transaction'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/migration.rb:485:in `migrate'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/migration.rb:472:in `each'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/migration.rb:472:in `migrate'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/migration.rb:400:in `up'
C:/redmine_100/vendor/rails/activerecord/lib/active_record/migration.rb:383:in `migrate'
C:/redmine_100/vendor/rails/railties/lib/tasks/databases.rake:116
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
C:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
C:/ruby/bin/rake:19:in `load'
C:/ruby/bin/rake:19

C:\redmine_100>

Any more ideas?
Thanks for your help

Kind Regards
Felix

RE: db migration error - Added by Evgeny Martynenkov over 14 years ago

MySQL v 5.0.67. Windows 2003 R2 SP2
With this mod. of file 20100705164950_change_changes_path_length_limit.rb I saw next error:

F:\redmine>rake db:migrate RAILS_ENV=production --trace
(in F:/redmine)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
rake aborted!
Mysql::Error: Table 'redmine.plugin_schema_info' doesn't exist: SHOW FIELDS FROM
 `plugin_schema_info`
F:/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstr
act_adapter.rb:219:in `log'
F:/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql
_adapter.rb:323:in `execute'
F:/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql
_adapter.rb:469:in `columns'
F:/redmine/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:77:in `t
able'
F:/redmine/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:72:in `t
ables'
F:/redmine/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:63:in `e
ach'
F:/redmine/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:63:in `t
ables'
F:/redmine/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:25:in `d
ump'
F:/redmine/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:19:in `d
ump'
F:/redmine/vendor/rails/railties/lib/tasks/databases.rake:260
F:/redmine/vendor/rails/railties/lib/tasks/databases.rake:259:in `open'
F:/redmine/vendor/rails/railties/lib/tasks/databases.rake:259
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_cal
l_chain'
C:/Ruby187/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_cal
l_chain'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
F:/redmine/vendor/rails/railties/lib/tasks/databases.rake:117
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_cal
l_chain'
C:/Ruby187/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_cal
l_chain'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_excep
tion_handling'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_excep
tion_handling'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
C:/Ruby187/bin/rake:19:in `load'
C:/Ruby187/bin/rake:19

F:\redmine>

RE: db migration error - Added by Evgeny Martynenkov over 14 years ago

I'm trying to use Redmine without any "non-native" plugins.
I deleted folders "redmine_queries_group" and "ezfaq_plugin" in "vendor" dir (I hope that it helps me). Next:

F:\redmine\vendor\plugins>rake db:migrate RAILS_ENV=production --trace
(in F:/redmine)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
rake aborted!
Mysql::Error: Table 'redmine.plugin_schema_info' doesn't exist: SHOW FIELDS FROM
 `plugin_schema_info`
F:/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstr
act_adapter.rb:219:in `log'
F:/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql
_adapter.rb:323:in `execute'
F:/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql
_adapter.rb:469:in `columns'
F:/redmine/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:77:in `t
able'
F:/redmine/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:72:in `t
ables'
F:/redmine/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:63:in `e
ach'
F:/redmine/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:63:in `t
ables'
F:/redmine/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:25:in `d
ump'
F:/redmine/vendor/rails/activerecord/lib/active_record/schema_dumper.rb:19:in `d
ump'
F:/redmine/vendor/rails/railties/lib/tasks/databases.rake:260
F:/redmine/vendor/rails/railties/lib/tasks/databases.rake:259:in `open'
F:/redmine/vendor/rails/railties/lib/tasks/databases.rake:259
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_cal
l_chain'
C:/Ruby187/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_cal
l_chain'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
F:/redmine/vendor/rails/railties/lib/tasks/databases.rake:117
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_cal
l_chain'
C:/Ruby187/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_cal
l_chain'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_excep
tion_handling'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_excep
tion_handling'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
C:/Ruby187/bin/rake:19:in `load'
C:/Ruby187/bin/rake:19

F:\redmine\vendor\plugins>

Where am I stupid?

P.S. "rake db:migrate RAILS_ENV=production" is still not working

RE: db migration error - Added by Holger Just over 14 years ago

Evgeny, please follow RedmineUpgrade, especially Step 4. You need to run

rake db:migrate_plugins RAILS_ENV=production

before your rake db:migrate. Also make sure to have a proper database backup before running any migrations.

Felix, please try the change I proposed above. If it still does not work, we need to come up with a more invasive change...

RE: db migration error - Added by Holger Just over 14 years ago

Evgeny, sorry, missed a bit. The commands would be:

rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production 
rake db:migrate_plugins RAILS_ENV=production 

The first command is the important one.

RE: db migration error - Added by Evgeny Martynenkov over 14 years ago

Holger, sorry, last time I posted wrong log. this is right:

F:\redmine>rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production --trac
e
(in F:/redmine)
** Invoke db:migrate:upgrade_plugin_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate:upgrade_plugin_migrations
rake aborted!
Mysql::Error: Table 'redmine.plugin_schema_info' doesn't exist: SELECT version,
plugin_name FROM plugin_schema_info
F:/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/abstr
act_adapter.rb:219:in `log'
F:/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql
_adapter.rb:323:in `execute'
F:/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql
_adapter.rb:314:in `select_rows'
F:/redmine/vendor/plugins/engines/tasks/engines.rake:65
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_cal
l_chain'
C:/Ruby187/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_cal
l_chain'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_excep
tion_handling'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_excep
tion_handling'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
C:/Ruby187/bin/rake:19:in `load'
C:/Ruby187/bin/rake:19

F:\redmine>

RE: db migration error - Added by Felix Prüll over 14 years ago

Hey,

it worked for me now.
It seemed, that none of the changes affected anything...
so i commented the first few lines of the file 20100705164950_change_changes_path_length_limit.rb, just to see what happens.
Then migration run throuhg without errors.
Afterward i put back the lines, and from then on it worked...

the file now looks like this:

class ChangeChangesPathLengthLimit < ActiveRecord::Migration
  def self.up
    change_column :changes, :path, :text, :null => false
    change_column :changes, :from_path, :text
  end

  def self.down
    change_column :changes, :path, :string, :default => "", :null => false
    change_column :changes, :from_path, :string
  end
end

thanks anyway and sorry for confusion...

Regards
Felix

RE: db migration error - Added by Holger Just over 14 years ago

Felix, each migration is only run once. So if it ran successfully, it is never run again. As you said, you commented the first line, the migration did not fully run and you now might have a mismatch between actual schema and expected schema. Make sure the columns path and from_path in the changes table are actually of type text in your db.

RE: db migration error - Added by Holger Just over 14 years ago

Okay, so I just spent about three hours of my time to setup Windows, Mysql and Redmine on it. Executive summary is: Can't reproduce.

  • I setup a WAMP server on Windows 7 with MySQL 5.0.88 and Ruby 1.8.7
  • Then I installed a fresh Redmine 0.8, created a project and imported the Redmine subversion repository.
  • After that, I upgraded the install to Redmine 1.0 following RedmineUpgrade.

All of these steps went flawlessly. So I can safely say: The migration works even on MySQL 5 on Windows.

RE: db migration error - Added by Klaus-Peter Webersinke over 14 years ago

getting a fresh redmine version from svn, comparing it with the version i used before, and found NO differences in any file, except the svn entries.

now running the migration again and the error still exists.

now after creating a new database ( redmine_test ) and running the db migration on the new database, i get these messages:

c:\RailsApplication\redmine3>rake db:migrate RAILS_ENV=test
(in c:/RailsApplication/redminetest)
Missing these required gems:
  shoulda  ~> 2.10.3
  edavis10-object_daddy
  mocha

You're running:
  ruby 1.8.7.249 at c:/ruby/bin/ruby.exe
  rubygems 1.3.5 at C:/Users/kpw/.gem/ruby/1.8, c:/ruby/lib/ruby/gems/1.8

Run `rake gems:install` to install the missing gems.

Never seen this before, any ideas ?

many regards,
kpw

RE: db migration error - Added by Felix Prüll over 14 years ago

Hi Holger,

Thanks for your reply.
I went through the whole thing once more.
I copied my current Redmine-database to test Redmine 1.0.0
Migrating the DB stopped again at this file 20100705164950_change_changes_path_length_limit.rb

i tried three versions of this file:
1)

class ChangeChangesPathLengthLimit < ActiveRecord::Migration
  def self.up
    change_column :changes, :path, :text, :null => false
    change_column :changes, :from_path, :text
  end

  def self.down
    change_column :changes, :path, :string, :default => "", :null => false
    change_column :changes, :from_path, :string
  end
end

2)
class ChangeChangesPathLengthLimit < ActiveRecord::Migration
  def self.up
    change_column :changes, :path, :text, :null => false, :default => nil
    change_column :changes, :from_path, :text
  end

  def self.down
    change_column :changes, :path, :string, :default => "", :null => false
    change_column :changes, :from_path, :string
  end
end

3)
class ChangeChangesPathLengthLimit < ActiveRecord::Migration
  def self.up
    change_column :changes, :path, :text
    change_column :changes, :from_path, :text
  end

  def self.down
    change_column :changes, :path, :string, :default => "", :null => false
    change_column :changes, :from_path, :string
  end
end

i always get the same error:
Mysql::Error: BLOB/TEXT column 'path' can't have a default value: ALTER TABLE `changes` CHANGE `path` `path` text DEFAULT '' NOT NULL
(see trace-output above)[[http://www.redmine.org/boards/2/topics/15654#message-15698]]

again my setup:

C:\redmine_100>mysql --version
mysql Ver 14.12 Distrib 5.0.67, for Win32 (ia32)

C:\redmine_100>ruby script/about
About your application's environment
Ruby version 1.8.6 (i386-mswin32)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Application root C:/redmine_100
Environment production
Database adapter mysql
Database schema version 20100313171051

Thanks for any ideas to solve this...
Kind Regards
Felix

RE: db migration error - Added by Nicolas Gauthier over 14 years ago

Hi,

I have exactly the same problem...

mysql Ver 14.12 Distrib 5.0.81, for Win32 (ia32)

Rack version 1.0.1
Rails version 2.3.5
ruby 1.8.6 (i386-mswin32)
Rake 0.8.7

Nicolas

RE: db migration error - Added by Daniel Morgan over 14 years ago

Hello,
I also have the exact same problem upgrading from redmine-0.9.6 to redmine-1.0.0 downloaded from Rubyforge.

MySQL version: 14.12 Distrib 5.0.77, for Win32 (ia32)
Ruby version: 1.8.7 (i386-mswin32)
Rails version: 2.3.5
Rack version: 1.0.1
Rake version: 0.8.7

Best Regards,
Dan

RE: db migration error - Added by Alan Liu over 14 years ago

Mysql::Error: BLOB/TEXT column 'path' can't have a default value: ALTER TABLE `changes` CHANGE `path` `path` text DEFAULT '' NOT NULL

I also have the exact same problem upgrading from redmine-0.9.6 to redmine-1.0.0 downloaded from Rubyforge.

D:\workspace\redmine-1.0.0>mysql --version
mysql Ver 14.12 Distrib 5.0.90, for Win32 (ia32)

D:\workspace\redmine-1.0.0>ruby script/about
About your application's environment
Ruby version 1.8.6 (i386-mswin32)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Application root D:/workspace/redmine-1.0.0
Environment development
Database adapter mysql
Database schema version 20100221100219

RE: db migration error - Added by Felix Schäfer over 14 years ago

Could you please all post what windows versions (XP, 2003, Vista, 7) you are using and if they are 32 or 64 bit? We are aware that mysql is a pain in the a.. is weird with defaults on text columns and are trying to reproduce the problem (Holger did at least) but didn't have any success with it.

RE: db migration error - Added by Felix Prüll over 14 years ago

Hello,

We run redmine one a Windows Server 2008 Web Edition SP2 with 32 bit. I hope this helps to reproduce the error...

Thanks and Regards
Felix

(1-25/39)