Forum: Ruby on Rails How to remove column without downtime with ActiveRecord > 3.0?

Posted by UncleGene (Guest)
on 2012-09-23 16:47
(Received via mailing list)
Removing columns from tables while running application with ActiveRecord
causes errors, because ActiveRecord caches column names.

Workaround for ActiveRecord up to 3.0.9 was to override #columns method 
in
the model and filter out deprecated column names before migration
(basically - hide these columns from AR). This worked because all column
name related methods were based on #columns call

In ActiveRecord starting with 3.1.0 caching of table structures is moved 
to
ConnectionPool, and all column name related values (e.g. coluumns_hash) 
are
cached independently.

Is there any way (other than deep-hack of concrete adapters) to achieve
safe column drop in ActiveRecord > 3.0 ?
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.