unicef / etools-issues

0 stars 2 forks source link

Squash migrations #590

Open ewheeler opened 7 years ago

ewheeler commented 7 years ago

after staging (pmp-redesign) is merged into master will be a good time to squash

take opportunity to rename any apps/tables/etc

see also https://github.com/unicef/etools-issues/issues/243

https://github.com/unicef/etools-issues/issues/147

caktus-philip commented 6 years ago

243 not a blocker for this

caktus-philip commented 6 years ago

Here's some relevant notes/research. These were accurate in late October when the task was assigned to me but of course things may have changed since then. Specifically, new migrations might have been added that need special handling.

I found this article a useful overview -- https://simpleisbetterthancomplex.com/tutorial/2016/07/26/how-to-reset-migrations.html

EmailTemplate

There are 5 migrations (audit 0002 & 0007, notification 0002 & 0003, firms 0001) that create EmailTemplate objects. They can be replaced with a single fixture file that's attached to this ticket as emails.json.txt. The attachment fixtures.diff.txt shows where to reference this file. I think the changes to FastTenantTestCase that are in that diff have already been merged.

Noteworthy Migrations

Other than the trigram index, I don’t think you’ll need any other migrations other than the initial ones.

Post-Squash Cleanup

There are a few functions laying around that are only referenced by migrations. When I came across these, I tried to add a comment using the word "squash" so that I could find them later. At present I only see two (both in partners/models.py) but there might be more.

Renaming

There are scattered indications in eTools about desire to take advantage of the squashing to rename things. For instance, there's this ticket: https://github.com/unicef/etools/issues/351

There are also references in the code to things that should get renamed. This is a good way to find them (finds both "rename" and "renaming") --

grep -ri renam *

Here's one I found but forgot to comment on --

emails.json.txt fixtures.diff.txt