[openstreetmap/openstreetmap-website] Models in migrations (#2320)

Andy Allan notifications at github.com
Wed Jul 17 10:45:23 UTC 2019


> I'm certainly more convinced than ever by this that the `strong_migrations` advice to handle removing columns via two commits where you first deploy something to ignore them and then deploy a migration to remove them (which still needs to be marked as unsafe by the way!) is just crazy.

OK, we're getting off topic slightly here, but it's not crazy. If you want to drop a column, you need to first ensure that no running copy of the codebase expects that column to be there. Since each copy reads the database when it boots, and caches the table structure in memory, and makes it part of every copy of that model that it handles, that causes a situation with a few options:

* Drop the column. Get lots of errors in production from the instances that are still trying to use that column. Restart all running app instances as quickly as possible.
* Stop all running app instances. Drop the column. Restart all instances and live with the downtime that just happened.
* Configure the models to ignore the column. Restart the instances with that code. Drop the column at your leisure.

That's why strong_migrations suggests the third option. 



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2320#issuecomment-512202555
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190717/42dc20d5/attachment-0001.html>


More information about the rails-dev mailing list