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

ALTER TABLE [dbo].[T_SZIRSTATTANULO]
    ADD [C_ISSIKERESAGAZATIALAPVIZSGA] CHAR (1) DEFAULT ('F') NOT NULL,
        [C_FELADATELLATASIHELYID]      INT      NOT NULL;
GO

CREATE NONCLUSTERED INDEX [NCI_SzirStatTanulo_FeladatEllatasiHelyId]
    ON [dbo].[T_SZIRSTATTANULO]([C_FELADATELLATASIHELYID] ASC);
GO

ALTER TABLE [dbo].[T_TANULO]
    ADD [C_ISRENDSZERESGYERMEKVEDELMI] CHAR (1) DEFAULT ('F') NOT NULL;
GO

ALTER TABLE [dbo].[T_SZIRSTATTANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_SzirStatTanulo_FeladatEllatasiHelyId_REF_FeladatEllatasiHely] FOREIGN KEY ([C_FELADATELLATASIHELYID]) REFERENCES [dbo].[T_FELADATELLATASIHELY] ([ID]);
GO

ALTER TABLE [dbo].[T_SZIRSTATTANULO] WITH CHECK CHECK CONSTRAINT [FK_SzirStatTanulo_FeladatEllatasiHelyId_REF_FeladatEllatasiHely];
GO

EXEC dev.uspCreateSchemaViews 'T_SZIRSTATTANULO,T_TANULO';
GO

EXEC 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