-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Remove old models #301
Remove old models #301
Conversation
This is step one in removing the party model. We currently have two ways of storing the party of a leaflet: 1. The (old) Party model that requires us syncing parties with a 3rd party data source 2. Pulling in the Party data from YNR when we look up a ballot as part of the uploader. New leaflets use method two, so this migration moves old data inline with new data. It's very possible we decide to denormalize this again in future, but for now I want to reduce complexity and move all data to the same system. I've verified with a prod export that there is no missing data using this method.
c6bba26
to
e3895de
Compare
e3895de
to
f5558b9
Compare
I wanted to remove I think the best option might be to squash / reset all migrations in this project once this PR is merged, then we can remove the library. |
9b1485e
to
0e4b972
Compare
I've tested this on a recent prod DB export and it's working fine, migrations applying in order and I can't see any data loss. I'll also take a snapshot of the prod DB before merging. |
electionleaflets/apps/leaflets/migrations/0006_move_party_model_to_ynr_party.py
Show resolved
Hide resolved
electionleaflets/apps/leaflets/migrations/0006_move_party_model_to_ynr_party.py
Show resolved
Hide resolved
electionleaflets/apps/leaflets/migrations/0008_move_publisher_person_data_to_ynr_id.py
Outdated
Show resolved
Hide resolved
electionleaflets/apps/leaflets/migrations/0008_move_publisher_person_data_to_ynr_id.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will leave it with you to squash the fixups and merge
Nothing in here is being used, the tables aren't in the prod database, and there're not managed, so there's no migrations to write
We're not writing to this model any more, and even if we were it's not clear that it's useful: it's the 2010 boundaries with no ability to version them. We also might not want to filter by constituency anyway. As we have the postcode for every leaflet, we can re-make this in a way that we think is useful, at some point later.
Fixes #273 None of these models did anything
ec882e9
to
6261920
Compare
Party
model and related uk_political_parties
project, migrate data to on-leaflet fields.
#276
Right, this PR is doing a fair amount, but I thought doing it in one would be about as easy to review as doing a whole load. Plus, the ordering matters, as you need to remove FKs from models before we delete them, and I didn't want to keep track of the migration history as we merged them.
At a high level, the pattern here is to collapse the schema down to everything being on the
Leaflet
. This is how we've been writing data for the last few years, so really we're just normalizing to a single schema rather than trying to work with more than one at a time.We need to talk about the future shape of schema, but for now I think collapsing down is easier, and removes a whole load of unused code.
I've also made some other quality of life code changes and tidied up from some previous commits
This PR deals with the following issues:
Party
model and relateduk_political_parties
project, migrate data to on-leaflet fields. #276 (partly, see comment)Constituency
model and related code #269Country
model and related code, replace with NUTS1 codes #273Plus some more drive-by improvements that didn't have issues.