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

ALTER TABLE dbo.midiasoftwarechave ALTER COLUMN idmidiasoftwarechave INTEGER NOT NULL;
ALTER TABLE dbo.midiasoftwarechave ALTER COLUMN idmidiasoftware INTEGER NOT NULL;

ALTER TABLE dbo.midiasoftwarechave ADD CONSTRAINT PK_midiasoftwarechave PRIMARY KEY CLUSTERED (idmidiasoftwarechave) WITH ( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY];

CREATE NONCLUSTERED INDEX idx_chave ON dbo.midiasoftwarechave (chave) WITH ( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY];

ALTER TABLE dbo.midiasoftwarechave ADD CONSTRAINT FK_midsof_midsofchave_idx FOREIGN KEY (idmidiasoftware) REFERENCES dbo.midiasoftware (idmidiasoftware) ON UPDATE  NO ACTION ON DELETE NO ACTION;

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