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

Clean db #670

Merged
merged 9 commits into from
May 6, 2017
24 changes: 24 additions & 0 deletions amgut/db/patches/0041.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
-- May 5th, 2017
-- Stefan Janssen

-- remove tables identified as no longer used in our code base. Most likely, they are left overs from the transition from Oracle to Postgres

-- tables whose names do not show up in codebases of american-gut-web and labadmin (grep name *.py -i)
DROP TABLE ag.ag_animal_survey;
DROP TABLE ag.ag_human_survey;
DROP TABLE ag.ag_import_stats_tmp;
DROP TABLE ag.ag_map_markers;
DROP TABLE ag.ag_participant_exceptions;
DROP TABLE ag.ag_survey_answer;
DROP TABLE ag.ag_survey_multiples;
DROP TABLE ag.ag_survey_multiples_backup;
DROP TABLE barcodes.barcode_exceptions;
DROP TABLE ag.controlled_vocab_values;
DROP TABLE ag.controlled_vocabs;

-- we only delete information from this table, but never read or write. Can't we simply delete the full table then?
DROP TABLE ag.promoted_survey_ids;

-- a table we only read from, but never write. Thus, it is static. Can't we correct information elsewhere and get rid of this table?
-- see discussion: https://github.com/biocore/american-gut-web/issues/669
--DROP TABLE ag.duplicate_consents;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented code

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 and or remove that table?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am back to power now.
I think that this table will contradict with what we are going to implement with the many-to-many relation "source". And since @josenavas thinks that those information have never been validated, I'd like to remove this table. However, @EmbrietteH and @wasade needs to confirm this please.

3 changes: 0 additions & 3 deletions amgut/lib/data_access/ag_data_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,6 @@ def deleteAGParticipantSurvey(self, ag_login_id, participant_name):
participant_name):
self.deleteSample(info['barcode'], ag_login_id)

sql = "DELETE FROM promoted_survey_ids WHERE survey_id IN %s"
TRN.add(sql, [tuple(survey_ids)])

# Delete last due to foreign keys
sql = "DELETE FROM ag_kit_barcodes WHERE survey_id IN %s"
TRN.add(sql, [tuple(survey_ids)])
Expand Down