Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove an empty line from generated migration #38231

Merged

Conversation

@sikachu
Copy link
Member

sikachu commented Jan 14, 2020

Currently, if you run rails g migration remove_column_from_models, there is an empty line before remove_column line because we forgot to use -%> in the template:

$ bin/rails g migration remove_title_from_posts title:string
      invoke  active_record
      create    db/migrate/20200114061235_remove_title_from_posts.rb

$ cat db/migrate/20200114061235_remove_title_from_posts.rb
class RemoveTitleFromPosts < ActiveRecord::Migration[6.1]
  def change

    remove_column :posts, :title, :string
  end
end

This commit adds the missing - in front of -%> to make it removes the empty line.

@rails-bot rails-bot bot added the activerecord label Jan 14, 2020
Currently, if you run `rails g migration remove_column_from_models`,
there is an empty line before `remove_column` line because we forgot to
use `-%>` in the template:

    $ bin/rails g migration remove_title_from_posts title:string
          invoke  active_record
          create    db/migrate/20200114061235_remove_title_from_posts.rb

    $ cat db/migrate/20200114061235_remove_title_from_posts.rb
    class RemoveTitleFromPosts < ActiveRecord::Migration[6.1]
      def change

        remove_column :posts, :title, :string
      end
    end

This commit adds the missing `-` in front of `-%>` to make it removes
the empty line.
@sikachu sikachu force-pushed the sikachu:sikachu/remove-empty-line-remove-column branch from d306c62 to 0ac7b8c Jan 14, 2020
@kamipo kamipo merged commit 00c010c into rails:master Jan 14, 2020
2 checks passed
2 checks passed
build
Details
buildkite/rails Build #66452 passed (11 minutes, 55 seconds)
Details
@sikachu sikachu deleted the sikachu:sikachu/remove-empty-line-remove-column branch Jan 15, 2020
kamipo added a commit that referenced this pull request Jan 20, 2020
…ve-column

Remove an empty line from generated migration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.