﻿--Migration

ALTER TABLE [dbo].[T_TANITASIORA]
    ADD [C_ORAEVESSORSZAMA] INT NULL;


GO
PRINT N'Altering Table [dbo].[T_TANULO]...';


GO
ALTER TABLE [dbo].[T_TANULO]
    ADD [C_IS9KOZUL8ELOZOTANEVBENVEGEZT] CHAR (1) DEFAULT ('F') NOT NULL,
        [C_ISEXTERNATUSIELLATASBAN]      CHAR (1) DEFAULT ('F') NOT NULL,
        [C_ISNAPKOZIOTTHONIELLATASBAN]   CHAR (1) DEFAULT ('F') NOT NULL;


GO
PRINT N'Altering Table [dbo].[T_TANULOERTEKELES]...';


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES]
    ADD [C_ISMAGATARTAS] AS (CONVERT (CHAR (1), CASE WHEN [C_MAGATARTASERTEKID] IS NULL
                                                          AND [C_MAGATARTASOSZTALYZATID] IS NULL
                                                          AND [C_MAGATARTASSZOVEG] IS NULL
                                                          AND [C_MAGATARTASSZOVEGFORMAZOTT] IS NULL THEN 'F' ELSE 'T' END)) PERSISTED,
        [C_ISSZORGALOM]  AS (CONVERT (CHAR (1), CASE WHEN [C_SZORGALOMERTEKID] IS NULL
                                                          AND [C_SZORGALOMOSZTALYZATID] IS NULL
                                                          AND [C_SZORGALOMSZOVEG] IS NULL
                                                          AND [C_SZORGALOMSZOVEGFORMAZOTT] IS NULL THEN 'F' ELSE 'T' END)) PERSISTED;


GO
PRINT N'Altering Table [dbo].[T_TANULOTANUGYIADATOK]...';


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



GO
PRINT N'Update complete.';


GO

EXEC dev.uspCreateSchemaViews 'T_TANULOTANUGYIADATOK, T_TANULOERTEKELES, T_TANULO, T_TANITASIORA'
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
