<p>A recent change to the user model triggered breakages in the database migrations. This is because the migrations have, until now, been using the live model in old migrations. When there is a table name change, or certain column changes, in the live model, this can blow up the old migration.</p>
<p>Instead, it's best practise that if a model is needed during the migration, the model is defined within the migration. This ensures that the model picks up the table name, columns etc that match what's in the database at that stage.</p>
<hr>
<h4>You can view, comment on, or merge this pull request online at:</h4>
<p> <a href='https://github.com/openstreetmap/openstreetmap-website/pull/2320'>https://github.com/openstreetmap/openstreetmap-website/pull/2320</a></p>
<h4>Commit Summary</h4>
<ul>
<li>Avoid using live models in old migrations</li>
<li>Avoid more models in old migrations</li>
</ul>
<h4>File Changes</h4>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2320/files#diff-0">db/migrate/005_tile_tracepoints.rb</a>
(4)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2320/files#diff-1">db/migrate/006_tile_nodes.rb</a>
(8)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2320/files#diff-2">db/migrate/013_add_email_valid.rb</a>
(3)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2320/files#diff-3">db/migrate/039_add_more_controls_to_gpx_files.rb</a>
(4)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2320/files#diff-4">db/migrate/044_create_user_roles.rb</a>
(6)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2320/files#diff-5">db/migrate/046_alter_user_roles_and_blocks.rb</a>
(3)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2320/files#diff-6">db/migrate/051_add_status_to_user.rb</a>
(3)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2320/files#diff-7">db/migrate/20110322001319_add_terms_seen_to_user.rb</a>
(3)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2320/files#diff-8">db/migrate/20120208122334_merge_acl_address_and_mask.rb</a>
(3)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2320/files#diff-9">db/migrate/20120219161649_add_user_image_fingerprint.rb</a>
(3)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2320/files#diff-10">db/migrate/20120808231205_add_counter_caches.rb</a>
(7)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2320/files#diff-11">db/migrate/20121005195010_add_diary_entry_counter_caches.rb</a>
(6)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2320/files#diff-12">db/migrate/20121012044047_add_image_use_gravatar_to_users.rb</a>
(3)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2320/files#diff-13">db/migrate/20150111192335_subscribe_old_changesets.rb</a>
(3)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2320/files#diff-14">db/migrate/20150222101847_rename_openid_url.rb</a>
(3)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2320/files#diff-15">db/migrate/20161011010929_subscribe_authors_to_diary_entries.rb</a>
(3)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/2320/files#diff-16">db/migrate/20180204153242_tile_users.rb</a>
(3)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/2320.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/2320.patch</a></li>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/2320.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/2320.diff</a></li>
</ul>
<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/pull/2320?email_source=notifications&email_token=AAK2OLOBFO6YK7FU6LMOBJLP73XKXA5CNFSM4IEO2V72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G7WCJ7Q">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLLZFK34OEZOYZBV7Z3P73XKXANCNFSM4IEO2V7Q">mute the thread</a>.<img src="https://github.com/notifications/beacon/AAK2OLKG5EZHIRH2EMDJQDLP73XKXA5CNFSM4IEO2V72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G7WCJ7Q.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/2320?email_source=notifications\u0026email_token=AAK2OLOBFO6YK7FU6LMOBJLP73XKXA5CNFSM4IEO2V72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G7WCJ7Q",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/2320?email_source=notifications\u0026email_token=AAK2OLOBFO6YK7FU6LMOBJLP73XKXA5CNFSM4IEO2V72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G7WCJ7Q",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>