On 7/13/06, Eduardo Yáñez Parareda [email protected] wrote:
What am I doing wrong? Is there a way to run db:migration in order to
Posted via http://www.ruby-forum.com/.
Rails mailing list
Rails uses the schema_info table to determine what migrations to run.
When you drop a table via the command line, it doesn’t update the
schema_info table. The proper way is to run migrate with the version
option. For example if you had
class CreateUsers < ActiveRecord::Migration
create_table :users do |t|
t.column :username, :string, :default => “”, :null => false
t.column :password_salt, :string
t.column :password_hash, :string
t.column :email, :string
And that was in 006_create_user.rb, then you would do
rake db:migrate VERSION=5
to migrate to the version below this one. It would call the down
method, which drops the users table.
Run rake db:migrate --help to see all the options.
http://wiki.rubyonrails.com/rails/pages/UsingMigrations has a lot of
very useful information as well.