diff --git a/data/migrations/V0085__fix_ofec_candidate_totals_mv.sql b/data/migrations/V0085__fix_ofec_candidate_totals_mv.sql index 847492d01..bb0dc5389 100644 --- a/data/migrations/V0085__fix_ofec_candidate_totals_mv.sql +++ b/data/migrations/V0085__fix_ofec_candidate_totals_mv.sql @@ -290,5 +290,7 @@ CREATE INDEX ofec_candidate_totals_with_0s_mv_is_election_idx CREATE INDEX ofec_candidate_totals_with_0s_mv_receipts_idx ON ofec_candidate_totals_with_0s_mv USING btree (receipts); +--MV no longer needed +DROP MATERIALIZED VIEW IF EXISTS ofec_candidate_history_latest_mv diff --git a/manage.py b/manage.py index 8175d6772..552797139 100755 --- a/manage.py +++ b/manage.py @@ -290,7 +290,6 @@ def refresh_materialized(concurrent=True): 'candidate_flags': ['ofec_candidate_flag_mv'], 'candidate_fulltext': ['ofec_candidate_fulltext_mv'], 'candidate_history': ['ofec_candidate_history_mv'], - 'candidate_history_latest': ['ofec_candidate_history_latest_mv'], 'committee_detail': ['ofec_committee_detail_mv'], 'committee_fulltext': ['ofec_committee_fulltext_mv'], 'committee_history': ['ofec_committee_history_mv'], diff --git a/tests/factories.py b/tests/factories.py index 8ebd850ee..9747f5741 100644 --- a/tests/factories.py +++ b/tests/factories.py @@ -58,11 +58,6 @@ class Meta: candidate_inactive = False -class CandidateHistoryLatestFactory(CandidateHistoryFactory): - class Meta: - model = models.CandidateHistoryLatest - - class CandidateElectionFactory(BaseCandidateFactory): class Meta: model = models.CandidateElection diff --git a/webservices/common/models/candidates.py b/webservices/common/models/candidates.py index ed2a60316..49ef185b1 100644 --- a/webservices/common/models/candidates.py +++ b/webservices/common/models/candidates.py @@ -115,20 +115,6 @@ class CandidateHistory(BaseCandidate): active_through = db.Column(db.Integer, doc=docs.ACTIVE_THROUGH) -class CandidateHistoryLatest(BaseCandidate): - __tablename__ = 'ofec_candidate_history_latest_mv' - #Is there any good reason to have this as a separate model? - candidate_id = db.Column(db.String, primary_key=True, index=True) - two_year_period = db.Column(db.Integer, primary_key=True, index=True) - candidate_election_year = db.Column(db.Integer, doc="The last year of the cycle for this election.") - address_city = db.Column(db.String(100)) - address_state = db.Column(db.String(2)) - address_street_1 = db.Column(db.String(200)) - address_street_2 = db.Column(db.String(200)) - address_zip = db.Column(db.String(10)) - candidate_inactive = db.Column(db.Boolean) - - class CandidateTotal(db.Model): __tablename__ = 'ofec_candidate_totals_with_0s_mv' candidate_id = db.Column(db.String, index=True, primary_key=True) diff --git a/webservices/flow.py b/webservices/flow.py index 9f9742923..4c3853977 100644 --- a/webservices/flow.py +++ b/webservices/flow.py @@ -16,7 +16,6 @@ def get_graph(): 'candidate_flags', 'candidate_fulltext', 'candidate_history', - 'candidate_history_latest', 'committee_detail', 'committee_fulltext', 'committee_history', @@ -54,11 +53,6 @@ def get_graph(): graph.add_edge('candidate_history', 'candidate_detail') graph.add_edge('candidate_detail', 'candidate_election') - graph.add_edges_from([ - ('candidate_history', 'candidate_history_latest'), - ('candidate_election', 'candidate_history_latest') - ]) - graph.add_edge('committee_history', 'committee_detail') graph.add_edges_from([