Measurements — adding notes, changing schema

This commit is contained in:
Matthew Dillon 2014-12-03 12:51:36 -09:00
parent 4eecb36e34
commit f33205e721
4 changed files with 13 additions and 14 deletions

View file

@ -48,8 +48,8 @@ func TestMeasurementsStore_Get_db(t *testing.T) {
t.Fatal(err)
}
normalizeTime(&want.CreatedAt, &want.UpdatedAt, &want.DeletedAt)
normalizeTime(&measurement.CreatedAt, &measurement.UpdatedAt, &measurement.DeletedAt)
normalizeTime(&want.CreatedAt, &want.UpdatedAt)
normalizeTime(&measurement.CreatedAt, &measurement.UpdatedAt)
if !reflect.DeepEqual(measurement, want) {
t.Errorf("got measurement %+v, want %+v", measurement, want)
@ -91,8 +91,8 @@ func TestMeasurementsStore_List_db(t *testing.T) {
}
for i := range want {
normalizeTime(&want[i].CreatedAt, &want[i].UpdatedAt, &want[i].DeletedAt)
normalizeTime(&measurements[i].CreatedAt, &measurements[i].UpdatedAt, &measurements[i].DeletedAt)
normalizeTime(&want[i].CreatedAt, &want[i].UpdatedAt)
normalizeTime(&measurements[i].CreatedAt, &measurements[i].UpdatedAt)
}
if !reflect.DeepEqual(measurements, want) {
t.Errorf("got measurements %+v, want %+v", measurements, want)

View file

@ -6,13 +6,13 @@ CREATE TABLE measurements (
strain_id BIGINT,
observation_id BIGINT,
text_measurement_type_id BIGINT NULL,
measurement_value NUMERIC(6, 4) NULL,
confidence_interval NUMERIC(6, 4) NULL,
measurement_value NUMERIC(8, 3) NULL,
confidence_interval NUMERIC(8, 3) NULL,
unit_type_id BIGINT NULL,
notes CHARACTER VARYING(255) NULL,
created_at TIMESTAMP WITH TIME ZONE,
updated_at TIMESTAMP WITH TIME ZONE,
deleted_at TIMESTAMP WITH TIME ZONE,
CONSTRAINT strainsobsmeasurements_pkey PRIMARY KEY (id),
FOREIGN KEY (strain_id) REFERENCES strains(id),