
-- Database update August 13, 2018


-- Creates ZoneHighlight table and create index

DROP TABLE IF EXISTS ZoneHighlight CASCADE;
CREATE TABLE ZoneHighlight (
  zoneHighlightId bigint GENERATED ALWAYS AS IDENTITY,
  analysisId bigint NOT NULL,
  name varchar(250) NOT NULL,
  zoneIds text NOT NULL, -- [553,557,558,555, etc...]

  PRIMARY KEY (zoneHighlightId),
  FOREIGN KEY (analysisId) REFERENCES Analysis(analysisId)
);
ALTER SEQUENCE ZoneHighlight_zoneHighlightId_seq RESTART WITH 100;

DROP INDEX IF EXISTS idx_zonehighlight_analysis;
CREATE INDEX idx_zonehighlight_analysis ON Analysis(analysisId);