﻿PRINT N'Altering Table [dbo].[T_TANULOMENTESSEG]...';


GO
ALTER TABLE [dbo].[T_TANULOMENTESSEG]
    ADD [C_FELMENTESROGZITESIDOPONTJA] DATETIME NULL,
        [C_UTOLSOMODOSITASIDOPONTJA]   DATETIME NULL,
        [C_FELMENTESROGZITOTANARID]  INT      NULL,
        [C_UTOLSOMODOSITOTANARID]    INT      NULL;


GO
PRINT N'Creating Index [dbo].[T_TANULOMENTESSEG].[NCI_TanuloMentesseg_FelmentesRogzitoTanarId]...';


GO
CREATE NONCLUSTERED INDEX [NCI_TanuloMentesseg_FelmentesRogzitoTanarId]
    ON [dbo].[T_TANULOMENTESSEG]([C_FELMENTESROGZITOTANARID] ASC);


GO
PRINT N'Creating Index [dbo].[T_TANULOMENTESSEG].[NCI_TanuloMentesseg_UtolsoModositoTanarId]...';


GO
CREATE NONCLUSTERED INDEX [NCI_TanuloMentesseg_UtolsoModositoTanarId]
    ON [dbo].[T_TANULOMENTESSEG]([C_UTOLSOMODOSITOTANARID] ASC);


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


GO
ALTER TABLE [dbo].[T_TANULOMENTESSEG] WITH NOCHECK
    ADD CONSTRAINT [FK_TanuloMentesseg_FelmentesRogzitoTanarId_REF_Felhasznalo] FOREIGN KEY ([C_FELMENTESROGZITOTANARID]) REFERENCES [dbo].[T_FELHASZNALO] ([ID]);


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


GO
ALTER TABLE [dbo].[T_TANULOMENTESSEG] WITH NOCHECK
    ADD CONSTRAINT [FK_TanuloMentesseg_UtolsoModositoTanarId_REF_Felhasznalo] FOREIGN KEY ([C_UTOLSOMODOSITOTANARID]) REFERENCES [dbo].[T_FELHASZNALO] ([ID]);


GO

EXECUTE dev.uspCreateSchemaViews 'T_TANULOMENTESSEG'
EXECUTE dev.sp_Global_GenerateAsyncAuditTriggerAll
GO

ALTER QUEUE auditLog.[AuditQueue]
WITH ACTIVATION 
(
  STATUS =  ON,
  PROCEDURE_NAME =  auditLog.usp_AuditProcessing,
  MAX_QUEUE_READERS =  2,
  EXECUTE AS 'Kreta_tech_user'
);
GO

PRINT N'Update complete.';

GO