Oops, fix symlink for /public-data/latest.sql.gz

Oh whoops, I was symlinking to the *full* path of the latest dump,
which includes the site version directory in it. This meant that, if 5
new versions of the app were deployed since the most recently public
data commit (and so that version is deleted), the symlink fails.

In this change, we just symlink to the filename, which behaves as a
relative path and should be completely resilient to deploys changing
where these files ostensibly live!!
This commit is contained in:
Emi Matchu 2024-05-29 19:01:23 -07:00
parent 1e99376449
commit d3d0cda81f

View file

@ -57,7 +57,7 @@ namespace :public_data do
# Link this latest dump as `latest.sql.gz`.
latest_path = Rails.configuration.public_data_root / "latest.sql.gz"
File.unlink(latest_path) if File.symlink?(latest_path)
File.symlink(dest_path, latest_path)
File.symlink(filename, latest_path)
puts "Linked dump to #{latest_path}"
end