remove_column fails with sqlite3
Reported by Corey | October 19th, 2007 @ 07:43 AM
See Railsforum post for more details but the reproduction is simple in rails 1.2.5:
rails testmigrations --database=sqlite3
cd testmigrations
ruby script/generate scaffold_resource person first_name:string last_name:string
ruby script/generate migration remove_last_name
Edit the migration:
class RemoveLastName < ActiveRecord::Migration
def self.up
remove_column "people", "last_name"
end
def self.down
add_column "people", "last_name", :string
end
end
rake db:migrate
no problem
rm db/development.sqlite3
ruby script/plugin install svn://errtheblog.com/svn/plugins/sexy_migrations
rake db:migrate --trace
kaboom:
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== CreatePeople: migrating ====================================================
-- create_table(:people)
-> 0.0020s
== CreatePeople: migrated (0.0021s) ===========================================
== RemoveLastName: migrating ==================================================
-- remove_column("people", "last_name")
rake aborted!
wrong number of arguments (1 for 0)
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/sqlite_adapter.rb:296:in `columns'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/sqlite_adapter.rb:296:in `copy_table'
/Users/corey/Sites/testmigrations/vendor/plugins/sexy_migrations/lib/sexy_migrations.rb:65:in `instance_eval'
/Users/corey/Sites/testmigrations/vendor/plugins/sexy_migrations/lib/sexy_migrations.rb:65:in `create_table'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/sqlite_adapter.rb:295:in `copy_table'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/sqlite_adapter.rb:290:in `move_table'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/sqlite_adapter.rb:283:in `alter_table'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in `transaction'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/sqlite_adapter.rb:282:in `alter_table'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/sqlite_adapter.rb:244:in `remove_column'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/migration.rb:275:in `send'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/migration.rb:275:in `method_missing'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/migration.rb:259:in `say_with_time'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/migration.rb:259:in `say_with_time'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/migration.rb:273:in `method_missing'
./db/migrate//002_remove_last_name.rb:3:in `real_up'
...
Comments and changes to this ticket
-
Chris Wanstrath October 29th, 2007 @ 12:31 PM
- State changed from new to hold
Ouch. Could you investigate and send a patch? That would be much appreciated!
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป