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 2 commits into from Sep 19, 2019


Copy link

@kevinrobinson 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.


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

Copy link
Contributor Author

@kevinrobinson kevinrobinson commented Sep 19, 2019


@kevinrobinson kevinrobinson merged commit 1eb99fa into master Sep 19, 2019
1 check was pending
@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
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

1 participant