Sha256: 0f405871edc5e0a6ac1c6a4a2a1bc729b98bef4f8d8ea2c6c9cefde1e2045668

Contents?: true

Size: 1.67 KB

Versions: 39

Compression:

Stored size: 1.67 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: add_{columns}_to_{table} or remove_{columns}_from_{table}.

    A migration name containing JoinTable will generate join tables for use with
    has_and_belongs_to_many associations.

    You can also name your migration create_{table} along with any attributes to generate a regular table.

Examples:
    `bin/rails generate migration add_ssl_flag`

    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 add_title_body_published_to_post title:string body:text published:boolean`

    This will create db/migrate/20080514090912_add_title_body_published_to_post.rb with this in the migration:

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

    `bin/rails generate migration create_media_join_table artists musics:uniq`

    This will create a join table migration:

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

    `bin/rails generate migration create_users email:string`

    This will create the migration:

    create_table :users do |t|
      t.string :email
      t.timestamps
    end

Version data entries

39 entries across 39 versions & 5 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/railties-7.1.3.4/lib/rails/generators/rails/migration/USAGE
railties-8.0.1 lib/rails/generators/rails/migration/USAGE
railties-8.0.0.1 lib/rails/generators/rails/migration/USAGE
railties-7.2.2.1 lib/rails/generators/rails/migration/USAGE
railties-7.1.5.1 lib/rails/generators/rails/migration/USAGE
railties-8.0.0 lib/rails/generators/rails/migration/USAGE
railties-7.2.2 lib/rails/generators/rails/migration/USAGE
railties-7.1.5 lib/rails/generators/rails/migration/USAGE
railties-8.0.0.rc2 lib/rails/generators/rails/migration/USAGE
railties-7.2.1.2 lib/rails/generators/rails/migration/USAGE
railties-7.1.4.2 lib/rails/generators/rails/migration/USAGE
railties-8.0.0.rc1 lib/rails/generators/rails/migration/USAGE
railties-7.2.1.1 lib/rails/generators/rails/migration/USAGE
railties-7.1.4.1 lib/rails/generators/rails/migration/USAGE
railties-8.0.0.beta1 lib/rails/generators/rails/migration/USAGE
omg-railties-8.0.0.alpha9 lib/rails/generators/rails/migration/USAGE
omg-railties-8.0.0.alpha8 lib/rails/generators/rails/migration/USAGE
omg-railties-8.0.0.alpha7 lib/rails/generators/rails/migration/USAGE
omg-railties-8.0.0.alpha4 lib/rails/generators/rails/migration/USAGE
omg-railties-8.0.0.alpha3 lib/rails/generators/rails/migration/USAGE