293 lines
7.2 KiB
SQL
293 lines
7.2 KiB
SQL
CREATE TABLE IF NOT EXISTS `Solvent` (
|
|
`solvent_id` Int NOT NULL AUTO_INCREMENT,
|
|
`name` text,
|
|
PRIMARY KEY (`solvent_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Preprep_vial` (
|
|
`vial_id` Int NOT NULL AUTO_INCREMENT,
|
|
`name` text,
|
|
`type` text,
|
|
PRIMARY KEY (`vial_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Catalyst` (
|
|
`catalyst_id` Int NOT NULL AUTO_INCREMENT,
|
|
`name` text,
|
|
PRIMARY KEY (`catalyst_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Vial_Catalyst` (
|
|
`vial_id` Int,
|
|
`catalyst_id` Int,
|
|
`vial_catalyst_id` Int NOT NULL AUTO_INCREMENT,
|
|
`name` text,
|
|
`type` text,
|
|
PRIMARY KEY (`vial_catalyst_id`),
|
|
FOREIGN KEY (`vial_id`)
|
|
REFERENCES `Preprep_vial`(`vial_id`),
|
|
FOREIGN KEY (`catalyst_id`)
|
|
REFERENCES `Catalyst`(`catalyst_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Incubator` (
|
|
`incubator_id` Int NOT NULL AUTO_INCREMENT,
|
|
`type` text,
|
|
`name` text,
|
|
PRIMARY KEY (`incubator_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Organization` (
|
|
`org_id` Int NOT NULL AUTO_INCREMENT,
|
|
`name` text,
|
|
`address` text,
|
|
`contact_info` text,
|
|
PRIMARY KEY (`org_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Project` (
|
|
`org_id` Int,
|
|
`project_id` Int NOT NULL AUTO_INCREMENT,
|
|
`mdr_id` text,
|
|
`name` text,
|
|
`description` text,
|
|
`Start Date` date,
|
|
PRIMARY KEY (`project_id`),
|
|
FOREIGN KEY (`org_id`)
|
|
REFERENCES `Organization`(`org_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Generation_Run` (
|
|
`project_id` Int,
|
|
`run_id` Int NOT NULL AUTO_INCREMENT,
|
|
`repository` text,
|
|
`rounds` int,
|
|
`status` text,
|
|
`run_start` Timestamp,
|
|
`run_end` Timestamp,
|
|
`compute_consumed` float,
|
|
`wandb_link` text,
|
|
PRIMARY KEY (`run_id`),
|
|
FOREIGN KEY (`project_id`)
|
|
REFERENCES `Project`(`project_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Candidate` (
|
|
`run_id` Int,
|
|
`candidate_id` Int NOT NULL AUTO_INCREMENT,
|
|
`project_id` Int,
|
|
`smiles_id` text,
|
|
`estimated_cost` float,
|
|
`generated_time` Timestamp,
|
|
`synthesis_approved` Timestamp,
|
|
`status` text,
|
|
PRIMARY KEY (`candidate_id`),
|
|
FOREIGN KEY (`run_id`)
|
|
REFERENCES `Generation_Run`(`run_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Candidate_Synthesis_Plan` (
|
|
`candidate_id` Int,
|
|
`plan_id` Int NOT NULL AUTO_INCREMENT,
|
|
`conditions_doc_link` text,
|
|
PRIMARY KEY (`plan_id`),
|
|
FOREIGN KEY (`candidate_id`)
|
|
REFERENCES `Candidate`(`candidate_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Laboratory` (
|
|
`lab_id` Int NOT NULL AUTO_INCREMENT,
|
|
`name` text,
|
|
`description` text,
|
|
`location` text,
|
|
PRIMARY KEY (`lab_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Well_Plate` (
|
|
`plan_id` Int,
|
|
`lab_id` Int,
|
|
`well_plate_id` Int NOT NULL AUTO_INCREMENT,
|
|
`incubation_start` Timestamp,
|
|
`incubation_end` Timestamp,
|
|
`Temperature` float,
|
|
`incubator_id` Int,
|
|
`status` text,
|
|
PRIMARY KEY (`well_plate_id`),
|
|
FOREIGN KEY (`plan_id`)
|
|
REFERENCES `Candidate_Synthesis_Plan`(`plan_id`),
|
|
FOREIGN KEY (`lab_id`)
|
|
REFERENCES `Laboratory`(`lab_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Sample_Well` (
|
|
`well_plate_id` Int,
|
|
`sample_id` Int NOT NULL AUTO_INCREMENT,
|
|
`picture_url` text,
|
|
`name` text,
|
|
PRIMARY KEY (`sample_id`),
|
|
FOREIGN KEY (`well_plate_id`)
|
|
REFERENCES `Well_Plate`(`well_plate_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Well_Solution` (
|
|
`sample_id` Int,
|
|
`vial_id` Int,
|
|
`well_solution_id` Int NOT NULL AUTO_INCREMENT,
|
|
`units` text,
|
|
`amount` Float,
|
|
PRIMARY KEY (`well_solution_id`),
|
|
FOREIGN KEY (`vial_id`)
|
|
REFERENCES `Preprep_vial`(`vial_id`),
|
|
FOREIGN KEY (`sample_id`)
|
|
REFERENCES `Sample_Well`(`sample_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Well_Catalysts` (
|
|
`sample_id` Int,
|
|
`catalyst_id` Int,
|
|
`well_catalyst_id` Int NOT NULL AUTO_INCREMENT,
|
|
`units` text,
|
|
`amount` Float,
|
|
PRIMARY KEY (`well_catalyst_id`),
|
|
FOREIGN KEY (`catalyst_id`)
|
|
REFERENCES `Catalyst`(`catalyst_id`),
|
|
FOREIGN KEY (`sample_id`)
|
|
REFERENCES `Sample_Well`(`sample_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `MDR` (
|
|
`mdr_id` Int NOT NULL AUTO_INCREMENT,
|
|
`name` text,
|
|
`description` text,
|
|
`date_approved` date,
|
|
PRIMARY KEY (`mdr_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Well_Solvents` (
|
|
`sample_id` Int,
|
|
`solvent_id` Int,
|
|
`well_solvent_id` Int NOT NULL AUTO_INCREMENT,
|
|
`units` text,
|
|
`amount` Float,
|
|
PRIMARY KEY (`well_solvent_id`),
|
|
FOREIGN KEY (`solvent_id`)
|
|
REFERENCES `Solvent`(`solvent_id`),
|
|
FOREIGN KEY (`sample_id`)
|
|
REFERENCES `Sample_Well`(`sample_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `MDR_Goals` (
|
|
`goal_id` Int NOT NULL AUTO_INCREMENT,
|
|
`mdr_id` Int,
|
|
`goal_name` text,
|
|
`operator` text,
|
|
`measurement` float,
|
|
PRIMARY KEY (`goal_id`),
|
|
FOREIGN KEY (`mdr_id`)
|
|
REFERENCES `MDR`(`mdr_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Vial_Solvent` (
|
|
`vial_id` Int,
|
|
`solvent_id` Int,
|
|
`vial_solvent_id` Int NOT NULL AUTO_INCREMENT,
|
|
`units` text,
|
|
`amount` Float,
|
|
PRIMARY KEY (`vial_solvent_id`),
|
|
FOREIGN KEY (`solvent_id`)
|
|
REFERENCES `Solvent`(`solvent_id`),
|
|
FOREIGN KEY (`vial_id`)
|
|
REFERENCES `Preprep_vial`(`vial_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Solid` (
|
|
`solid_id` Int NOT NULL AUTO_INCREMENT,
|
|
`name` text,
|
|
`smiles_id` text,
|
|
PRIMARY KEY (`solid_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Well_Solids` (
|
|
`sample_id` Int,
|
|
`solid_id` Int,
|
|
`well_solid_id` Int NOT NULL AUTO_INCREMENT,
|
|
`units` text,
|
|
`amount` Float,
|
|
PRIMARY KEY (`well_solid_id`),
|
|
FOREIGN KEY (`solid_id`)
|
|
REFERENCES `Solid`(`solid_id`),
|
|
FOREIGN KEY (`sample_id`)
|
|
REFERENCES `Sample_Well`(`sample_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Users` (
|
|
`user_id` Int NOT NULL AUTO_INCREMENT,
|
|
`org_id` Int,
|
|
`username` text,
|
|
`password` text,
|
|
`role` text,
|
|
PRIMARY KEY (`user_id`),
|
|
FOREIGN KEY (`org_id`)
|
|
REFERENCES `Organization`(`org_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `TGA_Analysis` (
|
|
`sample_id` Int,
|
|
`tga_id` Int NOT NULL AUTO_INCREMENT,
|
|
`temp_comp_array` Int,
|
|
`date` Timestamp,
|
|
PRIMARY KEY (`tga_id`),
|
|
FOREIGN KEY (`sample_id`)
|
|
REFERENCES `Sample_Well`(`sample_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `tga_scorecard` (
|
|
`tag_id` Int,
|
|
`tga_score_id` Int NOT NULL AUTO_INCREMENT,
|
|
`hashtable` Int,
|
|
PRIMARY KEY (`tga_score_id`),
|
|
FOREIGN KEY (`tag_id`)
|
|
REFERENCES `TGA_Analysis`(`tga_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `PXRD_Characterization` (
|
|
`sample_id` Int,
|
|
`character_id` Int NOT NULL AUTO_INCREMENT,
|
|
`point_array` Int,
|
|
`pxrd_score` float,
|
|
`date` Timestamp,
|
|
PRIMARY KEY (`character_id`),
|
|
FOREIGN KEY (`sample_id`)
|
|
REFERENCES `Sample_Well`(`sample_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Sample_Post_Instrumentation_Analysis` (
|
|
`sample_id` Int,
|
|
`analysis_id` Int NOT NULL AUTO_INCREMENT,
|
|
`summary` text,
|
|
`last_updated` Timestamp,
|
|
PRIMARY KEY (`analysis_id`),
|
|
FOREIGN KEY (`sample_id`)
|
|
REFERENCES `Sample_Well`(`sample_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `Candidate_Assessment` (
|
|
`candidate_id` Int,
|
|
`assessment_id` Int NOT NULL AUTO_INCREMENT,
|
|
`assessment` text,
|
|
`assessed_by` text,
|
|
`assess_date` Timestamp,
|
|
`status` text,
|
|
PRIMARY KEY (`assessment_id`),
|
|
FOREIGN KEY (`candidate_id`)
|
|
REFERENCES `Candidate`(`candidate_id`)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS `pxrd_scorecard` (
|
|
`character_id` Int,
|
|
`pxrd_score_id` Int NOT NULL AUTO_INCREMENT,
|
|
`hashtable` text,
|
|
PRIMARY KEY (`pxrd_score_id`),
|
|
FOREIGN KEY (`character_id`)
|
|
REFERENCES `PXRD_Characterization`(`character_id`)
|
|
); |