﻿--Migration
IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'NCU_Cim_FelhasznaloId_GondviseloId_TanevId') BEGIN
  CREATE UNIQUE INDEX NCU_Cim_FelhasznaloId_GondviseloId_TanevId
     ON T_CIM (
        C_FELHASZNALOID
       ,C_GONDVISELOID
       ,C_TANEVID)
     WHERE TOROLT = 'F' AND C_ALAPERTELMEZETT = 'T'
END
GO

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'NCU_Email_FelhasznaloId_GondviseloId_TanevId') BEGIN
  CREATE UNIQUE INDEX NCU_Email_FelhasznaloId_GondviseloId_TanevId
     ON T_EMAIL (
        C_FELHASZNALOID
       ,C_GONDVISELOID
       ,C_TANEVID)
     WHERE TOROLT = 'F' AND C_ALAPERTELMEZETT = 'T'
END
GO

IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'NCU_Telefon_FelhasznaloId_GondviseloId_TanevId') BEGIN
  CREATE UNIQUE INDEX NCU_Telefon_FelhasznaloId_GondviseloId_TanevId
     ON T_TELEFON (
        C_FELHASZNALOID
       ,C_GONDVISELOID
       ,C_TANEVID)
     WHERE TOROLT = 'F' AND C_ALAPERTELMEZETT = 'T'
END
GO