Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

convert to one-app-per-cycle #63

Closed
7 tasks done
rshorey opened this issue Jan 8, 2019 · 2 comments
Closed
7 tasks done

convert to one-app-per-cycle #63

rshorey opened this issue Jan 8, 2019 · 2 comments

Comments

@rshorey
Copy link
Collaborator

rshorey commented Jan 8, 2019

  • follow these steps: https://stackoverflow.com/questions/8408046/how-to-change-the-name-of-a-django-app
  • move cycle to a separate cycle-specific settings dir
  • namespace management commands
  • namespace templates (or, optionally, make templates cycle-independent. This could be bad eventually but I think for now it is probably OK)
  • move donors to a separate app
  • write documentation on how to update for 2022
  • run database updates on production
@rshorey rshorey added this to the pre-2020 rollover milestone Jan 8, 2019
@rshorey
Copy link
Collaborator Author

rshorey commented Jan 9, 2019

sql commands to run on production

UPDATE django_content_type SET app_label='cycle_2018' WHERE app_label='fec';

ALTER TABLE fec_candidate RENAME TO cycle_2018_candidate;
ALTER TABLE fec_candidate_id_seq RENAME TO cycle_2018_candidate_id_seq;
ALTER TABLE fec_committee RENAME TO cycle_2018_committee;
ALTER TABLE fec_donor RENAME TO cycle_2018_donor;
ALTER TABLE fec_donor_id_seq RENAME TO cycle_2018_donor_id_seq;
ALTER TABLE fec_filing RENAME TO cycle_2018_filing;
ALTER TABLE fec_filingstatus RENAME TO cycle_2018_filingstatus;
ALTER TABLE fec_inauguralcontrib RENAME TO cycle_2018_inauguralcontrib;
ALTER TABLE fec_inauguralcontrib_id_seq RENAME TO cycle_2018_inauguralcontrib_id_seq;
ALTER TABLE fec_schedulea RENAME TO cycle_2018_schedulea;
ALTER TABLE fec_schedulea_id_seq RENAME TO cycle_2018_schedulea_id_seq;
ALTER TABLE fec_scheduleb RENAME TO cycle_2018_scheduleb;
ALTER TABLE fec_scheduleb_id_seq RENAME TO cycle_2018_scheduleb_id_seq;
ALTER TABLE fec_schedulee RENAME TO cycle_2018_schedulee;
ALTER TABLE fec_schedulee_id_seq RENAME TO cycle_2018_schedulee_id_seq;

UPDATE django_migrations set app='cycle_2018' where app='fec';

INSERT INTO donor_donor (SELECT * FROM cycle_2018_donor);

@rshorey
Copy link
Collaborator Author

rshorey commented Jan 10, 2019

In order to avoid data loss, we've got to create the new donor model, transfer the data, and then remove the old one, so for this issue we'll mark complete when the new model is created and then move the old model deletion to another issue.

@rshorey rshorey closed this as completed Jan 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant