From: David Goodlad Date: 2007-02-06T16:31:45+09:00 Subject: Re: Database migration On 2/5/07, Jerry Jones wrote: > Beginner alert..... Starting at the right place will probably help: rails-users for rails, ruby-talk for ruby 'in general' :) > I am working on a database migration. I am adding inventory items to > the table. I have the data, but for the life of me, I cannot remember > where to make this file. I remember how to run the migration etc. > So where do I put the > > class AddUserTable < ActiveRecord::Migration > def self.up > create_table :users do |table| > table.column :name, :string > table.column :login, :string > table.column :password, :string, :limit => 32 > table.column :email, :string > end > end > > def self.down > drop_table :users > end > end I'd suggest using the generator script to give you a good place to put your migrations - in fact, it works well for almost every file that you need to add. In this case: ./script/generate migration add_user_table This would generate db/migrate/001_add_user_table.rb, into which you'd place that code that you posted. Dave -- Dave Goodlad dgoodlad@gmail.com or dave@goodlad.ca http://david.goodlad.ca/