Remove duplicated local census records on deployment #3829
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
References
Related Pull Requests: #3646
PR #3646 includes a migration that adds an unique database constraint to LocalCensusRecord model so we need to provide a way to remove duplicated records before to apply the new index to database.
Objectives
Remove duplicated local census records automatically during capistrano deployment and before applying new aforementioned migration.
Also provide a rake task to remove duplicated records manually for those Consul installations that are not using caspistrano.
Release notes⚠️
With this PR people using capistrano may not worry about deleting local census records dupicates manually from the database, but people using other deployment strategies that capistrano, for example Heroku, should manually run the rake task
local_census_records:remove_duplicates
before runningdb:migrate
.Production server test results
Deployment test steps:
Below the deployment log that demonstrates this PR is working successfully.