Db:migrate non-functional?


#1

Am new to rails, but catching up fast.
i have developed my model

…generate model people


class CreatePeoples < ActiveRecord::Migration
def self.up
create_table :peoples do |t|
t.column :name, :string
t.column :hashed_password, :string
t.column :salt, :string
end
end

def self.down
drop_table :peoples
end
end

blah blah… rake db:migrate

all life signals confirmed to be ok
no errors generated by rake command

but ooops when i check the database … no table was actually created
despite
running a successful rake

schema.rb seems to record a table creation but actually no table was
created when i check in the database.

can somebody help in explaining?
thanks


#2

If you previously ran this migration and it failed, the schema version
might be set to the migration that you are running. i.e. This
migration is being ignored.

Try:
rake db:migrate VERSION=X
where X is a previous migration.

To roll the whole thing back:
rake db:migrate VERSION=0

Or if you’re using sqlite3, simply delete the file and run the
migrations again

hth

create_table :peoples do |t|

On a different note ActiveRecord would probably be happier with a
singular “Person” and plural “People”


#3

toby privett wrote:

If you previously ran this migration and it failed, the schema version
might be set to the migration that you are running. i.e. This
migration is being ignored.

Try:
rake db:migrate VERSION=X
where X is a previous migration.

To roll the whole thing back:
rake db:migrate VERSION=0

Or if you’re using sqlite3, simply delete the file and run the
migrations again

hth

create_table :peoples do |t|

On a different note ActiveRecord would probably be happier with a
singular “Person” and plural “People”

it has worked!
, thanks a lot and i love this forum!