Skip to content

Commit e9d0b58

Browse files
authored
[SQL] [Biobank] 0000-00-06-biobank.sql fix order and add into test DB (#10027)
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (test_dev_270.biobank_specimen_type_unit_rel, CONSTRAINT FK_biobank_specimen_type_unit_rel_TypeID FOREIGN KEY (SpecimenTypeID) REFERENCES biobank_specimen_type (SpecimenTypeID)) ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (test_dev_270.biobank_specimen_type_parent, CONSTRAINT FK_biobank_specimen_type_parent_SpecimenTypeID FOREIGN KEY (SpecimenTypeID) REFERENCES biobank_specimen_type (SpecimenTypeID)) ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (test_dev_270.biobank_specimen_type_container_type_rel, CONSTRAINT FK_biobank_specimen_type_container_type_rel_SpecimenTypeID FOREIGN KEY (SpecimenTypeID) REFERENCES `biobank_specimen_t) when sourcing schema
1 parent bd433eb commit e9d0b58

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

Dockerfile.test.db

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ RUN cat /sql/0000-00-00-schema.sql \
1313
/sql/0000-00-03-ConfigTables.sql \
1414
/sql/0000-00-04-Help.sql \
1515
/sql/0000-00-05-ElectrophysiologyTables.sql \
16+
/sql/0000-00-06-BiobankTables.sql \
1617
/instruments_sql/*.sql \
1718
/test_instrument.sql \
1819
/RB_files/*.sql \

SQL/0000-00-06-BiobankTables.sql

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -378,18 +378,27 @@ CREATE TABLE `biobank_container_shipment_rel` (
378378

379379
-- Insert units, processes, container status and shipment status
380380
INSERT INTO `biobank_unit` VALUES (1,'mL'),(2,'µL');
381-
INSERT INTO `biobank_specimen_attribute_datatype` VALUES (1, 'text'),(2, 'number'),(3, 'date'),(4, 'time'),(5, 'boolean');
382-
INSERT INTO `biobank_specimen_protocol` VALUES (1, 'Blood Collection', 1, 1), (2, 'Blood Preparation', 2, 1), (3, 'Serum Collection', 1, 2);
383-
INSERT INTO `biobank_specimen_type` VALUES (1,'Blood',0),(2,'Serum', 1);
384-
INSERT INTO `biobank_specimen_type_unit_rel` VALUES (1, 1), (2, 2);
385-
INSERT INTO `biobank_specimen_type_parent` VALUES (2, 1);
386-
INSERT INTO `biobank_container_dimension` VALUES (1, 1, 1, 1, 1, 0, 0), (2, 10, 1, 10, 0, 1, 0), (3, 1, 0, 5, 0, 1, 0);
387-
INSERT INTO `biobank_container_capacity` VALUES (1, 1, 1);
388-
INSERT INTO `biobank_container_type` VALUES (1, 'Brand', 'Product Number 1', 'Vial', 1, 1, 1), (2, 'Brand', 'Product Number 2', 'Matrix Box', 0, null, 2), (3, 'Brand', 'Product Number 3', 'Rack', 0, null, 3);
389-
INSERT INTO `biobank_specimen_type_container_type_rel` VALUES (1, 1), (2, 1);
390-
INSERT INTO `biobank_specimen_process` VALUES (2,'Analysis'),(1,'Collection'),(3,'Preparation');
391-
INSERT INTO `biobank_container_status` VALUES (1,'Available'),(4,'Discarded'),(3,'Dispensed');
381+
INSERT INTO `biobank_specimen_attribute_datatype` VALUES (1,'text'),(2,'number'),(3,'date'),(4,'time'),(5,'boolean');
382+
INSERT INTO `biobank_specimen_process` VALUES (1,'Collection'),(2,'Analysis'),(3,'Preparation');
383+
INSERT INTO `biobank_container_status` VALUES (1,'Available'),(3,'Dispensed'),(4,'Discarded');
392384
INSERT INTO `shipment_status` VALUES (1,'cancelled'),(2,'created'),(3,'received'),(4,'returned'),(5,'shipped');
385+
INSERT INTO `biobank_specimen_type` VALUES (1,'Blood',0),(2,'Serum',1);
386+
INSERT INTO `biobank_container_dimension`
387+
VALUES (1,1,1,1,1,0,0),
388+
(2,10,1,10,0,1,0),
389+
(3,1,0,5,0,1,0);
390+
INSERT INTO `biobank_container_capacity` VALUES (1,1,1);
391+
INSERT INTO `biobank_container_type`
392+
VALUES (1,'Brand','Product Number 1','Vial',1,1,1),
393+
(2,'Brand','Product Number 2','Matrix Box',0,NULL,2),
394+
(3,'Brand','Product Number 3','Rack',0,NULL,3);
395+
INSERT INTO `biobank_specimen_protocol`
396+
VALUES (1,'Blood Collection',1,1),
397+
(2,'Blood Preparation',2,1),
398+
(3,'Serum Collection',1,2);
399+
INSERT INTO `biobank_specimen_type_unit_rel` VALUES (1,1),(2,2);
400+
INSERT INTO `biobank_specimen_type_parent` VALUES (2,1);
401+
INSERT INTO `biobank_specimen_type_container_type_rel` VALUES (1,1),(2,1);
393402

394403
-- Insert ConfigSettings for label printing endpoint
395404
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, Label, OrderNumber) VALUES ('biobank', 'Settings related to the biobank module', 1, 0, 'Biobank', 16);

php/installer/Installer.class.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ class Installer
3434
'02-Permission.sql',
3535
'03-ConfigTables.sql',
3636
'04-Help.sql',
37-
'05-ElectrophysiologyTables.sql'
37+
'05-ElectrophysiologyTables.sql',
38+
'06-BiobankTables.sql'
3839
];
3940

4041
/**

0 commit comments

Comments
 (0)