[openstreetmap/openstreetmap-website] User IDs have inconsistent types in the database (#2211)

Tom Hughes notifications at github.com
Wed Apr 24 11:44:01 UTC 2019

I've attempted @gravitystorm's idea in https://github.com/tomhughes/openstreetmap-website/commit/8a5aca62bf1a8aa076e982416c0767165356d85c and you can see the results at https://travis-ci.org/tomhughes/openstreetmap-website/builds/523928627.

The failing difference is.. interesting... Those tables do not specify a type for the `id` column in our schema. The default changed in rails 5.1 from `integer` to `bigint` but those tables are being created using either the 4.2 or 5.0 compatibility rules so should use the old default (you can see in the migrate output that it set `:id => :integer` to force it) but there seems to be a bug in rails that stops it happening.

Note that although the production database does have `integer` for the column it has `bigint` for the sequence, while my own database had `integer` for both!

There is a second related issue in the production database which is not visible here because I have fixed my own database, which is that prior to rails 4.2 any `string` column without an explicit limit was created as `character varying(255)` by the postgres driver while since rails 4.2 that has defaulted to `character varying` instead. So which you have will depend on which version of rails you were using when the migration was done. There are no backwards compatibility rules in rails for versions before 4.2 so it doesn't even try to fix that.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190424/210e9d57/attachment.html>

More information about the rails-dev mailing list