﻿--Migration
PRINT N'Altering Table [dbo].[T_TANULO]...';


GO
ALTER TABLE [dbo].[T_TANULO]
    ADD [C_MENTORID] INT NULL;


GO
PRINT N'Creating Index [dbo].[T_TANULO].[NCI_Tanulo_MentorId]...';


GO
CREATE NONCLUSTERED INDEX [NCI_Tanulo_MentorId]
    ON [dbo].[T_TANULO]([C_MENTORID] ASC);


GO
PRINT N'Creating Foreign Key [dbo].[FK_Tanulo_MentorId_REF_Alkalmazott]...';


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_Tanulo_MentorId_REF_Alkalmazott] FOREIGN KEY ([C_MENTORID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


GO

EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'Ebben a mezőben tároljuk a tanulóhoz rendelt mentortanár ID-ját.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_TANULO', @level2type = N'COLUMN', @level2name = N'C_MENTORID';
ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_Tanulo_MentorId_REF_Alkalmazott];

EXEC dev.uspCreateSchemaViews 'T_TANULO'

EXEC dev.sp_Global_GenerateAsyncAuditTriggerAll

GO
PRINT N'Update complete.';


GO
