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

Andy Allan notifications at github.com
Wed Jul 17 13:23:49 UTC 2019


gravitystorm commented on this pull request.



> @@ -1,4 +1,7 @@
 class AddUserImageFingerprint < ActiveRecord::Migration[4.2]
+  class User < ActiveRecord::Base
+  end
+

So what should we do? Breakages from removing paperclip in the near future is the kind of fragility that comes with relying on current model code in migrations.

Of course one option is to reimplement the migration so that it doesn't depend on paperclip at all, i.e. writing some custom code to handle the fingerprint generation. This allows us to remove paperclip yet keeping this migration 100% functional. But it hardly seems worthwhile us of time. 

The second option would be to assume (like I do) that nobody is running that old a version of the database so it's all hypothetical anyway and keep what is written here. It'll work for an empty database but not one with data in it. Same situation will happen when we remove paperclip, even without this change.

And the third option, if we think migrations from this age of database are all hypothetical anyway, is to just ditch these old migrations completely.

-- 
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#discussion_r304397870
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190717/704a3eda/attachment.html>


More information about the rails-dev mailing list