-- Migration from 007 to 008

CREATE TABLE FEATURE_VOCABULARY_TERMS (
	ID BIGSERIAL  NOT NULL,

  CODE NAME NOT NULL,
	-- If FEATURE_DEFS referenced with FD_ID has HAS_VOCABULARY_VALUES == true 
  -- then the sequence number is referenced in the FEATURE_VALUES.VALUES matrix
	SEQUENCE_NUMBER INTEGER NOT NULL,
	FD_ID  TECH_ID NOT NULL,

	PRIMARY KEY (ID),
	CONSTRAINT FK_FEATURE_VOCABULARY_TERMS_1 FOREIGN KEY (FD_ID) REFERENCES FEATURE_DEFS (ID) ON DELETE CASCADE ON UPDATE CASCADE
);

CREATE INDEX FEATURE_VOCABULARY_TERMS_FD_IDX ON FEATURE_VOCABULARY_TERMS(FD_ID);
