Consolidating strainsobservations & measurements.
This commit is contained in:
		
							parent
							
								
									5bee929694
								
							
						
					
					
						commit
						aadb24bf33
					
				
					 8 changed files with 4 additions and 24 deletions
				
			
		|  | @ -1,5 +0,0 @@ | ||||||
| -- bactdb |  | ||||||
| -- Matthew R Dillon |  | ||||||
| 
 |  | ||||||
| DROP TABLE strainsobservations; |  | ||||||
| 
 |  | ||||||
|  | @ -1,17 +0,0 @@ | ||||||
| -- bactdb |  | ||||||
| -- Matthew R Dillon |  | ||||||
| 
 |  | ||||||
| CREATE TABLE strainsobservations ( |  | ||||||
|     id BIGSERIAL NOT NULL, |  | ||||||
|     strain_id BIGINT NOT NULL, |  | ||||||
|     observations_id BIGINT NOT NULL, |  | ||||||
| 
 |  | ||||||
|     created_at TIMESTAMP WITH TIME ZONE, |  | ||||||
|     updated_at TIMESTAMP WITH TIME ZONE, |  | ||||||
|     deleted_at TIMESTAMP WITH TIME ZONE, |  | ||||||
| 
 |  | ||||||
|     CONSTRAINT strainsobservations_pkey PRIMARY KEY (id), |  | ||||||
|     FOREIGN KEY (strain_id) REFERENCES strains(id), |  | ||||||
|     FOREIGN KEY (observations_id) REFERENCES observations(id) |  | ||||||
| ); |  | ||||||
| 
 |  | ||||||
|  | @ -3,7 +3,8 @@ | ||||||
| 
 | 
 | ||||||
| CREATE TABLE measurements ( | CREATE TABLE measurements ( | ||||||
|     id BIGSERIAL NOT NULL, |     id BIGSERIAL NOT NULL, | ||||||
|     strainsobservations_id BIGINT, |     strain_id BIGINT, | ||||||
|  |     observation_id BIGINT, | ||||||
|     text_measurement_type_id BIGINT NULL, |     text_measurement_type_id BIGINT NULL, | ||||||
|     measurement_value NUMERIC(6, 4) NULL, |     measurement_value NUMERIC(6, 4) NULL, | ||||||
|     confidence_interval NUMERIC(6, 4) NULL, |     confidence_interval NUMERIC(6, 4) NULL, | ||||||
|  | @ -14,7 +15,8 @@ CREATE TABLE measurements ( | ||||||
|     deleted_at TIMESTAMP WITH TIME ZONE, |     deleted_at TIMESTAMP WITH TIME ZONE, | ||||||
| 
 | 
 | ||||||
|     CONSTRAINT strainsobsmeasurements_pkey PRIMARY KEY (id), |     CONSTRAINT strainsobsmeasurements_pkey PRIMARY KEY (id), | ||||||
|     FOREIGN KEY (strainsobservations_id) REFERENCES strainsobservations(id), |     FOREIGN KEY (strain_id) REFERENCES strains(id), | ||||||
|  |     FOREIGN KEY (observation_id) REFERENCES observations(id), | ||||||
|     FOREIGN KEY (text_measurement_type_id) REFERENCES text_measurement_types(id), |     FOREIGN KEY (text_measurement_type_id) REFERENCES text_measurement_types(id), | ||||||
|     FOREIGN KEY (unit_type_id) REFERENCES unit_types(id), |     FOREIGN KEY (unit_type_id) REFERENCES unit_types(id), | ||||||
|     CONSTRAINT exclusive_data_type CHECK ( |     CONSTRAINT exclusive_data_type CHECK ( | ||||||
		Reference in a new issue
	
	 Matthew Dillon
						Matthew Dillon