aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails_generator/generators/components/migration/USAGE
blob: c3f8ce09875fee034a85d5fc5d2fadc118a3b601 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Description:
    Stubs out a new database migration. Pass the migration name, either
    CamelCased or under_scored, as an argument. A migration class is generated
    in db/migrate prefixed by the latest migration number.

    You can name your migration in either of these formats to generate add/remove
    column lines: AddColumnToTable or RemoveColumnFromTable

Example:
    `./script/generate migration AddSslFlag`

    With 4 existing migrations, this creates the AddSslFlag migration in
    db/migrate/005_add_ssl_flag.rb

    `./script/generate migration AddSslFlagToAccount`
    
    This will create the AddSslFlagToAccount in db/migrate/005_add_ssl_flag_to_account.rb with
    this in the Up migration:

      add_column :accounts, :ssl_flag, :type, :null => :no?, :default => :maybe?

    And this in the Down migration:
    
      remove_column :accounts, :ssl_flag