rails 3 migration error in change_column type -
i trying change column type , getting error. model conf
, , column name xml
. want change :file
:binary
. xml
@ first created text
, i've changed file
similar migration file one. want same thing again , change type binary
getting error.
there migration file:
class changeconfxmlcolumntobinary < activerecord::migration def change_column :confs, :xml, :binary end def down change_column :confs, :xml, :file end end
and error:
== changeconfxmlcolumntobinary: migrating ==================================== -- change_column(:confs, :xml, :binary) rake aborted! error has occurred, , later migrations canceled: undefined method `to_sym' nil:nilclass/home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/schema_definitions.rb:229:in `column' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/connection_adapters/sqlite_adapter.rb:506:in `block (2 levels) in copy_table' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/connection_adapters/sqlite_adapter.rb:500:in `each' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/connection_adapters/sqlite_adapter.rb:500:in `block in copy_table' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/schema_statements.rb:160:in `create_table' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/connection_adapters/sqlite_adapter.rb:498:in `copy_table' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/connection_adapters/sqlite_adapter.rb:488:in `move_table' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/connection_adapters/sqlite_adapter.rb:481:in `block in alter_table' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/connection_adapters/sqlite_adapter.rb:480:in `alter_table' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/connection_adapters/sqlite_adapter.rb:441:in `change_column' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/migration.rb:466:in `block in method_missing' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/migration.rb:438:in `block in say_with_time' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/migration.rb:438:in `say_with_time' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/migration.rb:458:in `method_missing' /home/staj/rails_projects/sample_app/db/migrate/20130826113731_change_conf_xml_column_to_binary.rb:3:in `up' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/migration.rb:410:in `block (2 levels) in migrate' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/migration.rb:410:in `block in migrate' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in `with_connection' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/migration.rb:389:in `migrate' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/migration.rb:528:in `migrate' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/migration.rb:720:in `block (2 levels) in migrate' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/migration.rb:775:in `call' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/migration.rb:775:in `block in ddl_transaction' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/transactions.rb:208:in `transaction' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/migration.rb:775:in `ddl_transaction' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/migration.rb:719:in `block in migrate' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/migration.rb:700:in `each' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/migration.rb:700:in `migrate' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/migration.rb:570:in `up' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/migration.rb:551:in `migrate' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/activerecord-3.2.13/lib/active_record/railties/databases.rake:193:in `block (2 levels) in <top (required)>' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/bin/ruby_noexec_wrapper:14:in `eval' /home/staj/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/bin/ruby_noexec_wrapper:14:in `<main>' tasks: top => db:migrate (see full trace running task --trace)
rake db:rollback
gives same error "-- change_column(:confs, :xml, :text)
" @ beginning
it looks "binary" reserved word. take @ list of reserve words.
the word "binary" reserved word in both mysql & postgresql, if plan on using of these in production you're run problems.
Comments
Post a Comment