Rough in species

This commit is contained in:
Matthew Dillon 2015-06-02 12:27:42 -08:00
parent e2ba99c511
commit 0ceaccf0e4
3 changed files with 133 additions and 1 deletions

View file

@ -13,9 +13,16 @@ CREATE TABLE species (
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 species_pkey PRIMARY KEY (id),
FOREIGN KEY (genus_id) REFERENCES genera(id),
FOREIGN KEY (subspecies_species_id) REFERENCES species(id)
FOREIGN KEY (subspecies_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 genus_id_idx ON species (genus_id);