Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Bedford: Add migration tools for changing school scope #2609

Merged
merged 2 commits into from Sep 19, 2019

Conversation

@kevinrobinson
Copy link
Contributor

kevinrobinson commented Sep 19, 2019

Who is this PR for?

internal team, helping with limiting scope for work related to permissions in New Bedford

What problem does this PR fix?

Folks in New Bedford are focusing training and workshop efforts in particular schools, differently than the previous scope. #2608 updated to match that scope, but this leaves some drift.

We haven't reduced scope like this before, and the school_scope concept in the importers is for supporting incremental deployments, debugging import jobs, or other kinds of partial imports where we only want to update a slice of the db state. So there aren't tools now for migrating previously imported data.

What does this PR do?

Adds SchoolScopeMigrator class, which has methods for understanding the Student and Educator records, and which would currently be in scope and which would currently not be, based on the school definition files. This info can be useful for understanding what's happening, and there are specific methods here for migrating Student and Educator records in response to reducing the scope of the imports. It uses the missing_from_last_export and #active interface on those models.

Separately, these could be purged as part of a more rigorous enforcement of retention policies, but that isn't done here. This is the 'mark' but there is no 'sweeping' here.

Example output:

Finding schools...
There are <N> School records within scope.


Starting Educators...
  Found <N> active and <N> total Educator records.
  Found <N> Educator records within scope...
  Ensuring missing_from_last_export:true for <N> stale Educator records...
  Actually setting missing_from_last_export:true for <N> currently active stale Educator records...
  Done updating Educators.


Starting Students...
  Found <N> active and <N> total Student records.
  Found <N> Student records within scope...
  Ensuring missing_from_last_export:true for <N> stale Student records...
  Actually setting missing_from_last_export:true for <N> currently active stale Student records...
  Done updating Students.


All done.

Checklists

Which features or pages does this PR touch?

  • Core

Does this PR use tests to help verify we can deploy these changes quickly and confidently?

  • Manual testing made more sense here
@kevinrobinson

This comment has been minimized.

Copy link
Contributor Author

kevinrobinson commented Sep 19, 2019

selfie

@kevinrobinson kevinrobinson merged commit 1eb99fa into master Sep 19, 2019
1 check was pending
1 check was pending
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
@kevinrobinson kevinrobinson deleted the feature/school-scope-migrator branch Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.