Froze rails gems
[depot.git] / vendor / rails / railties / lib / rails_generator / generators / components / migration / USAGE
1 Description:
2 Stubs out a new database migration. Pass the migration name, either
3 CamelCased or under_scored, and an optional list of attribute pairs as arguments.
4
5 A migration class is generated in db/migrate prefixed by a timestamp of the current date and time.
6
7 You can name your migration in either of these formats to generate add/remove
8 column lines from supplied attributes: AddColumnsToTable or RemoveColumnsFromTable
9
10 Example:
11 `./script/generate migration AddSslFlag`
12
13 If the current date is May 14, 2008 and the current time 09:09:12, this creates the AddSslFlag migration
14 db/migrate/20080514090912_add_ssl_flag.rb
15
16 `./script/generate migration AddTitleBodyToPost title:string body:text published:boolean`
17
18 This will create the AddTitleBodyToPost in db/migrate/20080514090912_add_title_body_to_post.rb with
19 this in the Up migration:
20
21 add_column :posts, :title, :string
22 add_column :posts, :body, :text
23 add_column :posts, :published, :boolean
24
25 And this in the Down migration:
26
27 remove_column :posts, :published
28 remove_column :posts, :body
29 remove_column :posts, :title