Skip to content

Commit eb17e7b

Browse files
authored
Skip inserting data when creating empty schemas (#996)
1 parent 8dabc44 commit eb17e7b

8 files changed

Lines changed: 79 additions & 37 deletions

File tree

Viral_Load_Assay/resources/schemas/dbscripts/postgresql/Viral_Load_Assay-0.00-11.10.sql

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ CREATE TABLE Viral_Load_Assay.assays
3434
-- ----------------------------
3535
-- Records of assays
3636
-- ----------------------------
37+
-- @SkipOnEmptySchemasBegin
3738
INSERT INTO Viral_Load_Assay.assays
3839
(assayName, virus)
3940
VALUES
4041
('SIVmac239-Gag', 'SIVmac239');
42+
-- @SkipOnEmptySchemasEnd
4143

4244
-- ----------------------------
4345
-- Table structure for vl_category
@@ -71,8 +73,10 @@ WITH (OIDS=FALSE);
7173
-- ----------------------------
7274
-- Records of vl_instrument
7375
-- ----------------------------
76+
-- @SkipOnEmptySchemasBegin
7477
INSERT INTO Viral_Load_Assay.vl_instrument VALUES ('LC480');
7578
INSERT INTO Viral_Load_Assay.vl_instrument VALUES ('Light Cycler');
79+
-- @SkipOnEmptySchemasEnd
7680

7781
-- ----------------------------
7882
-- Table structure for vl_sampletype
@@ -105,7 +109,9 @@ WITH (OIDS=FALSE);
105109
-- ----------------------------
106110
-- Records of vl_technique
107111
-- ----------------------------
112+
-- @SkipOnEmptySchemasBegin
108113
INSERT INTO Viral_Load_Assay.vl_technique VALUES ('Lifson 1-Step VL');
114+
-- @SkipOnEmptySchemasEnd
109115

110116
-- ----------------------------
111117
-- Table structure for vl_virus
@@ -122,5 +128,3 @@ WITH (OIDS=FALSE);
122128
-- Records of vl_virus
123129
-- ----------------------------
124130
INSERT INTO Viral_Load_Assay.vl_virus VALUES ('SIVmac239');
125-
126-

Viral_Load_Assay/resources/schemas/dbscripts/postgresql/Viral_Load_Assay-12.20-12.21.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
17+
-- @SkipOnEmptySchemasBegin
1618
INSERT INTO viral_load_assay.vl_instrument VALUES ('ABI 7500');
19+
-- @SkipOnEmptySchemasEnd
1720

1821
DROP TABLE viral_load_assay.vl_category;

Viral_Load_Assay/resources/schemas/dbscripts/postgresql/Viral_Load_Assay-12.22-12.23.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ CREATE TABLE viral_load_assay.fluors (
1313
constraint PK_fluors PRIMARY KEY (name)
1414
);
1515

16-
INSERT INTO viral_load_assay.fluors (name) VALUES ('FAM');
16+
-- @SkipOnEmptySchemasBegin
17+
INSERT INTO viral_load_assay.fluors (name) VALUES ('FAM');
18+
-- @SkipOnEmptySchemasEnd
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
-- @SkipOnEmptySchemasBegin
12
INSERT INTO viral_load_assay.vl_instrument (instrument)
23
SELECT 'LC96'
34
WHERE
45
NOT EXISTS (
56
SELECT instrument FROM viral_load_assay.vl_instrument WHERE instrument = 'LC96'
6-
);
7+
);
8+
-- @SkipOnEmptySchemasEnd

Viral_Load_Assay/src/org/labkey/viral_load_assay/assay/ViralLoadAssayDataProvider.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@
3434
import java.util.List;
3535
import java.util.Set;
3636

37-
/**
38-
* Created with IntelliJ IDEA.
39-
* User: bimber
40-
* Date: 9/28/12
41-
* Time: 4:17 PM
42-
*/
4337
public class ViralLoadAssayDataProvider extends AbstractAssayDataProvider
4438
{
4539
public ViralLoadAssayDataProvider(Module m)

ehr/resources/schemas/dbscripts/postgresql/ehr-0.000-24.000.sql

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ CREATE TABLE ehr.notificationTypes
276276
CONSTRAINT PK_notificationTypes PRIMARY KEY (NotificationType)
277277
);
278278

279+
-- @SkipOnEmptySchemasBegin
279280
INSERT into ehr.notificationTypes
280281
(NotificationType, description)
281282
VALUES
@@ -285,6 +286,7 @@ VALUES
285286
('Animal Care Service Request', ''),
286287
('Colony Validation - General', 'Subscribing to this notification will result in emails for general colony records issues like records needing attention, animals missing from the demographics table, etc.')
287288
;
289+
-- @SkipOnEmptySchemasEnd
288290

289291
CREATE TABLE ehr.notificationRecipients
290292
(
@@ -407,6 +409,7 @@ CREATE TABLE ehr.qcStateMetadata
407409
CONSTRAINT PK_qcStateMetadata PRIMARY KEY (QCStateLabel)
408410
);
409411

412+
-- @SkipOnEmptySchemasBegin
410413
INSERT INTO ehr.qcStateMetadata
411414
(QCStateLabel,draftData,isDeleted,isRequest)
412415
VALUES
@@ -421,6 +424,7 @@ VALUES
421424
('Request: Approved', TRUE, FALSE, TRUE),
422425
('Request: Complete', FALSE, FALSE, TRUE)
423426
;
427+
-- @SkipOnEmptySchemasEnd
424428

425429
DROP TABLE IF EXISTS ehr.module_properties;
426430

@@ -507,12 +511,14 @@ ALTER TABLE ehr.reports
507511
add column description varchar(4000)
508512
;
509513

514+
-- @SkipOnEmptySchemasBegin
510515
INSERT INTO ehr.qcStateMetadata
511516
(QCStateLabel,draftData,isDeleted,isRequest)
512517
VALUES
513518
('Completed', FALSE, FALSE, FALSE),
514519
('Scheduled', TRUE, FALSE, FALSE)
515520
;
521+
-- @SkipOnEmptySchemasEnd
516522

517523
ALTER TABLE ehr.formTypes ADD COLUMN configJson text;
518524

@@ -601,6 +607,7 @@ ALTER table ehr.qcStateMetadata
601607

602608
DELETE from ehr.qcStateMetadata;
603609

610+
-- @SkipOnEmptySchemasBegin
604611
INSERT INTO ehr.qcStateMetadata
605612
(QCStateLabel,DraftData,isDeleted,isRequest,allowFutureDates)
606613
VALUES
@@ -616,6 +623,7 @@ VALUES
616623
('Request: Complete', FALSE, FALSE, TRUE, TRUE),
617624
('Scheduled', TRUE, FALSE, FALSE, TRUE)
618625
;
626+
-- @SkipOnEmptySchemasEnd
619627

620628
UPDATE ehr.qcStateMetadata
621629
SET DraftData = FALSE
@@ -625,10 +633,12 @@ ALTER table ehr.reports
625633
add column sort_order integer
626634
;
627635

636+
-- @SkipOnEmptySchemasBegin
628637
insert into ehr.notificationtypes
629638
(notificationtype,description) VALUES
630639
('Incompleted Treatments', 'An email will be sent each day at 8:30, 15:30 and 20:30 notifying of any incompleted treatments')
631640
;
641+
-- @SkipOnEmptySchemasEnd
632642

633643
CREATE TABLE ehr.automatic_alerts (
634644
rowid serial not null,
@@ -685,13 +695,15 @@ UPDATE ehr.qcStateMetadata
685695
SET DraftData = TRUE
686696
WHERE QCStateLabel = 'Review Requested';
687697

698+
-- @SkipOnEmptySchemasBegin
688699
insert into ehr.notificationtypes
689700
(notificationtype,description) VALUES
690701
('Blood Draw Request Completed', 'An email will be sent each time a blood draw request is completed'),
691702
('Blood Draw Request Denied', 'An email will be sent each time a blood draw request is denied'),
692703
('Clinpath Request Completed', 'An email will be sent each time a clinpath request is completed'),
693704
('Clinpath Request Denied', 'An email will be sent each time a clinpath request is denied')
694705
;
706+
-- @SkipOnEmptySchemasEnd
695707

696708
alter TABLE ehr.notificationRecipients
697709
add column Recipient2 integer
@@ -779,10 +791,12 @@ alter TABLE ehr.protocol
779791
add column maxAnimals integer
780792
;
781793

794+
-- @SkipOnEmptySchemasBegin
782795
insert into ehr.notificationtypes
783796
(notificationtype,description) VALUES
784797
('Prenatal Death', 'An email will be sent each time a prenatal death is reported')
785798
;
799+
-- @SkipOnEmptySchemasEnd
786800

787801
delete from ehr.notificationtypes where notificationtype in (
788802
'Clinpath Abnormal Results',
@@ -803,6 +817,7 @@ delete from ehr.notificationtypes where notificationtype in (
803817

804818
delete from ehr.notificationtypes where notificationtype = 'Colony Validation - General';
805819

820+
-- @SkipOnEmptySchemasBegin
806821
insert into ehr.notificationtypes
807822
(notificationtype,description) VALUES
808823
('Clinpath Abnormal Results', 'An email will be sent periodically to summarize abnormal clinpath results'),
@@ -819,6 +834,7 @@ insert into ehr.notificationtypes
819834
('Overdue Weight Alerts', 'An email will be sent daily to summarize animals overdue for weights.'),
820835
('Site Error Alerts', 'An hourly email will be sent if a new site error is reported.')
821836
;
837+
-- @SkipOnEmptySchemasEnd
822838

823839
drop TABLE ehr.client_errors;
824840

@@ -1263,8 +1279,10 @@ ALTER TABLE ehr.reports ADD subjectIdFieldName varchar(200);
12631279

12641280
ALTER TABLE ehr.project ADD alwaysavailable bool;
12651281

1282+
-- @SkipOnEmptySchemasBegin
12661283
INSERT INTO ehr.qcstateMetadata (QCStateLabel,draftData,isDeleted,isRequest)
12671284
VALUES ('Request: Sample Delivered', TRUE, FALSE, TRUE);
1285+
-- @SkipOnEmptySchemasEnd
12681286

12691287
CREATE TABLE ehr.protocolexemptions (
12701288
rowid SERIAL,
@@ -1337,7 +1355,9 @@ CREATE INDEX snomed_tags_taskid ON ehr.snomed_tags (taskid);
13371355

13381356
CREATE INDEX treatment_times_container_treatmentid ON ehr.treatment_times (container, treatmentid);
13391357

1358+
-- @SkipOnEmptySchemasBegin
13401359
INSERT INTO ehr.qcStateMetadata (QCStateLabel,DraftData,isDeleted,isRequest,allowFutureDates) VALUES ('Request: Cancelled', false, false, true, true);
1360+
-- @SkipOnEmptySchemasEnd
13411361

13421362
ALTER TABLE ehr.project ADD projecttype varchar(100);
13431363

@@ -1634,6 +1654,7 @@ DROP FUNCTION ehr.handleAddContactToProtocol();
16341654
DELETE FROM ehr.qcStateMetadata WHERE QCStateLabel = 'Started';
16351655
DELETE FROM ehr.status WHERE Label = 'Started';
16361656

1657+
-- @SkipOnEmptySchemasBegin
16371658
INSERT INTO ehr.qcStateMetadata
16381659
(QCStateLabel,draftData,isDeleted,isRequest)
16391660
VALUES
@@ -1642,7 +1663,7 @@ INSERT INTO ehr.status
16421663
(label,Description,PublicData,DraftData,isDeleted,isRequest,allowFutureDates)
16431664
VALUES
16441665
('Started', 'Record has started, but not completed',TRUE,FALSE,FALSE,FALSE,FALSE);
1645-
1666+
-- @SkipOnEmptySchemasEnd
16461667

16471668
-- ehr-17.21-17.22.sql
16481669
-- contents of ehr-17.21-17.22.sql script are not in rolled up ehr-0.00-18.10.sql, since they got added and merged after the rollup.
@@ -1781,6 +1802,7 @@ DROP FUNCTION ehr.addConstraintToFormFrameworkTypes();
17811802
DELETE FROM ehr.qcStateMetadata WHERE QCStateLabel = 'Request: On Hold';
17821803
DELETE FROM ehr.status WHERE Label = 'Request: On Hold';
17831804

1805+
-- @SkipOnEmptySchemasBegin
17841806
INSERT INTO ehr.qcStateMetadata
17851807
(QCStateLabel, draftData, isDeleted, isRequest, allowFutureDates)
17861808
VALUES
@@ -1790,6 +1812,7 @@ INSERT INTO ehr.status
17901812
(label, description, publicData, draftData, isDeleted, isRequest, allowFutureDates)
17911813
VALUES
17921814
('Request: On Hold', 'Request has been put on hold', FALSE, FALSE, FALSE, TRUE, TRUE);
1815+
-- @SkipOnEmptySchemasEnd
17931816

17941817
CREATE INDEX snomed_tags_recordid ON ehr.snomed_tags (recordid);
17951818

ehr/resources/schemas/dbscripts/postgresql/ehr_lookups-0.000-23.000.sql

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3345,6 +3345,7 @@ WITH (OIDS=FALSE)
33453345
-- ----------------------------
33463346
-- Records of months
33473347
-- ----------------------------
3348+
-- @SkipOnEmptySchemasBegin
33483349
INSERT into ehr_lookups.months (month) VALUES
33493350
('January'),
33503351
('February'),
@@ -3358,7 +3359,7 @@ INSERT into ehr_lookups.months (month) VALUES
33583359
('October'),
33593360
('November'),
33603361
('December');
3361-
3362+
-- @SkipOnEmptySchemasEnd
33623363

33633364

33643365
-- ----------------------------
@@ -3807,9 +3808,11 @@ WITH (OIDS=FALSE)
38073808
-- ----------------------------
38083809
-- Records of tb_eye
38093810
-- ----------------------------
3811+
-- @SkipOnEmptySchemasBegin
38103812
INSERT INTO ehr_lookups.tb_eye VALUES ('b', 'Both');
38113813
INSERT INTO ehr_lookups.tb_eye VALUES ('l', 'Left');
38123814
INSERT INTO ehr_lookups.tb_eye VALUES ('r', 'Right');
3815+
-- @SkipOnEmptySchemasEnd
38133816

38143817
-- ----------------------------
38153818
-- Table structure for tb_result
@@ -3992,9 +3995,11 @@ WITH (OIDS=FALSE)
39923995
-- ----------------------------
39933996
-- Records of yesno
39943997
-- ----------------------------
3998+
-- @SkipOnEmptySchemasBegin
39953999
INSERT INTO ehr_lookups.yesno VALUES ('Yes');
39964000
INSERT INTO ehr_lookups.yesno VALUES ('No');
39974001
INSERT INTO ehr_lookups.yesno VALUES ('NA');
4002+
-- @SkipOnEmptySchemasEnd
39984003

39994004

40004005

@@ -4443,13 +4448,14 @@ WITH (OIDS=FALSE)
44434448
-- ----------------------------
44444449
-- Records of normal_abnormal
44454450
-- ----------------------------
4451+
-- @SkipOnEmptySchemasBegin
44464452
INSERT INTO ehr_lookups.normal_abnormal
44474453
(state)
44484454
VALUES
44494455
('Normal'),
44504456
('Abnormal')
44514457
;
4452-
4458+
-- @SkipOnEmptySchemasEnd
44534459

44544460
-- ----------------------------
44554461
-- Table structure for observations_anesthesia_recovery
@@ -4620,12 +4626,14 @@ WITH (OIDS=FALSE)
46204626

46214627
;
46224628

4629+
-- @SkipOnEmptySchemasBegin
46234630
INSERT INTO ehr_lookups.oor_indicators
46244631
(indicator)
46254632
VALUES
46264633
('<'),
46274634
('>')
46284635
;
4636+
-- @SkipOnEmptySchemasEnd
46294637

46304638
INSERT INTO ehr_lookups.blood_draw_services
46314639
(service) VALUES
@@ -5009,13 +5017,14 @@ WITH (OIDS=FALSE)
50095017

50105018
;
50115019

5020+
-- @SkipOnEmptySchemasBegin
50125021
INSERT INTO ehr_lookups.qualitative_results
50135022
(result) VALUES
50145023
('Positive'),
50155024
('Negative'),
50165025
('Indeterminate')
50175026
;
5018-
5027+
-- @SkipOnEmptySchemasEnd
50195028

50205029
DROP TABLE IF EXISTS ehr_lookups.urine_method;
50215030
-- ----------------------------
@@ -7031,11 +7040,12 @@ update ehr_lookups.lab_test_range set type = 'Chemistry' where test = 'UA';
70317040
update ehr_lookups.lab_test_range set type = 'Hematology' where test = 'WBC';
70327041

70337042
delete from ehr.notificationtypes where notificationtype = 'Animal Death';
7043+
-- @SkipOnEmptySchemasBegin
70347044
insert into ehr.notificationtypes
70357045
(notificationtype,description) VALUES
70367046
('Animal Death', 'An email will be sent each time an animal is marked as dead')
70377047
;
7038-
7048+
-- @SkipOnEmptySchemasEnd
70397049

70407050
-- ----------------------------
70417051
-- Table structure for ehr_lookups.death_remarks

0 commit comments

Comments
 (0)