It's rather convenient using if_exists option for drop_table method in 
migrations. Unfortunately, this option is not allowed for remove_column, 
but can be implemented for PostgreSQL adapter. SQlite3 allows removing 
column twice without complaints. MySQL would still raise an error on second 
attempt to delete the same column as it doesn't support this option.


This PR adds possibility to pass if_exists option to remove_column method 
in migrations for PostgreSQL. So that it's possible to write a migration 
deletes a column and its down step doesn't matter:


class RemoveUserName < ActiveRecord::Migration[5.2]
  def change
    remove_column :users, :name, nil, if_exists: true
  endend


If you support this change, I would appreciate your vote (and approval or 
feedback from maintainers) in this pr: 
https://github.com/rails/rails/pull/34566

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to