1
0
Fork 0
forked from OpenNeo/impress

Only run public_data:pull if there are no pending migrations

Oh this was a fun little dev environment bug: I ran `public_data:pull`
on my laptop before migrating my database, so the `items` table pulled
as the latest production version, which included the migrations, but
they hadn't been marked as "run" yet.

So Rails was still telling me I needed to run them, but the migrations
themselves were crashing, with stuff like "there's already a column
with this name!"

This change ensures that `public_data:pull` won't run until migrations
are done, to prevent silly accidents like that.
This commit is contained in:
Emi Matchu 2024-06-18 14:52:54 -07:00
parent 1acb00e35a
commit 4d24a9577f

View file

@ -63,7 +63,7 @@ namespace :public_data do
end
desc "Pull and import the latest public data from production (dev only)"
task :pull => :environment do
task :pull => ["db:abort_if_pending_migrations", :environment] do
unless Rails.env.development?
raise "Can only pull public data in development mode! This helps us " +
"ensure we won't overwrite the production database accidentally."