Skip to content

Commit b28670d

Browse files
authored
Clean db files add human reads filter method (#3421)
* Update CHANGELOG.md * clean db files + add human_reads_filter_method * fix db errors * modify inserts to be in the correct order
1 parent 751e559 commit b28670d

File tree

6 files changed

+244
-101
lines changed

6 files changed

+244
-101
lines changed

qiita_db/support_files/patches/92.sql

+25
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,28 @@ ALTER TABLE qiita.qiita_user
3939
ADD creation_timestamp timestamp without time zone DEFAULT NOW();
4040

4141
COMMENT ON COLUMN qiita.qiita_user.creation_timestamp IS 'The date the user account was created';
42+
43+
-- Jun 28, 2024
44+
-- These columns were added by mistake to qiita-db-unpatched.sql in PR:
45+
-- https://github.com/qiita-spots/qiita/pull/3412 so adding here now
46+
47+
ALTER TABLE qiita.qiita_user ADD social_orcid character varying DEFAULT NULL;
48+
ALTER TABLE qiita.qiita_user ADD social_researchgate character varying DEFAULT NULL;
49+
ALTER TABLE qiita.qiita_user ADD social_googlescholar character varying DEFAULT NULL;
50+
51+
-- Add human_reads_filter_method so we can keep track of the available methods
52+
-- and link them to the preparations
53+
54+
CREATE TABLE qiita.human_reads_filter_method (
55+
human_reads_filter_method_id bigint NOT NULL,
56+
human_reads_filter_method_method character varying NOT NULL,
57+
CONSTRAINT pk_human_reads_filter_method_id PRIMARY KEY (
58+
human_reads_filter_method_id )
59+
);
60+
61+
ALTER TABLE qiita.prep_template
62+
ADD human_reads_filter_method_id bigint DEFAULT NULL;
63+
ALTER TABLE qiita.prep_template
64+
ADD CONSTRAINT fk_human_reads_filter_method
65+
FOREIGN KEY ( human_reads_filter_method_id )
66+
REFERENCES qiita.human_reads_filter_method ( human_reads_filter_method_id );

qiita_db/support_files/patches/test_db_sql/92.sql

+9-4
Original file line numberDiff line numberDiff line change
@@ -929,11 +929,16 @@ INSERT INTO qiita.slurm_resource_allocations(processing_job_id, samples, columns
929929

930930
-- for testing: provide creation date for one of the existing users
931931

932-
UPDATE qiita.qiita_user SET creation_timestamp = '2015-12-03 13:52:42.751331-07' WHERE email = '[email protected]';
932+
UPDATE qiita.qiita_user SET
933+
social_orcid = '0000-0002-0975-9019',
934+
social_researchgate = 'Rob-Knight',
935+
social_googlescholar = '_e3QL94AAAAJ',
936+
creation_timestamp = '2015-12-03 13:52:42.751331-07'
937+
WHERE email = '[email protected]';
933938

934939
-- Jun 20, 2024
935940
-- Add some non-verified users to the test DB to test new admin page: /admin/purge_users/
936941

937-
INSERT INTO qiita.qiita_user VALUES ('[email protected]', 5, '$2a$12$gnUi8Qg.0tvW243v889BhOBhWLIHyIJjjgaG6dxuRJkUM8nXG9Efe', 'JustNow', 'NonVeriUser', '1634 Edgemont Avenue', '303-492-1984', NULL, NULL, NULL, false, NULL, NULL, NULL, NOW());
938-
INSERT INTO qiita.qiita_user VALUES ('[email protected]', 5, '$2a$12$gnUi8Qg.0tvW243v889BhOBhWLIHyIJjjgaG6dxuRJkUM8nXG9Efe', 'Oldie', 'NonVeriUser', '172 New Lane', '102-111-1984', NULL, NULL, NULL, false, NULL, NULL, NULL, NOW() - INTERVAL '1 YEAR');
939-
INSERT INTO qiita.qiita_user VALUES ('[email protected]', 5, '$2a$12$gnUi8Qg.0tvW243v889BhOBhWLIHyIJjjgaG6dxuRJkUM8nXG9Efe', 'TooLate', 'NonVeriUser', '564 C Street', '508-492-222', NULL, NULL, NULL, false, NULL, NULL, NULL, NOW() - INTERVAL '30 DAY');
942+
INSERT INTO qiita.qiita_user VALUES ('[email protected]', 5, '$2a$12$gnUi8Qg.0tvW243v889BhOBhWLIHyIJjjgaG6dxuRJkUM8nXG9Efe', 'JustNow', 'NonVeriUser', '1634 Edgemont Avenue', '303-492-1984', NULL, NULL, NULL, false, NOW(), NULL, NULL, NULL);
943+
INSERT INTO qiita.qiita_user VALUES ('[email protected]', 5, '$2a$12$gnUi8Qg.0tvW243v889BhOBhWLIHyIJjjgaG6dxuRJkUM8nXG9Efe', 'Oldie', 'NonVeriUser', '172 New Lane', '102-111-1984', NULL, NULL, NULL, false, NOW() - INTERVAL '1 YEAR', NULL, NULL, NULL);
944+
INSERT INTO qiita.qiita_user VALUES ('[email protected]', 5, '$2a$12$gnUi8Qg.0tvW243v889BhOBhWLIHyIJjjgaG6dxuRJkUM8nXG9Efe', 'TooLate', 'NonVeriUser', '564 C Street', '508-492-222', NULL, NULL, NULL, false, NOW() - INTERVAL '30 DAY', NULL, NULL, NULL);

qiita_db/support_files/populate_test_db.sql

+5-5
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ INSERT INTO qiita.user_level VALUES (7, 'wet-lab admin', 'Can access the private
5050
-- Data for Name: qiita_user; Type: TABLE DATA; Schema: qiita; Owner: antoniog
5151
--
5252

53-
INSERT INTO qiita.qiita_user VALUES ('[email protected]', 4, '$2a$12$gnUi8Qg.0tvW243v889BhOBhWLIHyIJjjgaG6dxuRJkUM8nXG9Efe', 'Dude', 'Nowhere University', '123 fake st, Apt 0, Faketown, CO 80302', '111-222-3344', NULL, NULL, NULL, false, '0000-0002-0975-9019', 'Rob-Knight', '_e3QL94AAAAJ');
54-
INSERT INTO qiita.qiita_user VALUES ('[email protected]', 4, '$2a$12$gnUi8Qg.0tvW243v889BhOBhWLIHyIJjjgaG6dxuRJkUM8nXG9Efe', 'Shared', 'Nowhere University', '123 fake st, Apt 0, Faketown, CO 80302', '111-222-3344', NULL, NULL, NULL, false);
55-
INSERT INTO qiita.qiita_user VALUES ('[email protected]', 1, '$2a$12$gnUi8Qg.0tvW243v889BhOBhWLIHyIJjjgaG6dxuRJkUM8nXG9Efe', 'Admin', 'Owner University', '312 noname st, Apt K, Nonexistantown, CO 80302', '222-444-6789', NULL, NULL, NULL, false);
56-
INSERT INTO qiita.qiita_user VALUES ('[email protected]', 4, '$2a$12$gnUi8Qg.0tvW243v889BhOBhWLIHyIJjjgaG6dxuRJkUM8nXG9Efe', 'Demo', 'Qiita Dev', '1345 Colorado Avenue', '303-492-1984', NULL, NULL, NULL, false);
53+
INSERT INTO qiita.qiita_user VALUES ('[email protected]', 4, '$2a$12$gnUi8Qg.0tvW243v889BhOBhWLIHyIJjjgaG6dxuRJkUM8nXG9Efe', 'Dude', 'Nowhere University', '123 fake st, Apt 0, Faketown, CO 80302', '111-222-3344', NULL, NULL, NULL);
54+
INSERT INTO qiita.qiita_user VALUES ('[email protected]', 4, '$2a$12$gnUi8Qg.0tvW243v889BhOBhWLIHyIJjjgaG6dxuRJkUM8nXG9Efe', 'Shared', 'Nowhere University', '123 fake st, Apt 0, Faketown, CO 80302', '111-222-3344', NULL, NULL, NULL);
55+
INSERT INTO qiita.qiita_user VALUES ('[email protected]', 1, '$2a$12$gnUi8Qg.0tvW243v889BhOBhWLIHyIJjjgaG6dxuRJkUM8nXG9Efe', 'Admin', 'Owner University', '312 noname st, Apt K, Nonexistantown, CO 80302', '222-444-6789', NULL, NULL, NULL);
56+
INSERT INTO qiita.qiita_user VALUES ('[email protected]', 4, '$2a$12$gnUi8Qg.0tvW243v889BhOBhWLIHyIJjjgaG6dxuRJkUM8nXG9Efe', 'Demo', 'Qiita Dev', '1345 Colorado Avenue', '303-492-1984', NULL, NULL, NULL);
5757

5858

5959
--
@@ -329,7 +329,7 @@ INSERT INTO qiita.processing_job_status VALUES (6, 'waiting', 'The job is waitin
329329
-- Data for Name: processing_job; Type: TABLE DATA; Schema: qiita; Owner: antoniog
330330
--
331331

332-
INSERT INTO qiita.processing_job VALUES ('6d368e16-2242-4cf8-87b4-a5dc40bb890b', '[email protected]', 1, '{"max_bad_run_length":3,"min_per_read_length_fraction":0.75,"sequence_max_n":0,"rev_comp_barcode":false,"rev_comp_mapping_barcodes":false,"rev_comp":false,"phred_quality_threshold":3,"barcode_type":"golay_12","max_barcode_errors":1.5,"input_data":1,"phred_offset":"auto"}', 3, NULL, NULL, NULL, NULL, false, 1284411757);
332+
INSERT INTO qiita.processing_job VALUES ('6d368e16-2242-4cf8-87b4-a5dc40bb890b', '[email protected]', 1, '{"max_bad_run_length":3,"min_per_read_length_fraction":0.75,"sequence_max_n":0,"rev_comp_barcode":false,"rev_comp_mapping_barcodes":false,"rev_comp":false,"phred_quality_threshold":3,"barcode_type":"golay_12","max_barcode_errors":1.5,"input_data":1,"phred_offset":"auto"}', 3, NULL, NULL, NULL, NULL, false, 1284411757);
333333
INSERT INTO qiita.processing_job VALUES ('4c7115e8-4c8e-424c-bf25-96c292ca1931', '[email protected]', 1, '{"max_bad_run_length":3,"min_per_read_length_fraction":0.75,"sequence_max_n":0,"rev_comp_barcode":false,"rev_comp_mapping_barcodes":true,"rev_comp":false,"phred_quality_threshold":3,"barcode_type":"golay_12","max_barcode_errors":1.5,"input_data":1,"phred_offset":"auto"}', 3, NULL, NULL, NULL, NULL, false, 1287244546);
334334
INSERT INTO qiita.processing_job VALUES ('3c9991ab-6c14-4368-a48c-841e8837a79c', '[email protected]', 3, '{"reference":1,"sortmerna_e_value":1,"sortmerna_max_pos":10000,"similarity":0.97,"sortmerna_coverage":0.97,"threads":1,"input_data":2}', 3, NULL, NULL, NULL, NULL, false, 1284411377);
335335
INSERT INTO qiita.processing_job VALUES ('b72369f9-a886-4193-8d3d-f7b504168e75', '[email protected]', 1, '{"max_bad_run_length":3,"min_per_read_length_fraction":0.75,"sequence_max_n":0,"rev_comp_barcode":false,"rev_comp_mapping_barcodes":true,"rev_comp":false,"phred_quality_threshold":3,"barcode_type":"golay_12","max_barcode_errors":1.5,"input_data":1,"phred_offset":"auto"}', 3, NULL, '2015-11-22 21:15:00', NULL, NULL, false, 128552986);

qiita_db/support_files/qiita-db-unpatched.sql

+1-4
Original file line numberDiff line numberDiff line change
@@ -1888,10 +1888,7 @@ CREATE TABLE qiita.qiita_user (
18881888
user_verify_code character varying,
18891889
pass_reset_code character varying,
18901890
pass_reset_timestamp timestamp without time zone,
1891-
receive_processing_job_emails boolean DEFAULT false,
1892-
social_orcid character varying DEFAULT NULL,
1893-
social_researchgate character varying DEFAULT NULL,
1894-
social_googlescholar character varying DEFAULT NULL
1891+
receive_processing_job_emails boolean DEFAULT false
18951892
);
18961893

18971894

qiita_db/support_files/qiita-db.dbs

+33-2
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,13 @@
735735
<column name="filepath_type" />
736736
</index>
737737
</table>
738+
<table name="human_reads_filter_method" prior="human_reads_filter" >
739+
<column name="human_reads_filter_method_id" type="bigint" jt="-5" mandatory="y" />
740+
<column name="human_reads_filter_method_name" type="varchar" jt="12" mandatory="y" />
741+
<index name="pk_human_reads_filter_method_human_reads_filter_method_id" unique="PRIMARY_KEY" >
742+
<column name="human_reads_filter_method_id" />
743+
</index>
744+
</table>
738745
<table name="investigation" >
739746
<comment><![CDATA[Overarching investigation information.An investigation comprises one or more individual studies.]]></comment>
740747
<column name="investigation_id" type="bigint" length="19" decimal="0" jt="-5" mandatory="y" >
@@ -1007,6 +1014,9 @@
10071014
<column name="reprocess_job_id" type="uuid" jt="1111" >
10081015
<defo><![CDATA[NULL]]></defo>
10091016
</column>
1017+
<column name="human_reads_filter_method_id" type="bigint" jt="-5" >
1018+
<defo><![CDATA[NULL]]></defo>
1019+
</column>
10101020
<index name="pk_prep_template" unique="PRIMARY_KEY" >
10111021
<column name="prep_template_id" />
10121022
</index>
@@ -1265,6 +1275,19 @@
12651275
<column name="receive_processing_job_emails" type="boolean" jt="-7" mandatory="y" >
12661276
<defo><![CDATA[false]]></defo>
12671277
</column>
1278+
<column name="social_orcid" type="varchar" jt="12" >
1279+
<defo><![CDATA[NULL]]></defo>
1280+
</column>
1281+
<column name="social_researchgate" type="varchar" jt="12" >
1282+
<defo><![CDATA[NULL]]></defo>
1283+
</column>
1284+
<column name="social_googlescholar" type="varchar" jt="12" >
1285+
<defo><![CDATA[NULL]]></defo>
1286+
</column>
1287+
<column name="creation_timestamp" type="timestamp" jt="93" >
1288+
<defo><![CDATA[NOW()]]></defo>
1289+
<comment><![CDATA[The date the user account was created]]></comment>
1290+
</column>
12681291
<index name="pk_user" unique="PRIMARY_KEY" >
12691292
<column name="email" />
12701293
</index>
@@ -1370,6 +1393,13 @@
13701393
</column>
13711394
<column name="memory_used" type="bigint" jt="-5" />
13721395
<column name="walltime_used" type="integer" jt="4" />
1396+
<column name="job_start" type="text" jt="12" />
1397+
<column name="node_name" type="varchar" jt="12" >
1398+
<defo><![CDATA[NULL]]></defo>
1399+
</column>
1400+
<column name="node_model" type="varchar" jt="12" >
1401+
<defo><![CDATA[NULL]]></defo>
1402+
</column>
13731403
<index name="pk_slurm_resource_allocations_processing_job_id" unique="PRIMARY_KEY" >
13741404
<column name="processing_job_id" />
13751405
</index>
@@ -2098,6 +2128,7 @@ $function$
20982128
<entity schema="qiita" name="environmental_package" color="C7F4BE" x="752" y="960" />
20992129
<entity schema="qiita" name="filepath" color="BED3F4" x="2944" y="1024" />
21002130
<entity schema="qiita" name="filepath_type" color="BED3F4" x="2960" y="1296" />
2131+
<entity schema="qiita" name="human_reads_filter_method" color="C1D8EE" x="2304" y="1312" />
21012132
<entity schema="qiita" name="investigation" color="C7F4BE" x="704" y="464" />
21022133
<entity schema="qiita" name="investigation_study" color="C7F4BE" x="736" y="688" />
21032134
<entity schema="qiita" name="logging" color="F4DDBE" x="1760" y="320" />
@@ -2125,14 +2156,14 @@ $function$
21252156
<entity schema="qiita" name="processing_job_workflow" color="F4DDBE" x="1600" y="1168" />
21262157
<entity schema="qiita" name="processing_job_workflow_root" color="F4DDBE" x="1600" y="1056" />
21272158
<entity schema="qiita" name="publication" color="F4DDBE" x="3232" y="832" />
2128-
<entity schema="qiita" name="qiita_user" color="D1BEF4" x="64" y="1232" />
2159+
<entity schema="qiita" name="qiita_user" color="D1BEF4" x="48" y="1216" />
21292160
<entity schema="qiita" name="reference" color="BED3F4" x="3248" y="1024" />
21302161
<entity schema="qiita" name="restrictions" color="BED3F4" x="2768" y="1424" />
21312162
<entity schema="qiita" name="sample_template_filepath" color="BED3F4" x="2720" y="1296" />
21322163
<entity schema="qiita" name="sample_x" color="BED3F4" x="912" y="1408" />
21332164
<entity schema="qiita" name="settings" color="F82E15" x="64" y="160" />
21342165
<entity schema="qiita" name="severity" color="F4DDBE" x="1632" y="240" />
2135-
<entity schema="qiita" name="slurm_resource_allocations" color="F4DDBE" x="1888" y="640" />
2166+
<entity schema="qiita" name="slurm_resource_allocations" color="F4DDBE" x="1888" y="624" />
21362167
<entity schema="qiita" name="software" color="F4DDBE" x="3232" y="320" />
21372168
<entity schema="qiita" name="software_artifact_type" color="BEBEF4" x="2128" y="304" />
21382169
<entity schema="qiita" name="software_command" color="F4DDBE" x="2880" y="320" />

0 commit comments

Comments
 (0)