Liberate annotation projects #5286
Merged
+599
−44
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.
Overview
For too long annotation projects have toiled under the heel of a datamodel we built for an entirely different purpose. No longer! Today, annotation projects raise their voices in unison and demand new tables and equal footing with their platform project brethren! etc. It's late and I'm not committed to this joke.
Anyway, this PR adds a batch job that creates annotation projects from existing projects that are marked as annotation projects.
Checklist
Notes
Why a batch job instead of a migration? Three reasons. Reason 1: I'm going to break staging for annotate to some extent when I move tasks to annotation projects. However, when we create new projects in staging, they'll still become old projects until the switchover is complete in the annotation UI. That means we'll probably have to run the job more than once. Reason 2 is that I looked at rerunnable java migrations and spent 10 minutes trying to get Flyway to know where java migrations were when I wrote them in Scala, and I failed in that 10 minutes, and it didn't seem worth it when I already had another nice rerunnable concept lying around. Reason three is because I was thinking about the sql I'd need to write and started to feel really not pumped about its complexity + the possibility I'd need to do error handling and recovery.
Testing Instructions
For code review, functions are pretty tightly scoped. For a sense of the overall flow, check out
liberateProject
, which is just a for comprehension that combines other actions. Then you can navigate the flow from there.For functionality:
batch/assembly
, wait until it's done..../scripts/console batch 'java -cp /opt/raster-foundry/jars/batch-assembly.jar com.rasterfoundry.batch.Main liberate-annotation-projects http://localhost:8081'
./scripts/load_development_data
./scripts/psql
->update projects set tags = '{ "annotate" }' where id = 'df697018-68ea-4b4e-81b3-50481a4bf15f';
./scripts/console batch 'java -cp /opt/raster-foundry/jars/batch-assembly.jar com.rasterfoundry.batch.Main liberate-annotation-projects http://localhost:8081'
Closes #5281