Skip to content

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

Merged
kevinrobinson merged 2 commits into
masterfrom
feature/school-scope-migrator
Sep 19, 2019
Merged

kevinrobinson merged 2 commits into
masterfrom
feature/school-scope-migrator

Conversation

@kevinrobinson

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

selfie

@kevinrobinson
kevinrobinson merged commit 1eb99fa into master Sep 19, 2019
@kevinrobinson
kevinrobinson deleted the feature/school-scope-migrator branch September 19, 2019 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant