i'm not sure if i just completely screwed up my migrations or not.. i
get this error when i try to migrate either up or down from the current
version (going either way adds a column and gives the same error)..
dropping a column seems to be work fine. here's the trace:
[stuart@unitest stuart]$ rake db:migrate VERSION=4 --trace
(in /home/ruby/stuart)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== AddSellableLocationFields: migrating
i'm not sure if i just completely screwed up my migrations or
not.. i get this error when i try to migrate either up or
down from the current version (going either way adds a column
and gives the same error)..
dropping a column seems to be work fine. here's the trace:
Here's the part that's the key:
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_rec
ord/connection_adapters/abstract/schema_statements.rb:259:in
`type_to_sql'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_rec
ord/connection_adapters/abstract/schema_statements.rb:122:in
`add_column'
It had problems converting the type (:int) to sql when adding the
column. So I went to the docs at api.rubyonrails.com, and under
ActiveRecord::Migration docs for add_column, it says this:
] add_column(table_name, column_name, type, options):
] Adds a new column to the table called table_name named
] column_name specified to be one of the following types:
] :string, :text, :integer, :float, :datetime, :timestamp,
] :time, :date, :binary, :boolean. A default value can be
] specified by passing an options hash like { :default =>
] 11 }.
So it looks like you should try :integer instead of :int.
- Mark.
yup, that did it.. thanks for the help. i did note that :integer was
used, but i also saw :int (in the create table blocks for migration)
and i thought they were interchangeable.. good to know they really
aren't.
stuart
Thomas, Mark - BLS CTR wrote: