This repository has been archived on 2025-03-30. You can view files and clone it, but cannot push or open issues or pull requests.
bactdb/migrations/00004_AddStrain_up.sql
Matthew Dillon 1298cffca2 Authorship
2015-05-13 15:25:02 -08:00

30 lines
833 B
SQL

-- bactdb
-- Matthew R Dillon
CREATE TABLE strains (
id BIGSERIAL NOT NULL,
species_id BIGINT NOT NULL,
strain_name TEXT NOT NULL,
type_strain BOOLEAN NOT NULL,
accession_numbers TEXT NULL,
genbank TEXT NULL,
isolated_from TEXT NULL,
notes TEXT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
updated_at TIMESTAMP WITH TIME ZONE NOT 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),
FOREIGN KEY (species_id) REFERENCES species(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);