Would it make sense for rake db:migrate to support creating databases if it is not found, with blessing from user to prevent typos, or as an additional command line switch. Or am I just being too lazy? -- Posted via http://www.ruby-forum.com/.
Lazy but I like the idea. I migrate apps around frequently and creating the db would be good, except whatever user you specify in your database.yml file would need certain privileges... ~ Ben On 5/8/06, Esad Hajdarevic <esad.public@esse.at> wrote:> Would it make sense for rake db:migrate to support creating databases if > it is not found, with blessing from user to prevent typos, or as an > additional command line switch. > > Or am I just being too lazy? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Ben Reubenstein 303-947-0446 http://www.benr75.com
I created a model and specify the columns in the database table. But when I use "rake db:migrate" to migrate the database table. It keeps igoring the command. (but not Aborted) it just does not give any result, and the table was not created in the database. When I tried it in another project folder and did exactly the same thing, it worked. It just does not work in that specific project. Does anyone know what the problem is? Thanks for help. -- Posted via http://www.ruby-forum.com/.
hao min wrote:> I created a model and specify the columns in the database table. But > when I use "rake db:migrate" to migrate the database table. It keeps > igoring the command. (but not Aborted) it just does not give any result, > and the table was not created in the database. > > When I tried it in another project folder and did exactly the same > thing, it worked. It just does not work in that specific project. > > Does anyone know what the problem is? Thanks for help.I think you may be confused about migration. If you "specify the columns in the database table" then you are not using migrations. "rake db:migrate" makes sure your database is up to date by executing the files in db/migrations/xxx_create_some_table.rb 1. ruby script/generate model SomeModel or ruby script/generate migration AddFooToBars 2. Edit the new file in db/migrations that was just created. 3. Now run "rake db:migrate" The database changes you just defined should be applied to your database. -- Posted via http://www.ruby-forum.com/.
> > I think you may be confused about migration. If you "specify the > columns in the database table" then you are not using migrations. > > "rake db:migrate" makes sure your database is up to date by executing > the files in db/migrations/xxx_create_some_table.rb > > 1. ruby script/generate model SomeModel > or > ruby script/generate migration AddFooToBars > > 2. Edit the new file in db/migrations that was just created. > > 3. Now run "rake db:migrate" The database changes you just defined > should be applied to your database.Hi, Alex That is what I have done for my "Order" model. After I generate the model, I edited "create_orders"file in the migration folder and then rake db:migrate The result is like what I described above. -- Posted via http://www.ruby-forum.com/.