-- INICIO - GILBERTO NERY - 04/11/2015

ALTER TABLE midiasoftwarechave
   ALTER COLUMN idmidiasoftwarechave SET NOT NULL;
   
ALTER TABLE midiasoftwarechave
  ADD CONSTRAINT pk_idmidiasoftwarechave PRIMARY KEY (idmidiasoftwarechave);
  
ALTER TABLE midiasoftwarechave
  ADD CONSTRAINT "FK_midsof_midsofchave_idx" FOREIGN KEY (idmidiasoftware) REFERENCES midiasoftware (idmidiasoftware) ON UPDATE NO ACTION ON DELETE NO ACTION;
  
CREATE INDEX idx_chave ON midiasoftwarechave (chave ASC NULLS LAST);

-- FIM - GILBERTO NERY - 04/11/2015