﻿GO
SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER ON;

SET NUMERIC_ROUNDABORT OFF;



GO
PRINT N'Altering [dbo].[T_SZAKMATIPUS]...';


GO
ALTER TABLE [dbo].[T_SZAKMATIPUS]
    ADD [C_AGAZATID]                     INT NULL,
        [C_ALAPFOKUOKTATASIIDOTARTAM]    INT NULL,
        [C_DITIGTALISKOMPETENCIAKERETSZ] INT NULL,
        [C_ERETTSEGIOKTATASIIDOTARTAM]   INT NULL;


GO
PRINT N'Creating [dbo].[FK_SzakmaTipus_AgazatId_AlintezmenyId_AltanevId_REF_AgazatTipus]...';


GO
ALTER TABLE [dbo].[T_SZAKMATIPUS] WITH NOCHECK
    ADD CONSTRAINT [FK_SzakmaTipus_AgazatId_AlintezmenyId_AltanevId_REF_AgazatTipus] FOREIGN KEY ([C_AGAZATID], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_AGAZATTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


GO
PRINT N'Checking existing data against newly created constraints';



GO
ALTER TABLE [dbo].[T_SZAKMATIPUS] WITH CHECK CHECK CONSTRAINT [FK_SzakmaTipus_AgazatId_AlintezmenyId_AltanevId_REF_AgazatTipus];


GO
PRINT N'Update complete.';


GO
EXEC dev.uspCreateSchemaViews 'T_SZAKMATIPUS';
GO


EXEC dev.sp_Global_GenerateAsyncAuditTriggerAll
GO

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

GO
