Sha256: 1d9b562cf6d5206082206e112e0a5081366eb0f267efcea3bfc2d34d1e3ee32a

Contents?: true

Size: 1.35 KB

Versions: 77

Compression:

Stored size: 1.35 KB

Contents

Description:
    Generates a new database migration. Pass the migration name, either
    CamelCased or under_scored, and an optional list of attribute pairs as arguments.

    A migration class is generated in db/migrate prefixed by a timestamp of the current date and time.

    You can name your migration in either of these formats to generate add/remove
    column lines from supplied attributes: AddColumnsToTable or RemoveColumnsFromTable

Example:
    `bin/rails generate migration AddSslFlag`

    If the current date is May 14, 2008 and the current time 09:09:12, this creates the AddSslFlag migration
    db/migrate/20080514090912_add_ssl_flag.rb

    `bin/rails generate migration AddTitleBodyToPost title:string body:text published:boolean`

    This will create the AddTitleBodyToPost in db/migrate/20080514090912_add_title_body_to_post.rb with this in the Change migration:

      add_column :posts, :title, :string
      add_column :posts, :body, :text
      add_column :posts, :published, :boolean

Migration names containing JoinTable will generate join tables for use with
has_and_belongs_to_many associations.

Example:
    `bin/rails g migration CreateMediaJoinTable artists musics:uniq`

    will create the migration

    create_join_table :artists, :musics do |t|
      # t.index [:artist_id, :music_id]
      t.index [:music_id, :artist_id], unique: true
    end

Version data entries

77 entries across 72 versions & 7 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/railties-7.0.8.6/lib/rails/generators/rails/migration/USAGE
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/railties-7.0.8.7/lib/rails/generators/rails/migration/USAGE
railties-7.0.8.7 lib/rails/generators/rails/migration/USAGE
railties-7.0.8.6 lib/rails/generators/rails/migration/USAGE
railties-6.1.7.10 lib/rails/generators/rails/migration/USAGE
railties-6.1.7.9 lib/rails/generators/rails/migration/USAGE
railties-7.0.8.5 lib/rails/generators/rails/migration/USAGE
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.4/lib/rails/generators/rails/migration/USAGE
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/railties-7.0.5.1/lib/rails/generators/rails/migration/USAGE
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/railties-7.0.5.1/lib/rails/generators/rails/migration/USAGE
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/railties-7.0.5.1/lib/rails/generators/rails/migration/USAGE
railties-7.0.8.4 lib/rails/generators/rails/migration/USAGE
railties-6.1.7.8 lib/rails/generators/rails/migration/USAGE
railties-7.0.8.1 lib/rails/generators/rails/migration/USAGE
railties-6.1.7.7 lib/rails/generators/rails/migration/USAGE
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/railties-7.0.3.1/lib/rails/generators/rails/migration/USAGE
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/generators/rails/migration/USAGE
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/railties-7.0.2.3/lib/rails/generators/rails/migration/USAGE
railties-7.0.8 lib/rails/generators/rails/migration/USAGE
railties-7.0.7.2 lib/rails/generators/rails/migration/USAGE