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

Remove old models #301

Merged
merged 16 commits into from
Dec 11, 2024
Merged

Remove old models #301

merged 16 commits into from
Dec 11, 2024

Conversation

symroe
Copy link
Member

@symroe symroe commented Dec 8, 2024

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:

Plus some more drive-by improvements that didn't have issues.

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.
@symroe symroe force-pushed the remove-old-models branch 2 times, most recently from c6bba26 to e3895de Compare December 9, 2024 14:08
@symroe symroe force-pushed the remove-old-models branch from e3895de to f5558b9 Compare December 9, 2024 14:22
@symroe symroe marked this pull request as ready for review December 9, 2024 14:30
@symroe symroe requested a review from chris48s December 9, 2024 14:30
@symroe
Copy link
Member Author

symroe commented Dec 9, 2024

I wanted to remove uk_political_parties here too, but I think it's going to be hard to do for as long as past migrations rely on it.

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.

@symroe symroe force-pushed the remove-old-models branch 2 times, most recently from 9b1485e to 0e4b972 Compare December 9, 2024 14:44
@symroe
Copy link
Member Author

symroe commented Dec 9, 2024

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.

Copy link
Member

@chris48s chris48s left a 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
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.

2 participants