Skip to content

Instantly share code, notes, and snippets.

@ccyrille
Created February 7, 2018 16:34
Show Gist options
  • Save ccyrille/61d77e74004b39d1484a90b4e7ae7f1f to your computer and use it in GitHub Desktop.
Save ccyrille/61d77e74004b39d1484a90b4e7ae7f1f to your computer and use it in GitHub Desktop.
Zero Downtime - Remove a column
class User < ActiveRecord::Base
...
# << REMOVE ON NEXT RELASE
def self.columns
super.reject { |c| c.name == "removed_column" }
end
# >> REMOVE ON NEXT RELEASE
...
end
@suratpyari
Copy link

Hi. I am using same code and want to remove email from user. But if I do User.first.email it exist. Even User.first.attributes["email"] exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment