Authorship

This commit is contained in:
Matthew Dillon 2015-05-13 15:25:02 -08:00
parent 8dc3e2a3fb
commit 1298cffca2
6 changed files with 29 additions and 5 deletions

View file

@ -24,6 +24,9 @@ type CharacteristicBase struct {
CreatedAt time.Time `db:"created_at" json:"createdAt"` CreatedAt time.Time `db:"created_at" json:"createdAt"`
UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"`
DeletedAt NullTime `db:"deleted_at" json:"deletedAt"` DeletedAt NullTime `db:"deleted_at" json:"deletedAt"`
CreatedBy int64 `db:"created_by" json:"createdBy"`
UpdatedBy int64 `db:"updated_by" json:"updatedBy"`
DeletedBy NullInt64 `db:"deleted_by" json:"deletedBy"`
} }
type Characteristic struct { type Characteristic struct {

View file

@ -35,6 +35,8 @@ type MeasurementBase struct {
TestMethodId NullInt64 `db:"test_method_id" json:"-"` TestMethodId NullInt64 `db:"test_method_id" json:"-"`
CreatedAt time.Time `db:"created_at" json:"createdAt"` CreatedAt time.Time `db:"created_at" json:"createdAt"`
UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"`
CreatedBy int64 `db:"created_by" json:"createdBy"`
UpdatedBy int64 `db:"updated_by" json:"updatedBy"`
} }
// Measurement & MeasurementJSON(s) are what ember expects to see // Measurement & MeasurementJSON(s) are what ember expects to see

View file

@ -10,15 +10,20 @@ CREATE TABLE strains (
genbank TEXT NULL, genbank TEXT NULL,
isolated_from TEXT NULL, isolated_from TEXT NULL,
notes TEXT NULL, notes TEXT NULL,
author_id BIGINT NOT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL, created_at TIMESTAMP WITH TIME ZONE NOT NULL,
updated_at TIMESTAMP WITH TIME ZONE NOT NULL, updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
deleted_at TIMESTAMP WITH TIME ZONE NULL, deleted_at TIMESTAMP WITH TIME ZONE NULL,
created_by BIGINT NOT NULL,
updated_by BIGINT NOT NULL,
deleted_by BIGINT NULL,
CONSTRAINT strain_pkey PRIMARY KEY (id), CONSTRAINT strain_pkey PRIMARY KEY (id),
FOREIGN KEY (species_id) REFERENCES species(id), FOREIGN KEY (species_id) REFERENCES species(id),
FOREIGN KEY (author_id) REFERENCES users(id) FOREIGN KEY (created_by) REFERENCES users(id),
FOREIGN KEY (updated_by) REFERENCES users(id),
FOREIGN KEY (deleted_by) REFERENCES users(id)
); );
CREATE INDEX species_id_idx ON strains (species_id); CREATE INDEX species_id_idx ON strains (species_id);

View file

@ -10,8 +10,15 @@ CREATE TABLE characteristics (
updated_at TIMESTAMP WITH TIME ZONE NOT NULL, updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
deleted_at TIMESTAMP WITH TIME ZONE NULL, deleted_at TIMESTAMP WITH TIME ZONE NULL,
created_by BIGINT NOT NULL,
updated_by BIGINT NOT NULL,
deleted_by BIGINT NULL,
CONSTRAINT characteristics_pkey PRIMARY KEY (id), CONSTRAINT characteristics_pkey PRIMARY KEY (id),
FOREIGN KEY (characteristic_type_id) REFERENCES characteristic_types(id) FOREIGN KEY (characteristic_type_id) REFERENCES characteristic_types(id),
FOREIGN KEY (created_by) REFERENCES users(id),
FOREIGN KEY (updated_by) REFERENCES users(id),
FOREIGN KEY (deleted_by) REFERENCES users(id)
); );
CREATE INDEX characteristic_type_id_idx ON characteristics (characteristic_type_id); CREATE INDEX characteristic_type_id_idx ON characteristics (characteristic_type_id);

View file

@ -16,6 +16,9 @@ CREATE TABLE measurements (
created_at TIMESTAMP WITH TIME ZONE NOT NULL, created_at TIMESTAMP WITH TIME ZONE NOT NULL,
updated_at TIMESTAMP WITH TIME ZONE NOT NULL, updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
created_by BIGINT NOT NULL,
updated_by BIGINT NOT NULL,
CONSTRAINT strainscharmeasurements_pkey PRIMARY KEY (id), CONSTRAINT strainscharmeasurements_pkey PRIMARY KEY (id),
FOREIGN KEY (strain_id) REFERENCES strains(id), FOREIGN KEY (strain_id) REFERENCES strains(id),
FOREIGN KEY (characteristic_id) REFERENCES characteristics(id), FOREIGN KEY (characteristic_id) REFERENCES characteristics(id),
@ -37,7 +40,9 @@ CREATE TABLE measurements (
AND txt_value IS NOT NULL AND txt_value IS NOT NULL
AND num_value IS NULL AND num_value IS NULL
AND confidence_interval IS NULL AND confidence_interval IS NULL
AND unit_type_id IS NULL)) AND unit_type_id IS NULL)),
FOREIGN KEY (created_by) REFERENCES users(id),
FOREIGN KEY (updated_by) REFERENCES users(id)
); );
CREATE INDEX strain_id_idx ON measurements (strain_id); CREATE INDEX strain_id_idx ON measurements (strain_id);

View file

@ -29,10 +29,12 @@ type StrainBase struct {
Genbank NullString `db:"genbank" json:"genbank"` Genbank NullString `db:"genbank" json:"genbank"`
IsolatedFrom NullString `db:"isolated_from" json:"isolatedFrom"` IsolatedFrom NullString `db:"isolated_from" json:"isolatedFrom"`
Notes NullString `db:"notes" json:"notes"` Notes NullString `db:"notes" json:"notes"`
AuthorId int64 `db:"author_id" json:"author"`
CreatedAt time.Time `db:"created_at" json:"createdAt"` CreatedAt time.Time `db:"created_at" json:"createdAt"`
UpdatedAt time.Time `db:"updated_at" json:"updatedAt"` UpdatedAt time.Time `db:"updated_at" json:"updatedAt"`
DeletedAt NullTime `db:"deleted_at" json:"deletedAt"` DeletedAt NullTime `db:"deleted_at" json:"deletedAt"`
CreatedBy int64 `db:"created_by" json:"createdBy"`
UpdatedBy int64 `db:"updated_by" json:"updatedBy"`
DeletedBy NullInt64 `db:"deleted_by" json:"deletedBy"`
} }
// Strain & StrainJSON(s) are what ember expects to see // Strain & StrainJSON(s) are what ember expects to see