Skip to content

Commit abb8e17

Browse files
committed
Copy barcodes
1 parent dd07e0a commit abb8e17

File tree

1 file changed

+64
-0
lines changed
  • microsetta_private_api/db/patches

1 file changed

+64
-0
lines changed
+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
-- This database patch copies two samples into new barcodes to reflect
2+
-- adjustments that were necessary in the wet lab. We don't believe this
3+
-- will be an ongoing need, but if it proves to be, check for new
4+
-- barcode-related tables before using this as a template.
5+
6+
-- Begin copying X00236845 to 0364352596
7+
INSERT INTO barcodes.barcode (barcode, assigned_on, status, sample_postmark_date, biomass_remaining, sequencing_status, obsolete, create_date_time, kit_id)
8+
SELECT '0364352596', assigned_on, status, sample_postmark_date, biomass_remaining, sequencing_status, obsolete, create_date_time, kit_id
9+
FROM barcodes.barcode
10+
WHERE barcode = 'X00236845';
11+
12+
INSERT INTO barcodes.project_barcode (project_id, barcode)
13+
SELECT project_id, '0364352596'
14+
FROM barcodes.project_barcode
15+
WHERE barcode = 'X00236845';
16+
17+
-- I'm omitting the sample_barcode_file and sample_barcode_file_md5 as they're
18+
-- no longer used and it would be inappropriate to directly clone a different
19+
-- barcode's associated file.
20+
INSERT INTO ag.ag_kit_barcodes (ag_kit_id, barcode, site_sampled, sample_date, sample_time, notes, moldy, overloaded, other, other_text, date_of_last_email, results_ready, withdrawn, refunded, deposited, source_id, latest_sample_information_update)
21+
SELECT ag_kit_id, '0364352596', site_sampled, sample_date, sample_time, notes, moldy, overloaded, other, other_text, date_of_last_email, results_ready, withdrawn, refunded, deposited, source_id, latest_sample_information_update
22+
FROM ag.ag_kit_barcodes
23+
WHERE barcode = 'X00236845';
24+
25+
INSERT INTO ag.source_barcodes_surveys (barcode, survey_id)
26+
SELECT '0364352596', survey_id
27+
FROM ag.source_barcodes_surveys
28+
WHERE barcode = 'X00236845';
29+
30+
INSERT INTO barcodes.barcode_scans (barcode, scan_timestamp, sample_status, technician_notes)
31+
SELECT '0364352596', scan_timestamp, sample_status, technician_notes
32+
FROM barcodes.barcode_scans
33+
WHERE barcode = 'X00236845';
34+
-- End copying X00236845 to 0364352596
35+
36+
-- Begin copying 000031307 to 0364406520
37+
INSERT INTO barcodes.barcode (barcode, assigned_on, status, sample_postmark_date, biomass_remaining, sequencing_status, obsolete, create_date_time, kit_id)
38+
SELECT '0364406520', assigned_on, status, sample_postmark_date, biomass_remaining, sequencing_status, obsolete, create_date_time, kit_id
39+
FROM barcodes.barcode
40+
WHERE barcode = '000031307';
41+
42+
INSERT INTO barcodes.project_barcode (project_id, barcode)
43+
SELECT project_id, '0364406520'
44+
FROM barcodes.project_barcode
45+
WHERE barcode = '000031307';
46+
47+
-- I'm omitting the sample_barcode_file and sample_barcode_file_md5 as they're
48+
-- no longer used and it would be inappropriate to directly clone a different
49+
-- barcode's associated file.
50+
INSERT INTO ag.ag_kit_barcodes (ag_kit_id, barcode, site_sampled, sample_date, sample_time, notes, moldy, overloaded, other, other_text, date_of_last_email, results_ready, withdrawn, refunded, deposited, source_id, latest_sample_information_update)
51+
SELECT ag_kit_id, '0364406520', site_sampled, sample_date, sample_time, notes, moldy, overloaded, other, other_text, date_of_last_email, results_ready, withdrawn, refunded, deposited, source_id, latest_sample_information_update
52+
FROM ag.ag_kit_barcodes
53+
WHERE barcode = '000031307';
54+
55+
INSERT INTO ag.source_barcodes_surveys (barcode, survey_id)
56+
SELECT '0364406520', survey_id
57+
FROM ag.source_barcodes_surveys
58+
WHERE barcode = '000031307';
59+
60+
INSERT INTO barcodes.barcode_scans (barcode, scan_timestamp, sample_status, technician_notes)
61+
SELECT '0364406520', scan_timestamp, sample_status, technician_notes
62+
FROM barcodes.barcode_scans
63+
WHERE barcode = '000031307';
64+
-- End copying 000031307 to 0364406520

0 commit comments

Comments
 (0)