<p>I've attempted <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=360803" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/gravitystorm">@gravitystorm</a>'s idea in <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/tomhughes/openstreetmap-website/commit/8a5aca62bf1a8aa076e982416c0767165356d85c/hovercard" href="https://github.com/tomhughes/openstreetmap-website/commit/8a5aca62bf1a8aa076e982416c0767165356d85c">tomhughes@<tt>8a5aca6</tt></a> and you can see the results at <a href="https://travis-ci.org/tomhughes/openstreetmap-website/builds/523928627" rel="nofollow">https://travis-ci.org/tomhughes/openstreetmap-website/builds/523928627</a>.</p>
<p>The failing difference is.. interesting... Those tables do not specify a type for the <code>id</code> column in our schema. The default changed in rails 5.1 from <code>integer</code> to <code>bigint</code> 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 <code>:id => :integer</code> to force it) but there seems to be a bug in rails that stops it happening.</p>
<p>Note that although the production database does have <code>integer</code> for the column it has <code>bigint</code> for the sequence, while my own database had <code>integer</code> for both!</p>
<p>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 <code>string</code> column without an explicit limit was created as <code>character varying(255)</code> by the postgres driver while since rails 4.2 that has defaulted to <code>character varying</code> 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.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/issues/2211#issuecomment-486188311">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLPJOVFNBR2BAHFNYXLPSBBYDANCNFSM4HGGPRKA">mute the thread</a>.<img src="https://github.com/notifications/beacon/AAK2OLJ47H3A47AS4AX75T3PSBBYDANCNFSM4HGGPRKA.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/openstreetmap/openstreetmap-website","title":"openstreetmap/openstreetmap-website","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/openstreetmap/openstreetmap-website"}},"updates":{"snippets":[{"icon":"PERSON","message":"@tomhughes in #2211: 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.\r\n\r\nThe 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 =\u003e :integer` to force it) but there seems to be a bug in rails that stops it happening.\r\n\r\nNote 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!\r\n\r\nThere 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."}],"action":{"name":"View Issue","url":"https://github.com/openstreetmap/openstreetmap-website/issues/2211#issuecomment-486188311"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/issues/2211#issuecomment-486188311",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/2211#issuecomment-486188311",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>