Forum: Ruby Database migration

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.
Aef7a7099755661a0823054a8952d43b?d=identicon&s=25 Jerry Jones (Guest)
on 2007-02-06 02:40
(Received via mailing list)
Beginner alert.....
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

    def self.down
      drop_table :users
8b66530927e39b74a7ecc079e0d7a734?d=identicon&s=25 David Goodlad (Guest)
on 2007-02-06 08:32
(Received via mailing list)
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' :)

>         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.

97cbca14d17274370cce501bbea7980a?d=identicon&s=25 Mike Harris (gfunk911)
on 2007-02-06 17:56
(Received via mailing list)
Jerry Jones wrote:

>        table.column :login,  :string
The db\migrate folder.  Make a migration with ruby script\generate
migration AddUserTable.

Read the docs ( and please direct further
questions to the Rails mailing list.
This topic is locked and can not be replied to.