<p>That's exactly what rails does - whenever you run a migration if dumps the schema to that file afterwards - the problem is that different developers have different minor variations in their databases that then get reflected in the SQL file.</p>
<p>All it takes is one minor change to a migration that somebody doesn't rerun against their local database and they wind up with a schema locally that is different to other people and which is reflected in future whenever they make another change. Sometimes I think it even comes down to changes in rails defaults and how old your database is (ie what version of rails was used when running certain migrations).</p>
<p>At the very least you wind up with pathnames in the SQL which are tied to where the user happens to have their 3GL libraries installed.</p>
<p>Yes we could do what you suggest and make travis constantly add new commits to bring the SQL back to a clean version but that will produce horrible churn in the git history unless we can somehow also prevent user changes making it through so that we only get the clean versions.</p>
<p>All this is why rails does not generate that file by default - we had to opt in to 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-484381092">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLLK6PGXWK4VCUNJI2DPRAMFNANCNFSM4HGGPRKA">mute the thread</a>.<img src="https://github.com/notifications/beacon/AAK2OLJ2PIXQ3OK3ACY6TMTPRAMFNANCNFSM4HGGPRKA.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: That's exactly what rails does - whenever you run a migration if dumps the schema to that file afterwards - the problem is that different developers have different minor variations in their databases that then get reflected in the SQL file.\r\n\r\nAll it takes is one minor change to a migration that somebody doesn't rerun against their local database and they wind up with a schema locally that is different to other people and which is reflected in future whenever they make another change. Sometimes I think it even comes down to changes in rails defaults and how old your database is (ie what version of rails was used when running certain migrations).\r\n\r\nAt the very least you wind up with pathnames in the SQL which are tied to where the user happens to have their 3GL libraries installed.\r\n\r\nYes we could do what you suggest and make travis constantly add new commits to bring the SQL back to a clean version but that will produce horrible churn in the git history unless we can somehow also prevent user changes making it through so that we only get the clean versions.\r\n\r\nAll this is why rails does not generate that file by default - we had to opt in to that."}],"action":{"name":"View Issue","url":"https://github.com/openstreetmap/openstreetmap-website/issues/2211#issuecomment-484381092"}}}</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-484381092",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/2211#issuecomment-484381092",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>