Forum: Ruby on Rails rake migrate problem

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
doucie (Guest)
on 2007-02-04 15:43
I've created this migrate file.  I run rake migrate from the prompt but
it does not create a table.  Any ideas?

class CreateUsers < ActiveRecord::Migration
  def self.up
    create_table :users do |t|
      t.column :login, :string
      t.column :password, :string
      t.column :email, :string
    add_column :new_queries, :user_id, :integer

  def self.down
    drop_table :users
    remove_column :new_queries, :user_id
unknown (Guest)
on 2007-02-04 16:49
(Received via mailing list)
Hi --

On Sun, 4 Feb 2007, doucie wrote:

>    end
>    add_column :new_queries, :user_id, :integer
>  end
>  def self.down
>    drop_table :users
>    remove_column :new_queries, :user_id
>  end
> end

If it's not giving you an error message, but also not saying it's
creating a table, that probably means it's not running the migration,
and that probably means that for some reason it thinks it's already
done that migration.  You'd have to migrate down and back up again
(and fix any inconsistencies by hand).


Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (
    (See what readers are saying!
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (
doucie (Guest)
on 2007-02-04 19:05
I take it this is down throught the prompt?  What are the commands?
dima (Guest)
on 2007-02-04 20:13
(Received via mailing list)
in your Rails app path
to drop all your migration to the start point: rake db:migrate
to bring up the db: rake db:migrate

To roll the database back to a previous migration version: rake
db:migrate VERSION=X
doucie (Guest)
on 2007-02-04 22:05
I've done the rake db:migrate VERSION=0.
There was not a response in the promp other than giving the directory
where the app is stored.  I still had the schema and users table.
doucie (Guest)
on 2007-02-04 22:08
I've deleted my other table and ran rake migrate again.  This has
worked.  Both tables have been created.  Any dangers of doing this?
monki (Guest)
on 2007-02-05 23:11
(Received via mailing list)
Deleting the tables and remigrating shouldn't cause any problems (as
long as you don't care about the data).

The schema table keeps track of migrations, so by deleting it and
everything else you should be at square one.
This topic is locked and can not be replied to.