forked from ehb54/us3_sql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
us3.sql
2301 lines (2025 loc) · 77 KB
/
us3.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS;
SET @OLD_SQL_MODE=@@SQL_MODE;
SET UNIQUE_CHECKS = 0;
SET FOREIGN_KEY_CHECKS=0;
SET SQL_MODE='STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER';
-- Uncomment the following lines to create and use us3 schema
-- CREATE SCHEMA IF NOT EXISTS us3 DEFAULT CHARACTER SET ascii COLLATE ascii_bin ;
-- USE us3;
-- -----------------------------------------------------
-- Table people
-- -----------------------------------------------------
DROP TABLE IF EXISTS people ;
CREATE TABLE IF NOT EXISTS people (
personID int(11) NOT NULL AUTO_INCREMENT ,
personGUID CHAR(36) NOT NULL UNIQUE,
fname VARCHAR(30) NULL ,
lname VARCHAR(30) NULL ,
address VARCHAR(255) NULL ,
city VARCHAR(30) NULL ,
state VARCHAR(20) NULL ,
zip VARCHAR(10) NULL ,
country VARCHAR(64) NULL ,
phone VARCHAR(24) NULL ,
email VARCHAR(63) NOT NULL UNIQUE ,
organization VARCHAR(45) NULL ,
username VARCHAR(80) NULL,
password VARCHAR(80) NOT NULL ,
activated TINYINT(1) NOT NULL DEFAULT false ,
signup TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
lastLogin DATETIME NULL ,
clusterAuthorizations VARCHAR(255) NOT NULL default 'lonestar5:stampede2:comet:jetstream',
userlevel TINYINT NOT NULL DEFAULT 0 ,
advancelevel TINYINT NOT NULL DEFAULT 0 ,
gmpReviewerRole ENUM ('NONE', 'REVIEWER', 'APPROVER') NOT NULL,
PRIMARY KEY (personID) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table project
-- -----------------------------------------------------
DROP TABLE IF EXISTS project ;
CREATE TABLE IF NOT EXISTS project (
projectID int(11) NOT NULL AUTO_INCREMENT ,
projectGUID CHAR(36) NOT NULL UNIQUE,
goals TEXT NULL ,
molecules TEXT NULL ,
purity VARCHAR(10) NULL ,
expense TEXT NULL ,
bufferComponents TEXT NULL ,
saltInformation TEXT NULL ,
AUC_questions TEXT NULL ,
expDesign TEXT NULL ,
notes TEXT NULL ,
description TEXT NULL ,
status ENUM('submitted', 'designed', 'scheduled','uploaded', 'anlyzed', 'invoiced', 'paid', 'other') NOT NULL ,
lastUpdated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY (projectID) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table lab
-- -----------------------------------------------------
DROP TABLE IF EXISTS lab ;
CREATE TABLE IF NOT EXISTS lab (
labID int(11) NOT NULL AUTO_INCREMENT ,
labGUID CHAR(36) NOT NULL UNIQUE,
name TEXT NULL ,
building TEXT NULL ,
room TEXT NULL ,
dateUpdated TIMESTAMP NULL ,
PRIMARY KEY (labID) )
ENGINE = InnoDB;
-----------------------------------------------------
-- Table autoflow--
-----------------------------------------------------
DROP TABLE IF EXISTS autoflow;
CREATE TABLE IF NOT EXISTS autoflow (
ID int(11) NOT NULL AUTO_INCREMENT ,
protName varchar(80) NULL,
cellChNum varchar(80) NULL,
tripleNum varchar(80) NULL,
duration int(10) NULL,
runName varchar(300) NULL,
expID int(10) NULL,
runID int(10) NULL,
status enum('LIVE_UPDATE','EDITING','EDIT_DATA','ANALYSIS','REPORT','E-SIGNATURES') NOT NULL,
dataPath varchar(300) NULL,
optimaName varchar(300) NULL,
runStarted TIMESTAMP NULL,
invID INT NULL,
created TIMESTAMP NULL,
corrRadii enum('YES', 'NO') NOT NULL,
expAborted enum('NO', 'YES') NOT NULL,
label varchar(80) NULL,
gmpRun enum ('NO', 'YES') NOT NULL,
filename varchar(300) NULL,
aprofileGUID varchar(80) NULL,
analysisIDs longtext NULL,
intensityID int(11) NULL,
operatorID int(11) NULL,
statusID int(11) NULL,
failedID int(11) NULL,
devRecord enum('NO', 'YES', 'Processed') NOT NULL,
gmpReviewID int(11) NULL,
PRIMARY KEY (ID) )
ENGINE = InnoDB;
-----------------------------------------------------
-- Table autoflowHistory --
-----------------------------------------------------
DROP TABLE IF EXISTS autoflowHistory;
CREATE TABLE IF NOT EXISTS autoflowHistory (
ID int(11) NOT NULL UNIQUE,
protName varchar(80) NULL,
cellChNum varchar(80) NULL,
tripleNum varchar(80) NULL,
duration int(10) NULL,
runName varchar(300) NULL,
expID int(10) NULL,
runID int(10) NULL,
status enum('LIVE_UPDATE','EDITING','EDIT_DATA','ANALYSIS','REPORT','E-SIGNATURES') NOT NULL,
dataPath varchar(300) NULL,
optimaName varchar(300) NULL,
runStarted TIMESTAMP NULL,
invID INT NULL,
created TIMESTAMP NULL,
corrRadii enum('YES', 'NO') NOT NULL,
expAborted enum('NO', 'YES') NOT NULL,
label varchar(80) NULL,
gmpRun enum ('NO', 'YES') NOT NULL,
filename varchar(300) NULL,
aprofileGUID varchar(80) NULL,
analysisIDs longtext NULL,
intensityID int(11) NULL,
operatorID int(11) NULL,
statusID int(11) NULL,
failedID int(11) NULL,
devRecord enum('NO', 'YES', 'Processed') NOT NULL,
gmpReviewID int(11) NULL,
PRIMARY KEY (ID) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table autoflowGMPReport
-- -----------------------------------------------------
DROP TABLE IF EXISTS autoflowGMPReport;
CREATE TABLE IF NOT EXISTS autoflowGMPReport (
ID INT(11) NOT NULL AUTO_INCREMENT,
autoflowHistoryID INT(11) NOT NULL UNIQUE,
autoflowHistoryName VARCHAR(300) NULL,
protocolName VARCHAR(80) NULL,
timeCreated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
data LONGBLOB NULL,
fileNamePdf VARCHAR(300) NULL,
html_s LONGBLOB NULL,
PRIMARY KEY (ID) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table autoflowGMPReportEsign
-- -----------------------------------------------------
DROP TABLE IF EXISTS autoflowGMPReportEsign;
CREATE TABLE IF NOT EXISTS autoflowGMPReportEsign (
ID INT(11) NOT NULL AUTO_INCREMENT,
autoflowID INT(11) NOT NULL UNIQUE,
autoflowName VARCHAR(300) NULL,
operatorListJson json,
reviewersListJson json,
approversListJson json,
smeListJson json,
eSignStatusJson json,
eSignStatusAll ENUM ('NO','YES') NOT NULL,
createUpdateLogJson json,
data LONGBLOB NULL,
PRIMARY KEY (ID) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table autoflowGMPReportEsignHistory
-- -----------------------------------------------------
DROP TABLE IF EXISTS autoflowGMPReportEsignHistory;
CREATE TABLE IF NOT EXISTS autoflowGMPReportEsignHistory (
ID INT(11) NOT NULL UNIQUE,
autoflowID INT(11) NOT NULL UNIQUE,
autoflowName VARCHAR(300) NULL,
operatorListJson json,
reviewersListJson json,
approversListJson json,
smeListJson json,
eSignStatusJson json,
eSignStatusAll ENUM ('NO','YES') NOT NULL,
createUpdateLogJson json,
data LONGBLOB NULL,
PRIMARY KEY (ID) )
ENGINE = InnoDB;
-----------------------------------------------------
-- Table autoflowFailed --
-----------------------------------------------------
DROP TABLE IF EXISTS autoflowFailed;
CREATE TABLE autoflowFailed (
ID int(11) NOT NULL AUTO_INCREMENT,
autoflowID int(11) NOT NULL UNIQUE,
failedStage text,
failedMsg json,
failedTs timestamp NULL,
PRIMARY KEY (ID)
) ENGINE=InnoDB;
-----------------------------------------------------
-- Table autoflowStatus --
-----------------------------------------------------
DROP TABLE IF EXISTS autoflowStatus;
CREATE TABLE autoflowStatus (
ID int(11) NOT NULL AUTO_INCREMENT,
autoflowID int(11) NOT NULL UNIQUE,
importRI json,
importRIts timestamp NULL,
importIP json,
importIPts timestamp NULL,
editRI json,
editRIts timestamp NULL,
editIP json,
editIPts timestamp NULL,
analysis json,
GMPreport json,
GMPreportts timestamp NULL,
stopOptima json,
stopOptimats timestamp NULL,
skipOptima json,
skipOptimats timestamp NULL,
analysisCancel json,
createdGMPrun json,
createdGMPrunts timestamp NULL,
PRIMARY KEY (ID) )
ENGINE=InnoDB;
-----------------------------------------------------
-- Table autoflowAnalysis --
-----------------------------------------------------
DROP TABLE IF EXISTS autoflowAnalysis;
CREATE TABLE autoflowAnalysis (
requestID int(11) NOT NULL AUTO_INCREMENT,
tripleName text NOT NULL,
clusterDefault text DEFAULT "localhost",
filename text NOT NULL,
aprofileGUID char(36) NOT NULL,
invID int(11) NOT NULL,
currentGfacID varchar(80) DEFAULT NULL,
currentHPCARID int(11) DEFAULT NULL,
statusJson json,
status text DEFAULT "unknown",
statusMsg text DEFAULT "",
nextWaitStatus text DEFAULT NULL,
nextWaitStatusMsg text DEFAULT NULL,
stageSubmitTime timestamp DEFAULT 0,
createTime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
updateTime timestamp DEFAULT 0 ON UPDATE CURRENT_TIMESTAMP,
createUser varchar(128) DEFAULT (current_user()),
updateUser varchar(128) DEFAULT "", # ON UPDATE (current_user()),
autoflowID int(11) NOT NULL,
PRIMARY KEY (RequestID)
) ENGINE=InnoDB;
-----------------------------------------------------
-- Table autoflowAnalysisHistory --
-----------------------------------------------------
DROP TABLE IF EXISTS autoflowAnalysisHistory;
CREATE TABLE autoflowAnalysisHistory (
requestID int(11) NOT NULL UNIQUE,
tripleName text NOT NULL,
clusterDefault text DEFAULT "localhost",
filename text NOT NULL,
aprofileGUID char(36) NOT NULL,
invID int(11) NOT NULL,
currentGfacID varchar(80) DEFAULT NULL,
currentHPCARID int(11) DEFAULT NULL,
statusJson json,
status text DEFAULT "unknown",
statusMsg text DEFAULT "",
nextWaitStatus text DEFAULT NULL,
nextWaitStatusMsg text DEFAULT NULL,
stageSubmitTime timestamp DEFAULT 0,
createTime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
updateTime timestamp DEFAULT 0 ON UPDATE CURRENT_TIMESTAMP,
createUser varchar(128) DEFAULT (current_user()),
updateUser varchar(128) DEFAULT "", # ON UPDATE (current_user()),
autoflowID int(11) NOT NULL,
PRIMARY KEY (RequestID)
) ENGINE=InnoDB;
-----------------------------------------------------
-- Table autoflowModelsLink --
-----------------------------------------------------
DROP TABLE IF EXISTS autoflowModelsLink;
CREATE TABLE IF NOT EXISTS autoflowModelsLink (
autoflowAnalysisID int(11) NOT NULL UNIQUE,
modelsDesc json,
autoflowID int(11) NOT NULL,
PRIMARY KEY (autoflowAnalysisID) )
ENGINE = InnoDB;
-----------------------------------------------------
-- Table autoflowAnalysisStages --
-----------------------------------------------------
DROP TABLE IF EXISTS autoflowStages;
CREATE TABLE autoflowStages (
autoflowID int(11) NOT NULL UNIQUE,
liveUpdate text DEFAULT "unknown",
import text DEFAULT "unknown",
editing text DEFAULT "unknown",
reporting text DEFAULT "unknown",
esigning text DEFAULT "unknown",
PRIMARY KEY (autoflowID)
) ENGINE=InnoDB;
-----------------------------------------------------
-- Table autoflowAnalysisStages --
-----------------------------------------------------
DROP TABLE IF EXISTS autoflowAnalysisStages;
CREATE TABLE autoflowAnalysisStages (
requestID int(11) NOT NULL UNIQUE,
analysisFitmen text DEFAULT "unknown",
PRIMARY KEY (requestID)
) ENGINE=InnoDB;
-----------------------------------------------------
-- Table autoflowIntensity --
-----------------------------------------------------
DROP TABLE IF EXISTS autoflowIntensity;
CREATE TABLE autoflowIntensity (
ID int(11) NOT NULL AUTO_INCREMENT,
autoflowID int(11) NOT NULL UNIQUE,
intensityRI json,
intensityIP json,
PRIMARY KEY (ID)
) ENGINE=InnoDB;
-----------------------------------------------------
-- Table autoflowReport
-----------------------------------------------------
DROP TABLE IF EXISTS autoflowReport;
CREATE TABLE IF NOT EXISTS autoflowReport (
reportID int(11) NOT NULL AUTO_INCREMENT ,
reportGUID varchar(80) NULL,
channelName varchar(80) NULL,
totalConc FLOAT NULL,
totalConcTol FLOAT NULL,
rmsdLimit FLOAT NULL,
avIntensity FLOAT NULL,
expDuration int(10) NULL,
expDurationTol FLOAT NULL,
wavelength int(10) NULL,
tripleDropped longtext DEFAULT 'none',
reportMaskJson json,
PRIMARY KEY (reportID) )
ENGINE = InnoDB;
-----------------------------------------------------
-- Table autoflowReportItem
-----------------------------------------------------
DROP TABLE IF EXISTS autoflowReportItem;
CREATE TABLE IF NOT EXISTS autoflowReportItem (
reportItemID int(11) NOT NULL AUTO_INCREMENT ,
reportGUID varchar(80) NOT NULL,
reportID int(11) NOT NULL,
type enum ('s', 'D', 'f', 'f/f0', 'MW', 'Radius') NOT NULL,
method enum ('2DSA-IT', 'PCSA-SL/DS/IS', '2DSA-MC', 'raw') NOT NULL,
rangeLow FLOAT NULL,
rangeHi FLOAT NULL,
integration FLOAT NULL,
tolerance FLOAT NULL,
totalPercent FLOAT NULL,
combinedPlot TinyInt(1) NOT NULL DEFAULT 1,
indCombinedPlot TinyInt(1) NOT NULL DEFAULT 1,
PRIMARY KEY (reportItemID) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table instrument
-- -----------------------------------------------------
DROP TABLE IF EXISTS instrument ;
CREATE TABLE IF NOT EXISTS instrument (
instrumentID int(11) NOT NULL AUTO_INCREMENT ,
labID int(11) NOT NULL ,
name TEXT NULL ,
serialNumber TEXT NULL ,
dateUpdated TIMESTAMP NULL ,
radialCalID int(11) NOT NULL DEFAULT 0 ,
optimaHost TEXT NULL ,
optimaPort int(11) NULL ,
optimaDBname TEXT NULL ,
optimaDBusername TEXT NULL ,
optimaDBpassw BLOB NULL ,
chromaticAB TEXT NULL ,
selected BOOL DEFAULT false ,
opsys1 ENUM ('UV/visible', 'Rayleigh Interference', 'Fluorescense', '(not installed)') NOT NULL ,
opsys2 ENUM ('UV/visible', 'Rayleigh Interference', 'Fluorescense', '(not installed)') NOT NULL ,
opsys3 ENUM ('UV/visible', 'Rayleigh Interference', 'Fluorescense', '(not installed)') NOT NULL ,
RadCalWvl int(11) NULL ,
optimaPortMsg int(11) NULL,
PRIMARY KEY (instrumentID) ,
INDEX ndx_instrument_labID (labID ASC) ,
CONSTRAINT fk_instrument_labID
FOREIGN KEY ( labID )
REFERENCES lab ( labID )
ON DELETE CASCADE
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table abstractRotor
-- -----------------------------------------------------
DROP TABLE IF EXISTS abstractRotor ;
CREATE TABLE IF NOT EXISTS abstractRotor (
abstractRotorID int(11) NOT NULL UNIQUE ,
abstractRotorGUID CHAR(36) NULL ,
name enum( 'Simulation', 'AN50', 'AN60', 'CFA' ) NULL ,
materialName enum( 'Titanium', 'CarbonFiber', 'Simulation' ) NULL ,
numHoles INT NULL ,
maxRPM INT NULL ,
magnetOffset FLOAT NULL ,
cellCenter FLOAT DEFAULT 6.5 ,
manufacturer enum( 'Beckman', 'SpinAnalytical', 'Simulation' ) NULL,
PRIMARY KEY (abstractRotorID) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table rotor
-- -----------------------------------------------------
DROP TABLE IF EXISTS rotor ;
CREATE TABLE IF NOT EXISTS rotor (
rotorID int(11) NOT NULL AUTO_INCREMENT ,
abstractRotorID int(11) NULL ,
labID int(11) NOT NULL ,
rotorGUID CHAR(36) NOT NULL UNIQUE,
name TEXT NULL ,
serialNumber TEXT NULL ,
PRIMARY KEY (rotorID) ,
INDEX ndx_rotor_abstractRotorID (abstractRotorID ASC) ,
INDEX ndx_rotor_labID (labID ASC) ,
CONSTRAINT fk_rotor_abstractRotorID
FOREIGN KEY (abstractRotorID )
REFERENCES abstractRotor (abstractRotorID )
ON DELETE SET NULL
ON UPDATE CASCADE,
CONSTRAINT fk_rotor_labID
FOREIGN KEY (labID )
REFERENCES lab (labID )
ON DELETE CASCADE
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table rotorCalibration
-- -----------------------------------------------------
DROP TABLE IF EXISTS rotorCalibration ;
CREATE TABLE IF NOT EXISTS rotorCalibration (
rotorCalibrationID int(11) NOT NULL AUTO_INCREMENT ,
rotorID int(11) NULL ,
rotorCalibrationGUID CHAR(36) NOT NULL UNIQUE,
label VARCHAR(80) NOT NULL DEFAULT '',
report TEXT NULL ,
coeff1 FLOAT default 0.0,
coeff2 FLOAT default 0.0,
omega2_t FLOAT NULL ,
dateUpdated TIMESTAMP NULL ,
calibrationExperimentID int(11) NULL ,
PRIMARY KEY (rotorCalibrationID) ,
INDEX ndx_rotorCalibration_rotorID (rotorID ASC) ,
INDEX ndx_rotorCalibration_experimentID (calibrationExperimentID ASC) ,
CONSTRAINT fk_rotorCalibration_rotorID
FOREIGN KEY (rotorID )
REFERENCES rotor (rotorID )
ON DELETE SET NULL
ON UPDATE CASCADE )
-- CONSTRAINT fk_rotorCalibration_experimentID
-- FOREIGN KEY (calibrationExperimentID )
-- REFERENCES experiment (experimentID ) )
-- ON DELETE SET NULL
-- ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table experiment
-- -----------------------------------------------------
DROP TABLE IF EXISTS experiment ;
CREATE TABLE IF NOT EXISTS experiment (
experimentID int(11) NOT NULL AUTO_INCREMENT ,
projectID int(11) NULL ,
runID VARCHAR(80) NOT NULL ,
labID int(11) NULL ,
instrumentID int(11) NOT NULL ,
operatorID int(11) NULL ,
rotorID int(11) NULL ,
rotorCalibrationID int(11) NULL ,
experimentGUID CHAR(36) NULL UNIQUE,
type ENUM('velocity', 'equilibrium', 'diffusion', 'buoyancy', 'calibration', 'other') NULL
DEFAULT 'velocity',
runType ENUM('RA', 'RI', 'IP', 'FI', 'WA', 'WI', 'RI+IP', 'RI+FI', 'IP+FI', 'RI+IP+FI') NULL
DEFAULT NULL,
dateBegin DATE NOT NULL ,
runTemp FLOAT NULL ,
label VARCHAR(80) NULL ,
comment TEXT NULL ,
RIProfile LONGTEXT NULL ,
protocolGUID CHAR(36) NULL ,
centrifugeProtocol TEXT NULL ,
dateUpdated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY (experimentID) ,
INDEX ndx_experiment_projectID (projectID ASC) ,
INDEX ndx_experiment_operatorID (operatorID ASC) ,
INDEX ndx_experiment_instrumentID (instrumentID ASC) ,
INDEX ndx_experiment_labID (labID ASC) ,
INDEX ndx_experiment_rotorID (rotorID ASC) ,
INDEX ndx_experiment_calibrationID (rotorCalibrationID ASC) ,
CONSTRAINT fk_experiment_projectID
FOREIGN KEY (projectID )
REFERENCES project (projectID )
ON DELETE SET NULL
ON UPDATE CASCADE,
CONSTRAINT fk_experiment_operatorID
FOREIGN KEY (operatorID )
REFERENCES people (personID )
ON DELETE SET NULL
ON UPDATE CASCADE,
CONSTRAINT fk_experiment_instrumentID
FOREIGN KEY (instrumentID )
REFERENCES instrument (instrumentID )
ON DELETE NO ACTION
ON UPDATE CASCADE,
CONSTRAINT fk_experiment_labID
FOREIGN KEY (labID )
REFERENCES lab (labID )
ON DELETE SET NULL
ON UPDATE CASCADE,
CONSTRAINT fk_experiment_rotorID
FOREIGN KEY (rotorID )
REFERENCES rotor (rotorID )
ON DELETE SET NULL
ON UPDATE CASCADE,
CONSTRAINT fk_experiment_calibrationID
FOREIGN KEY (rotorCalibrationID )
REFERENCES rotorCalibration (rotorCalibrationID )
ON DELETE SET NULL
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table abstractCenterpiece
-- -----------------------------------------------------
DROP TABLE IF EXISTS abstractCenterpiece ;
CREATE TABLE IF NOT EXISTS abstractCenterpiece (
abstractCenterpieceID int(11) NOT NULL UNIQUE ,
loadMethod enum('top', 'side') NULL ,
abstractCenterpieceGUID CHAR(36) NULL ,
name TEXT NULL ,
materialName TEXT NULL ,
channels INT NOT NULL ,
bottom VARCHAR(20) NOT NULL ,
shape enum( 'standard', 'rectangular', 'circular', 'synthetic',
'band forming', 'meniscus matching', 'sector' )
NOT NULL DEFAULT 'standard',
maxRPM INT NULL ,
pathLength FLOAT NULL ,
angle FLOAT NULL ,
width FLOAT NULL ,
canHoldSample INT NULL ,
materialRefURI TEXT NULL ,
centerpieceRefURI TEXT NULL ,
dataUpdated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY (abstractCenterpieceID) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table radialCalibration
-- -----------------------------------------------------
DROP TABLE IF EXISTS radialCalibration ;
CREATE TABLE IF NOT EXISTS radialCalibration (
radialCalID int(11) NOT NULL AUTO_INCREMENT ,
radialCalGUID char(36) NOT NULL UNIQUE ,
speed int(11) NOT NULL DEFAULT 0 ,
rotorCalID int(11) NOT NULL DEFAULT 0 ,
dateUpdated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY (radialCalID) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table cell
-- -----------------------------------------------------
DROP TABLE IF EXISTS cell ;
CREATE TABLE IF NOT EXISTS cell (
cellID int(11) NOT NULL AUTO_INCREMENT ,
cellType enum( 'counterbalance', 'sample', 'reference' ) NULL ,
windowType enum( 'quartz', 'saffire' ) NULL ,
abstractCenterpieceID int(11) NULL ,
experimentID int(11) NULL ,
cellGUID CHAR(36) NULL ,
name TEXT NULL ,
holeNumber INT NULL ,
housing TEXT NULL ,
centerpieceSerialNumber TEXT NULL ,
numChannels INT ,
dateUpdated TIMESTAMP NULL ,
PRIMARY KEY (cellID) ,
INDEX ndx_cell_abstractCenterpieceID (abstractCenterpieceID ASC) ,
INDEX ndx_cell_experimentID (experimentID ASC) ,
CONSTRAINT fk_cell_abstractCenterpieceID
FOREIGN KEY (abstractCenterpieceID )
REFERENCES abstractCenterpiece (abstractCenterpieceID )
ON DELETE SET NULL
ON UPDATE CASCADE,
CONSTRAINT fk_cell_experimentID
FOREIGN KEY (experimentID )
REFERENCES experiment (experimentID )
ON DELETE SET NULL
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table abstractChannel
-- -----------------------------------------------------
DROP TABLE IF EXISTS abstractChannel ;
CREATE TABLE IF NOT EXISTS abstractChannel (
abstractChannelID int(11) NOT NULL AUTO_INCREMENT ,
channelType enum('reference','sample') NULL ,
channelShape enum( 'sector', 'rectangular' ) NULL ,
abstractChannelGUID CHAR(36) NULL ,
name VARCHAR(100) NULL ,
number INT NULL ,
radialBegin FLOAT NULL ,
radialEnd FLOAT NULL ,
degreesWide FLOAT NULL ,
degreesOffset FLOAT NULL ,
radialBandTop FLOAT NULL ,
radialBandBottom FLOAT NULL ,
radialMeniscusPos FLOAT NULL ,
dateUpdated DATE NULL ,
PRIMARY KEY (abstractChannelID) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table channel
-- -----------------------------------------------------
DROP TABLE IF EXISTS channel ;
CREATE TABLE IF NOT EXISTS channel (
channelID int(11) NOT NULL AUTO_INCREMENT ,
abstractChannelID int(11) NULL ,
channelGUID CHAR(36) NULL ,
comments TEXT NULL DEFAULT NULL ,
dateUpdated TIMESTAMP NULL DEFAULT NULL ,
PRIMARY KEY (channelID) ,
INDEX ndx_channel_abstractChannelID (abstractChannelID ASC) )
-- CONSTRAINT fk_channel_abstractChannelID
-- FOREIGN KEY (abstractChannelID )
-- REFERENCES abstractChannel (abstractChannelID )
-- ON DELETE SET NULL
-- ON UPDATE NULL)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table solution
-- -----------------------------------------------------
DROP TABLE IF EXISTS solution ;
CREATE TABLE IF NOT EXISTS solution (
solutionID int(11) NOT NULL AUTO_INCREMENT ,
solutionGUID CHAR(36) NULL ,
description VARCHAR(80) NOT NULL ,
commonVbar20 DOUBLE DEFAULT 0.0,
storageTemp FLOAT DEFAULT NULL ,
notes TEXT NULL DEFAULT NULL ,
PRIMARY KEY (solutionID) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table solutionBuffer
-- -----------------------------------------------------
DROP TABLE IF EXISTS solutionBuffer ;
CREATE TABLE IF NOT EXISTS solutionBuffer (
solutionID int(11) NOT NULL ,
bufferID int(11) NOT NULL ,
PRIMARY KEY (solutionID) ,
INDEX ndx_solutionBuffer_solutionID (solutionID ASC) ,
INDEX ndx_solutionBuffer_bufferID (bufferID ASC) ,
CONSTRAINT fk_solutionBuffer_solutionID
FOREIGN KEY (solutionID )
REFERENCES solution (solutionID )
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT fk_solutionBuffer_bufferID
FOREIGN KEY (bufferID )
REFERENCES buffer (bufferID )
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table solutionAnalyte
-- -----------------------------------------------------
DROP TABLE IF EXISTS solutionAnalyte ;
CREATE TABLE IF NOT EXISTS solutionAnalyte (
solutionID int(11) NOT NULL ,
analyteID int(11) NOT NULL ,
amount FLOAT NOT NULL ,
INDEX ndx_solutionAnalyte_solutionID (solutionID ASC) ,
INDEX ndx_solutionAnalyte_analyteID (analyteID ASC) ,
CONSTRAINT fk_solutionAnalyte_solutionID
FOREIGN KEY (solutionID )
REFERENCES solution (solutionID )
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT fk_solutionAnalyte_analyteID
FOREIGN KEY (analyteID )
REFERENCES analyte (analyteID )
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table solutionPerson
-- -----------------------------------------------------
DROP TABLE IF EXISTS solutionPerson ;
CREATE TABLE IF NOT EXISTS solutionPerson (
solutionID int(11) NOT NULL ,
personID int(11) NOT NULL ,
PRIMARY KEY (solutionID) ,
INDEX ndx_solutionPerson_personID (personID ASC) ,
INDEX ndx_solutionPerson_solutionID (solutionID ASC) ,
CONSTRAINT fk_solutionPerson_personID
FOREIGN KEY (personID )
REFERENCES people (personID )
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT fk_solutionPerson_solutionID
FOREIGN KEY (solutionID )
REFERENCES solution (solutionID )
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table experimentSolutionChannel
-- -----------------------------------------------------
DROP TABLE IF EXISTS experimentSolutionChannel ;
CREATE TABLE IF NOT EXISTS experimentSolutionChannel (
experimentID int(11) NOT NULL ,
solutionID int(11) NOT NULL ,
channelID int(11) NOT NULL ,
INDEX ndx_experimentSolutionChannel_experimentID (experimentID ASC) ,
INDEX ndx_experimentSolutionChannel_channelID (channelID ASC) ,
INDEX ndx_experimentSolutionChannel_solutionID (solutionID ASC) ,
CONSTRAINT fk_experimentSolutionChannel_experimentID
FOREIGN KEY (experimentID )
REFERENCES experiment (experimentID )
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT fk_experimentSolutionChannel_channelID
FOREIGN KEY (channelID )
REFERENCES channel (channelID )
ON DELETE NO ACTION
ON UPDATE CASCADE,
CONSTRAINT fk_experimentSolutionChannel_solutionID
FOREIGN KEY ( solutionID )
REFERENCES solution (solutionID)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table rawData
-- The data field is not expected to be NULL, but loading
-- this table is a 2-step process
-- -----------------------------------------------------
DROP TABLE IF EXISTS rawData ;
CREATE TABLE IF NOT EXISTS rawData (
rawDataID int(11) NOT NULL AUTO_INCREMENT ,
rawDataGUID CHAR(36) NOT NULL UNIQUE ,
label VARCHAR(80) NOT NULL default '',
filename VARCHAR(255) NOT NULL DEFAULT '',
data LONGBLOB NULL ,
comment TEXT NULL ,
experimentID int(11) NOT NULL ,
solutionID int(11) NOT NULL ,
channelID int(11) NOT NULL ,
lastUpdated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY (rawDataID) ,
INDEX ndx_rawData_experimentID (experimentID ASC) ,
INDEX ndx_rawData_channelID (channelID ASC) ,
CONSTRAINT fk_rawData_experimentID
FOREIGN KEY (experimentID )
REFERENCES experiment (experimentID )
ON DELETE NO ACTION
ON UPDATE CASCADE,
CONSTRAINT fk_rawData_channelID
FOREIGN KEY (channelID )
REFERENCES channel (channelID )
ON DELETE NO ACTION
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table editedData
--
-- Notes:
-- rawDataID is set to allow NULL to accommodate
-- certain special records
-- -----------------------------------------------------
DROP TABLE IF EXISTS editedData ;
CREATE TABLE IF NOT EXISTS editedData (
editedDataID int(11) NOT NULL AUTO_INCREMENT ,
rawDataID int(11) NULL DEFAULT NULL ,
editGUID CHAR(36) NOT NULL UNIQUE ,
label VARCHAR(80) NOT NULL DEFAULT '' ,
data LONGBLOB NULL ,
filename VARCHAR(255) NOT NULL DEFAULT '' ,
comment TEXT NULL ,
lastUpdated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
PRIMARY KEY (editedDataID) ,
INDEX ndx_editedData_rawDataID (rawDataID ASC) ,
CONSTRAINT fk_editedData_rawDataID
FOREIGN KEY (rawDataID )
REFERENCES rawData (rawDataID )
ON DELETE NO ACTION
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Special records for table editedData
-- -----------------------------------------------------
INSERT INTO editedData SET
editedDataID = 1 ,
rawDataID = NULL ,
editGUID = '00000000-0000-0000-0000-000000000000',
label = 'UNASSIGNED' ,
data = '' ,
comment = 'Link to this record when an editedData record is unassigned' ;
-- -----------------------------------------------------
-- Table projectPerson
-- -----------------------------------------------------
DROP TABLE IF EXISTS projectPerson ;
CREATE TABLE IF NOT EXISTS projectPerson (
projectID int(11) NOT NULL ,
personID int(11) NOT NULL ,
INDEX ndx_projectPerson_personID (personID ASC) ,
INDEX ndx_projectPerson_projectID (projectID ASC) ,
CONSTRAINT fk_projectPerson_personID
FOREIGN KEY (personID )
REFERENCES people (personID )
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT fk_projectPerson_projectID
FOREIGN KEY (projectID )
REFERENCES project (projectID )
ON DELETE NO ACTION
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table experimentPerson
-- -----------------------------------------------------
DROP TABLE IF EXISTS experimentPerson ;
CREATE TABLE IF NOT EXISTS experimentPerson (
experimentID int(11) NOT NULL ,
personID int(11) NOT NULL ,
INDEX ndx_experimentPerson_experimentID (experimentID ASC) ,
INDEX ndx_experimentPerson_personID (personID ASC) ,
CONSTRAINT fk_experimentPerson_experimentID
FOREIGN KEY (experimentID )
REFERENCES experiment (experimentID )
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT fk_experimentPerson_personID
FOREIGN KEY (personID )
REFERENCES people (personID )
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table buffer
-- -----------------------------------------------------
DROP TABLE IF EXISTS buffer ;
CREATE TABLE IF NOT EXISTS buffer (
bufferID int(11) NOT NULL AUTO_INCREMENT ,
bufferGUID CHAR(36) NOT NULL UNIQUE ,
description TEXT NULL DEFAULT NULL ,
compressibility FLOAT NULL DEFAULT NULL ,
pH FLOAT NULL DEFAULT NULL ,
viscosity FLOAT NULL DEFAULT NULL ,
density FLOAT NULL DEFAULT NULL ,
manual TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (bufferID) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table bufferComponent
-- Handle bufferComponentID in code, so they can be
-- the same on multiple databases
-- -----------------------------------------------------
DROP TABLE IF EXISTS bufferComponent ;
CREATE TABLE IF NOT EXISTS bufferComponent (
bufferComponentID int(11) NOT NULL UNIQUE ,
units VARCHAR(16) NOT NULL DEFAULT 'mM',
description TEXT NULL DEFAULT NULL ,
viscosity TEXT NULL DEFAULT NULL ,
density TEXT NULL DEFAULT NULL ,
c_range TEXT NULL DEFAULT NULL ,
gradientForming TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (bufferComponentID) )