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 end add_column :new_queries, :user_id, :integer end def self.down drop_table :users remove_column :new_queries, :user_id end end
on 2007-02-04 14:43
on 2007-02-04 15:49
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). David -- Q. What is THE Ruby book for Rails developers? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)
on 2007-02-04 18:05
I take it this is down throught the prompt? What are the commands?
on 2007-02-04 19:13
in your Rails app path to drop all your migration to the start point: rake db:migrate VERSION=0 to bring up the db: rake db:migrate To roll the database back to a previous migration version: rake db:migrate VERSION=X
on 2007-02-04 21: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.
on 2007-02-04 21: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?
on 2007-02-05 22:11
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.