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

SET NUMERIC_ROUNDABORT OFF;



GO
PRINT N'Dropping [dbo].[T_SZAKMARIRANYTIPUS].[ID].[MS_Description]...';


GO
EXECUTE sp_dropextendedproperty @name = N'MS_Description', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMARIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'ID';


GO
PRINT N'Dropping [dbo].[T_SZAKMARIRANYTIPUS].[C_ALINTEZMENYID].[MS_Description]...';


GO
EXECUTE sp_dropextendedproperty @name = N'MS_Description', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMARIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'C_ALINTEZMENYID';


GO
PRINT N'Dropping [dbo].[T_SZAKMARIRANYTIPUS].[C_ALTANEVID].[MS_Description]...';


GO
EXECUTE sp_dropextendedproperty @name = N'MS_Description', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMARIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'C_ALTANEVID';


GO
PRINT N'Dropping [dbo].[T_SZAKMARIRANYTIPUS].[TOROLT].[MS_Description]...';


GO
EXECUTE sp_dropextendedproperty @name = N'MS_Description', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMARIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'TOROLT';


GO
PRINT N'Dropping [dbo].[T_SZAKMARIRANYTIPUS].[SERIAL].[MS_Description]...';


GO
EXECUTE sp_dropextendedproperty @name = N'MS_Description', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMARIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'SERIAL';


GO
PRINT N'Dropping [dbo].[T_SZAKMARIRANYTIPUS].[LASTCHANGED].[MS_Description]...';


GO
EXECUTE sp_dropextendedproperty @name = N'MS_Description', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMARIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'LASTCHANGED';


GO
PRINT N'Dropping [dbo].[T_SZAKMARIRANYTIPUS].[CREATED].[MS_Description]...';


GO
EXECUTE sp_dropextendedproperty @name = N'MS_Description', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMARIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'CREATED';


GO
PRINT N'Dropping [dbo].[T_SZAKMARIRANYTIPUS].[MODIFIER].[MS_Description]...';


GO
EXECUTE sp_dropextendedproperty @name = N'MS_Description', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMARIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'MODIFIER';


GO
PRINT N'Dropping [dbo].[T_SZAKMARIRANYTIPUS].[CREATOR].[MS_Description]...';


GO
EXECUTE sp_dropextendedproperty @name = N'MS_Description', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMARIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'CREATOR';


GO
PRINT N'Dropping [dbo].[T_SZAKMARIRANYTIPUS].[ELOZOTANEVIREKORDID].[MS_Description]...';


GO
EXECUTE sp_dropextendedproperty @name = N'MS_Description', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMARIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'ELOZOTANEVIREKORDID';


GO
PRINT N'Dropping [dbo].[T_SZAKMARIRANYTIPUS].[ELOZOTANEVIREKORDIDA].[MS_Description]...';


GO
EXECUTE sp_dropextendedproperty @name = N'MS_Description', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMARIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'ELOZOTANEVIREKORDIDA';


GO
PRINT N'Dropping unnamed constraint on [dbo].[T_SZAKMARIRANYTIPUS]...';


GO
DROP PROCEDURE IF EXISTS dev.uspDropDefaultConstraint
GO
CREATE PROCEDURE dev.uspDropDefaultConstraint
   @pTableName nvarchar(80)
  ,@pColumnName nvarchar(80)
AS
BEGIN
  DECLARE @sql nvarchar(max)

  SELECT 
    @sql = 'ALTER TABLE ' + @pTableName + ' DROP CONSTRAINT ' + df.name 
  FROM sys.default_constraints df
    INNER JOIN sys.columns cn ON cn.default_object_id = df.object_id
    INNER JOIN sys.tables tb ON tb.object_id = cn.object_id
  WHERE cn.name =  @pColumnName
    AND tb.name = @pTableName

  EXEC sp_executesql @sql
END



GO
EXEC dev.uspDropDefaultConstraint 'T_SZAKMARIRANYTIPUS', 'LASTCHANGED'


GO
PRINT N'Dropping unnamed constraint on [dbo].[T_SZAKMARIRANYTIPUS]...';


GO
EXEC dev.uspDropDefaultConstraint 'T_SZAKMARIRANYTIPUS', 'SERIAL'


GO
PRINT N'Dropping unnamed constraint on [dbo].[T_SZAKMARIRANYTIPUS]...';


GO
EXEC dev.uspDropDefaultConstraint 'T_SZAKMARIRANYTIPUS', 'TOROLT'


GO
PRINT N'Dropping unnamed constraint on [dbo].[T_SZAKMARIRANYTIPUS]...';


GO
EXEC dev.uspDropDefaultConstraint 'T_SZAKMARIRANYTIPUS', 'CREATED'


GO
PRINT N'Dropping [dbo].[FK_TanuloTanugyiAdatok_SzakmariranyTipusId_IntezmenyId_TanevId_REF_SzakmariranyTipus]...';


GO
ALTER TABLE [dbo].[T_TANULOTANUGYIADATOK] DROP CONSTRAINT [FK_TanuloTanugyiAdatok_SzakmariranyTipusId_IntezmenyId_TanevId_REF_SzakmariranyTipus];


GO
PRINT N'Dropping [dbo].[FK_Tanulo_SzakmariranyTipusId_AlintezmenyId_AltanevId_REF_SzakmariranyTipus]...';


GO
ALTER TABLE [dbo].[T_TANULO] DROP CONSTRAINT [FK_Tanulo_SzakmariranyTipusId_AlintezmenyId_AltanevId_REF_SzakmariranyTipus];


GO
PRINT N'Dropping [dbo].[FK_SzakmariranyTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase]...';


GO
ALTER TABLE [dbo].[T_SZAKMARIRANYTIPUS] DROP CONSTRAINT [FK_SzakmariranyTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase];


GO
PRINT N'Dropping [dbo].[FK_SzakmariranyTipus_AlIntezmenyId_REF_Intezmeny]...';


GO
ALTER TABLE [dbo].[T_SZAKMARIRANYTIPUS] DROP CONSTRAINT [FK_SzakmariranyTipus_AlIntezmenyId_REF_Intezmeny];


GO
PRINT N'Dropping [dbo].[FK_SzakmariranyTipus_AlTanevId_REF_Tanev]...';


GO
ALTER TABLE [dbo].[T_SZAKMARIRANYTIPUS] DROP CONSTRAINT [FK_SzakmariranyTipus_AlTanevId_REF_Tanev];


GO
PRINT N'Dropping [dbo].[FK_TanuloSni_FelulvizsgalatHonapja_IntezmenyId_TanevId_REF_Honapok]...';


GO
ALTER TABLE [dbo].[T_TANULOSNI] DROP CONSTRAINT [FK_TanuloSni_FelulvizsgalatHonapja_IntezmenyId_TanevId_REF_Honapok];


GO
PRINT N'Dropping [dbo].[T_SZAKMARIRANYTIPUS_OSSZES]...';


GO
DROP VIEW [dbo].[T_SZAKMARIRANYTIPUS_OSSZES];


GO
PRINT N'Dropping [dbo].[T_SZAKMARIRANYTIPUS]...';


GO
DROP TABLE [dbo].[T_SZAKMARIRANYTIPUS];


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


GO
ALTER TABLE [dbo].[T_OSZTALY]
    ADD [C_AGAZATUJSZKTTIPUSID] INT NULL,
        [C_SZAKMAIRANYTIPUSID]  INT NULL,
        [C_SZAKMATIPUSID]       INT NULL;


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


GO
ALTER TABLE [dbo].[T_TANULO] DROP COLUMN [C_SZAKMARIRANYTIPUSID];


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


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


GO
ALTER TABLE [dbo].[T_TANULOSNI] DROP COLUMN [C_FELULVIZSGALATEVE], COLUMN [C_FELULVIZSGALATHONAPJA], COLUMN [C_FELULVIZSGALATNAPJA];


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


GO
ALTER TABLE [dbo].[T_TANULOTANUGYIADATOK] DROP COLUMN [C_SZAKMARIRANYTIPUSID];


GO
ALTER TABLE [dbo].[T_TANULOTANUGYIADATOK]
    ADD [C_SZAKMAIRANYTIPUSID] INT NULL;


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


GO
CREATE TABLE [dbo].[T_SZAKMAIRANYTIPUS] (
    [ID]                   INT      NOT NULL,
    [C_ALINTEZMENYID]      INT      NOT NULL,
    [C_ALTANEVID]          INT      NOT NULL,
    [TOROLT]               CHAR (1) NOT NULL,
    [SERIAL]               INT      NOT NULL,
    [LASTCHANGED]          DATETIME NOT NULL,
    [CREATED]              DATETIME NOT NULL,
    [MODIFIER]             INT      NULL,
    [CREATOR]              INT      NULL,
    [ELOZOTANEVIREKORDID]  INT      NULL,
    [ELOZOTANEVIREKORDIDA] INT      NULL,
    CONSTRAINT [PK_SzakmairanyTipus] PRIMARY KEY CLUSTERED ([ID] ASC, [C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC)
);


GO
PRINT N'Creating unnamed constraint on [dbo].[T_SZAKMAIRANYTIPUS]...';


GO
ALTER TABLE [dbo].[T_SZAKMAIRANYTIPUS]
    ADD DEFAULT (getdate()) FOR [LASTCHANGED];


GO
PRINT N'Creating unnamed constraint on [dbo].[T_SZAKMAIRANYTIPUS]...';


GO
ALTER TABLE [dbo].[T_SZAKMAIRANYTIPUS]
    ADD DEFAULT ((0)) FOR [SERIAL];


GO
PRINT N'Creating unnamed constraint on [dbo].[T_SZAKMAIRANYTIPUS]...';


GO
ALTER TABLE [dbo].[T_SZAKMAIRANYTIPUS]
    ADD DEFAULT ('F') FOR [TOROLT];


GO
PRINT N'Creating unnamed constraint on [dbo].[T_SZAKMAIRANYTIPUS]...';


GO
ALTER TABLE [dbo].[T_SZAKMAIRANYTIPUS]
    ADD DEFAULT (getdate()) FOR [CREATED];


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


GO
ALTER TABLE [dbo].[T_SZAKMAIRANYTIPUS] WITH NOCHECK
    ADD CONSTRAINT [FK_SzakmairanyTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase] FOREIGN KEY ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_DICTIONARYITEMBASE] ([ID], [C_INTEZMENYID], [C_TANEVID]);


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


GO
ALTER TABLE [dbo].[T_SZAKMAIRANYTIPUS] WITH NOCHECK
    ADD CONSTRAINT [FK_SzakmairanyTipus_AlIntezmenyId_REF_Intezmeny] FOREIGN KEY ([C_ALINTEZMENYID]) REFERENCES [dbo].[T_INTEZMENY] ([ID]);


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


GO
ALTER TABLE [dbo].[T_SZAKMAIRANYTIPUS] WITH NOCHECK
    ADD CONSTRAINT [FK_SzakmairanyTipus_AlTanevId_REF_Tanev] FOREIGN KEY ([C_ALTANEVID]) REFERENCES [dbo].[T_TANEV] ([ID]);


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


GO
ALTER TABLE [dbo].[T_OSZTALY] WITH NOCHECK
    ADD CONSTRAINT [FK_Osztaly_AgazatUjSzktTipusId_AlintezmenyId_AltanevId_REF_AgazatUjSzktTipus] FOREIGN KEY ([C_AGAZATUJSZKTTIPUSID], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_AGAZATUJSZKTTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_OSZTALY] WITH NOCHECK
    ADD CONSTRAINT [FK_Osztaly_SzakmairanyTipusId_AlintezmenyId_AltanevId_REF_SzakmairanyTipus] FOREIGN KEY ([C_SZAKMAIRANYTIPUSID], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_SZAKMAIRANYTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_OSZTALY] WITH NOCHECK
    ADD CONSTRAINT [FK_Osztaly_SzakmaTipusId_AlintezmenyId_AltanevId_REF_SzakmaTipus] FOREIGN KEY ([C_SZAKMATIPUSID], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_SZAKMATIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_TANULO] WITH NOCHECK
    ADD CONSTRAINT [FK_Tanulo_SzakmairanyTipusId_AlintezmenyId_AltanevId_REF_SzakmairanyTipus] FOREIGN KEY ([C_SZAKMAIRANYTIPUSID], [C_ALINTEZMENYID], [C_ALTANEVID]) REFERENCES [dbo].[T_SZAKMAIRANYTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_TANULOTANUGYIADATOK] WITH NOCHECK
    ADD CONSTRAINT [FK_TanuloTanugyiAdatok_SzakmairanyTipusId_IntezmenyId_TanevId_REF_SzakmairanyTipus] FOREIGN KEY ([C_SZAKMAIRANYTIPUSID], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_SZAKMAIRANYTIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);



GO
PRINT N'Creating [dbo].[T_SZAKMAIRANYTIPUS].[ID].[MS_Description]...';


GO
EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'A rekord egyedi azonosítója, generált IDENTITY(1, 1) (kivéve altáblák esetén, ahol a főtábla ID-ját kapja)', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMAIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'ID';


GO
PRINT N'Creating [dbo].[T_SZAKMAIRANYTIPUS].[C_ALINTEZMENYID].[MS_Description]...';


GO
EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'Az intézmény ID-ja, amihez a rekord tartozik (altábla esetén)', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMAIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'C_ALINTEZMENYID';


GO
PRINT N'Creating [dbo].[T_SZAKMAIRANYTIPUS].[C_ALTANEVID].[MS_Description]...';


GO
EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'A tanév ID-ja, amihez a rekord tartozik (altábla esetén)', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMAIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'C_ALTANEVID';


GO
PRINT N'Creating [dbo].[T_SZAKMAIRANYTIPUS].[TOROLT].[MS_Description]...';


GO
EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'A rekord logikai töröltségét jelző flag', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMAIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'TOROLT';


GO
PRINT N'Creating [dbo].[T_SZAKMAIRANYTIPUS].[SERIAL].[MS_Description]...';


GO
EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'Minden C# kódból történő módosítás esetén eggyel nő az értéke. Hogy párhuzamos módosítás esetnán ne íródjanak felül az adatok', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMAIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'SERIAL';


GO
PRINT N'Creating [dbo].[T_SZAKMAIRANYTIPUS].[LASTCHANGED].[MS_Description]...';


GO
EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'	A rekord utolsó módosításának időpontja', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMAIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'LASTCHANGED';


GO
PRINT N'Creating [dbo].[T_SZAKMAIRANYTIPUS].[CREATED].[MS_Description]...';


GO
EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'A rekord létrehozásának időpontja ', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMAIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'CREATED';


GO
PRINT N'Creating [dbo].[T_SZAKMAIRANYTIPUS].[MODIFIER].[MS_Description]...';


GO
EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'A rekordot utoljára módosító felhasználó ID-ja', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMAIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'MODIFIER';


GO
PRINT N'Creating [dbo].[T_SZAKMAIRANYTIPUS].[CREATOR].[MS_Description]...';


GO
EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'A rekordot létrehozó felhasználó ID-ja', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMAIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'CREATOR';


GO
PRINT N'Creating [dbo].[T_SZAKMAIRANYTIPUS].[ELOZOTANEVIREKORDID].[MS_Description]...';


GO
EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'A rekord előző tanévben lévő ID-ja', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMAIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'ELOZOTANEVIREKORDID';


GO
PRINT N'Creating [dbo].[T_SZAKMAIRANYTIPUS].[ELOZOTANEVIREKORDIDA].[MS_Description]...';


GO
EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'A rekord előző tanévben lévő ID-ja (altábla esetén) ', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_SZAKMAIRANYTIPUS', @level2type = N'COLUMN', @level2name = N'ELOZOTANEVIREKORDIDA';



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


GO
ALTER TABLE [dbo].[T_SZAKMAIRANYTIPUS] WITH CHECK CHECK CONSTRAINT [FK_SzakmairanyTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase];

ALTER TABLE [dbo].[T_SZAKMAIRANYTIPUS] WITH CHECK CHECK CONSTRAINT [FK_SzakmairanyTipus_AlIntezmenyId_REF_Intezmeny];

ALTER TABLE [dbo].[T_SZAKMAIRANYTIPUS] WITH CHECK CHECK CONSTRAINT [FK_SzakmairanyTipus_AlTanevId_REF_Tanev];

ALTER TABLE [dbo].[T_OSZTALY] WITH CHECK CHECK CONSTRAINT [FK_Osztaly_AgazatUjSzktTipusId_AlintezmenyId_AltanevId_REF_AgazatUjSzktTipus];

ALTER TABLE [dbo].[T_OSZTALY] WITH CHECK CHECK CONSTRAINT [FK_Osztaly_SzakmairanyTipusId_AlintezmenyId_AltanevId_REF_SzakmairanyTipus];

ALTER TABLE [dbo].[T_OSZTALY] WITH CHECK CHECK CONSTRAINT [FK_Osztaly_SzakmaTipusId_AlintezmenyId_AltanevId_REF_SzakmaTipus];

ALTER TABLE [dbo].[T_TANULO] WITH CHECK CHECK CONSTRAINT [FK_Tanulo_SzakmairanyTipusId_AlintezmenyId_AltanevId_REF_SzakmairanyTipus];

ALTER TABLE [dbo].[T_TANULOTANUGYIADATOK] WITH CHECK CHECK CONSTRAINT [FK_TanuloTanugyiAdatok_SzakmairanyTipusId_IntezmenyId_TanevId_REF_SzakmairanyTipus];


GO
PRINT N'Update complete.';


GO
EXEC dev.uspCreateSchemaViews 'T_TANULO, T_TANULOTANUGYIADATOK, T_SZAKMAIRANYTIPUS, T_TANULOSNI, T_OSZTALY'


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
