﻿--Migration

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


GO
ALTER TABLE [dbo].[T_DKT_TANULOFELADATBEADAS] DROP CONSTRAINT [FK_DKT_TanuloFeladatbeadas_TanuloErtekelesId_REF_TanuloErtekeles];


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


GO
ALTER TABLE [dbo].[T_DKT_TANULOFELADATBEADAS]
    ADD [C_GROUPID]                INT            NULL,
        [C_GROUPTANULOERTEKELESID] INT            NULL,
        [C_HISTORY]                NVARCHAR (MAX) NULL;


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


GO
CREATE TABLE [dbo].[T_DKT_FELADATFILE] (
    [ID]                  INT              IDENTITY (1, 1) NOT NULL,
    [C_INTEZMENYGUID]     UNIQUEIDENTIFIER NOT NULL,
    [C_ISAKTIV]           CHAR (1)         NOT NULL,
    [C_ISLATHATO]         CHAR (1)         NOT NULL,
    [C_ISMODOSITHATO]     CHAR (1)         NOT NULL,
    [C_ISTOROLHETO]       CHAR (1)         NOT NULL,
    [C_FELADATID]         INT              NOT NULL,
    [C_FILEID]            INT              NOT NULL,
    [C_INTEZMENYID]       INT              NOT NULL,
    [C_TANEVID]           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,
    [DELETER]             INT              NULL,
    [DELETED]             DATETIME         NULL,
    [STATUSID]            INT              NOT NULL,
    [UNIQUEID]            UNIQUEIDENTIFIER NOT NULL,
    [ACLCODE]             NVARCHAR (1000)  NULL,
    [ELOZOTANEVIREKORDID] INT              NULL,
    CONSTRAINT [PK_DKT_FeladatFile] PRIMARY KEY CLUSTERED ([ID] ASC)
);


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


GO
CREATE TABLE [dbo].[T_DKT_FILE] (
    [ID]                      INT              IDENTITY (1, 1) NOT NULL,
    [C_CIM]                   NVARCHAR (1000)  NULL,
    [C_EVFOLYAMID]            INT              NULL,
    [C_EXTENSION]             NVARCHAR (50)    NULL,
    [C_FELTOLTESDATUM]        DATETIME         NOT NULL,
    [C_FILEGUID]              UNIQUEIDENTIFIER NULL,
    [C_FILENEV]               NVARCHAR (1000)  NULL,
    [C_FILESIZEMB]            NUMERIC (10, 2)  NULL,
    [C_HIBAUZENET]            NVARCHAR (2000)  NULL,
    [C_INTEZMENYGUID]         UNIQUEIDENTIFIER NOT NULL,
    [C_ISAKTIV]               CHAR (1)         NOT NULL,
    [C_ISIDEIGLENES]          CHAR (1)         NOT NULL,
    [C_ISLATHATO]             CHAR (1)         NOT NULL,
    [C_ISMODOSITHATO]         CHAR (1)         NOT NULL,
    [C_ISTOROLHETO]           CHAR (1)         NOT NULL,
    [C_OSZTALYCSOPORTID]      INT              NULL,
    [C_TANTARGYID]            INT              NULL,
    [C_TANTARGYKATEGORIAID]   INT              NULL,
    [C_UTVONAL]               NVARCHAR (2000)  NULL,
    [C_FELTOLTOTANULOID]      INT              NULL,
    [C_FELTOLTOALKALMAZOTTID] INT              NULL,
    [C_INTEZMENYID]           INT              NOT NULL,
    [C_TANEVID]               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,
    [DELETER]                 INT              NULL,
    [DELETED]                 DATETIME         NULL,
    [STATUSID]                INT              NOT NULL,
    [UNIQUEID]                UNIQUEIDENTIFIER NOT NULL,
    [ACLCODE]                 NVARCHAR (1000)  NULL,
    [ELOZOTANEVIREKORDID]     INT              NULL,
    CONSTRAINT [PK_DKT_File] PRIMARY KEY CLUSTERED ([ID] ASC)
);


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


GO
CREATE TABLE [dbo].[T_DKT_TANULOFELADATBEADASFILE] (
    [ID]                      INT              IDENTITY (1, 1) NOT NULL,
    [C_INTEZMENYGUID]         UNIQUEIDENTIFIER NOT NULL,
    [C_ISAKTIV]               CHAR (1)         NOT NULL,
    [C_ISLATHATO]             CHAR (1)         NOT NULL,
    [C_ISMODOSITHATO]         CHAR (1)         NOT NULL,
    [C_ISTOROLHETO]           CHAR (1)         NULL,
    [C_FILEID]                INT              NOT NULL,
    [C_TANULOFELADATBEADASID] INT              NOT NULL,
    [C_INTEZMENYID]           INT              NOT NULL,
    [C_TANEVID]               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,
    [DELETER]                 INT              NULL,
    [DELETED]                 DATETIME         NULL,
    [STATUSID]                INT              NOT NULL,
    [UNIQUEID]                UNIQUEIDENTIFIER NOT NULL,
    [ACLCODE]                 NVARCHAR (1000)  NULL,
    [ELOZOTANEVIREKORDID]     INT              NULL,
    CONSTRAINT [PK_DKT_TanuloFeladatbeadasFile] PRIMARY KEY CLUSTERED ([ID] ASC)
);


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


GO
ALTER TABLE [dbo].[T_DKT_FELADATFILE]
    ADD DEFAULT ('T') FOR [C_ISLATHATO];


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


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


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


GO
ALTER TABLE [dbo].[T_DKT_FELADATFILE]
    ADD DEFAULT ('T') FOR [C_ISAKTIV];


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


GO
ALTER TABLE [dbo].[T_DKT_FELADATFILE]
    ADD DEFAULT ('T') FOR [C_ISMODOSITHATO];


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_DKT_FELADATFILE]
    ADD DEFAULT ((0)) FOR [STATUSID];


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


GO
ALTER TABLE [dbo].[T_DKT_FELADATFILE]
    ADD DEFAULT ('T') FOR [C_ISTOROLHETO];


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


GO
ALTER TABLE [dbo].[T_DKT_FELADATFILE]
    ADD DEFAULT (newid()) FOR [UNIQUEID];


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


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


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


GO
ALTER TABLE [dbo].[T_DKT_FILE]
    ADD DEFAULT ('F') FOR [C_ISIDEIGLENES];


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


GO
ALTER TABLE [dbo].[T_DKT_FILE]
    ADD DEFAULT (newid()) FOR [UNIQUEID];


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


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


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


GO
ALTER TABLE [dbo].[T_DKT_FILE]
    ADD DEFAULT ('T') FOR [C_ISAKTIV];


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


GO
ALTER TABLE [dbo].[T_DKT_FILE]
    ADD DEFAULT ('T') FOR [C_ISLATHATO];


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


GO
ALTER TABLE [dbo].[T_DKT_FILE]
    ADD DEFAULT (getdate()) FOR [C_FELTOLTESDATUM];


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


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


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


GO
ALTER TABLE [dbo].[T_DKT_FILE]
    ADD DEFAULT ('T') FOR [C_ISMODOSITHATO];


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


GO
ALTER TABLE [dbo].[T_DKT_FILE]
    ADD DEFAULT ('T') FOR [C_ISTOROLHETO];


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


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


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


GO
ALTER TABLE [dbo].[T_DKT_FILE]
    ADD DEFAULT ((0)) FOR [STATUSID];


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


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


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


GO
ALTER TABLE [dbo].[T_DKT_TANULOFELADATBEADASFILE]
    ADD DEFAULT (newid()) FOR [UNIQUEID];


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


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


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


GO
ALTER TABLE [dbo].[T_DKT_TANULOFELADATBEADASFILE]
    ADD DEFAULT ('T') FOR [C_ISAKTIV];


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


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


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


GO
ALTER TABLE [dbo].[T_DKT_TANULOFELADATBEADASFILE]
    ADD DEFAULT ('T') FOR [C_ISMODOSITHATO];


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


GO
ALTER TABLE [dbo].[T_DKT_TANULOFELADATBEADASFILE]
    ADD DEFAULT ('T') FOR [C_ISTOROLHETO];


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


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


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


GO
ALTER TABLE [dbo].[T_DKT_TANULOFELADATBEADASFILE]
    ADD DEFAULT ((0)) FOR [STATUSID];


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


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


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


GO
ALTER TABLE [dbo].[T_DKT_TANULOFELADATBEADASFILE]
    ADD DEFAULT ('T') FOR [C_ISLATHATO];


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


GO
ALTER TABLE [dbo].[T_DKT_FELADATFILE] WITH NOCHECK
    ADD CONSTRAINT [FK_DKT_FeladatFile_FeladatId_REF_DKT_Feladat] FOREIGN KEY ([C_FELADATID]) REFERENCES [dbo].[T_DKT_FELADAT] ([ID]);


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


GO
ALTER TABLE [dbo].[T_DKT_FELADATFILE] WITH NOCHECK
    ADD CONSTRAINT [FK_DKT_FeladatFile_FileId_REF_DKT_File] FOREIGN KEY ([C_FILEID]) REFERENCES [dbo].[T_DKT_FILE] ([ID]);


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


GO
ALTER TABLE [dbo].[T_DKT_FELADATFILE] WITH NOCHECK
    ADD CONSTRAINT [FK_DKT_FeladatFile_IntezmenyId_REF_Intezmeny] FOREIGN KEY ([C_INTEZMENYID]) REFERENCES [dbo].[T_INTEZMENY] ([ID]);


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


GO
ALTER TABLE [dbo].[T_DKT_FELADATFILE] WITH NOCHECK
    ADD CONSTRAINT [FK_DKT_FeladatFile_TanevId_REF_Tanev] FOREIGN KEY ([C_TANEVID]) REFERENCES [dbo].[T_TANEV] ([ID]);


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


GO
ALTER TABLE [dbo].[T_DKT_FILE] WITH NOCHECK
    ADD CONSTRAINT [FK_DKT_File_FeltoltoTanuloId_REF_Tanulo] FOREIGN KEY ([C_FELTOLTOTANULOID]) REFERENCES [dbo].[T_TANULO] ([ID]);


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


GO
ALTER TABLE [dbo].[T_DKT_FILE] WITH NOCHECK
    ADD CONSTRAINT [FK_DKT_File_FeltoltoAlkalmazottId_REF_Alkalmazott] FOREIGN KEY ([C_FELTOLTOALKALMAZOTTID]) REFERENCES [dbo].[T_ALKALMAZOTT] ([ID]);


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


GO
ALTER TABLE [dbo].[T_DKT_FILE] WITH NOCHECK
    ADD CONSTRAINT [FK_DKT_File_IntezmenyId_REF_Intezmeny] FOREIGN KEY ([C_INTEZMENYID]) REFERENCES [dbo].[T_INTEZMENY] ([ID]);


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


GO
ALTER TABLE [dbo].[T_DKT_FILE] WITH NOCHECK
    ADD CONSTRAINT [FK_DKT_File_TanevId_REF_Tanev] FOREIGN KEY ([C_TANEVID]) REFERENCES [dbo].[T_TANEV] ([ID]);


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


GO
ALTER TABLE [dbo].[T_DKT_TANULOFELADATBEADASFILE] WITH NOCHECK
    ADD CONSTRAINT [FK_DKT_TanuloFeladatbeadasFile_FileId_REF_DKT_File] FOREIGN KEY ([C_FILEID]) REFERENCES [dbo].[T_DKT_FILE] ([ID]);


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


GO
ALTER TABLE [dbo].[T_DKT_TANULOFELADATBEADASFILE] WITH NOCHECK
    ADD CONSTRAINT [FK_DKT_TanuloFeladatbeadasFile_TanuloFeladatbeadasId_REF_DKT_TanuloFeladatbeadas] FOREIGN KEY ([C_TANULOFELADATBEADASID]) REFERENCES [dbo].[T_DKT_TANULOFELADATBEADAS] ([ID]);


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


GO
ALTER TABLE [dbo].[T_DKT_TANULOFELADATBEADASFILE] WITH NOCHECK
    ADD CONSTRAINT [FK_DKT_TanuloFeladatbeadasFile_IntezmenyId_REF_Intezmeny] FOREIGN KEY ([C_INTEZMENYID]) REFERENCES [dbo].[T_INTEZMENY] ([ID]);


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


GO
ALTER TABLE [dbo].[T_DKT_TANULOFELADATBEADASFILE] WITH NOCHECK
    ADD CONSTRAINT [FK_DKT_TanuloFeladatbeadasFile_TanevId_REF_Tanev] FOREIGN KEY ([C_TANEVID]) REFERENCES [dbo].[T_TANEV] ([ID]);


GO
PRINT N'Creating [dbo].[T_DKT_FELADATFILE].[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_DKT_FELADATFILE', @level2type = N'COLUMN', @level2name = N'ID';


GO
PRINT N'Creating [dbo].[T_DKT_FELADATFILE].[C_INTEZMENYID].[MS_Description]...';


GO
EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'Az intézmény ID-ja, amihez a rekord tartozik', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_DKT_FELADATFILE', @level2type = N'COLUMN', @level2name = N'C_INTEZMENYID';


GO
PRINT N'Creating [dbo].[T_DKT_FELADATFILE].[C_TANEVID].[MS_Description]...';


GO
EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'A tanév ID-ja, amihez a rekord tartozik', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_DKT_FELADATFILE', @level2type = N'COLUMN', @level2name = N'C_TANEVID';


GO
PRINT N'Creating [dbo].[T_DKT_FELADATFILE].[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_DKT_FELADATFILE', @level2type = N'COLUMN', @level2name = N'TOROLT';


GO
PRINT N'Creating [dbo].[T_DKT_FELADATFILE].[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_DKT_FELADATFILE', @level2type = N'COLUMN', @level2name = N'SERIAL';


GO
PRINT N'Creating [dbo].[T_DKT_FELADATFILE].[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_DKT_FELADATFILE', @level2type = N'COLUMN', @level2name = N'LASTCHANGED';


GO
PRINT N'Creating [dbo].[T_DKT_FELADATFILE].[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_DKT_FELADATFILE', @level2type = N'COLUMN', @level2name = N'CREATED';


GO
PRINT N'Creating [dbo].[T_DKT_FELADATFILE].[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_DKT_FELADATFILE', @level2type = N'COLUMN', @level2name = N'MODIFIER';


GO
PRINT N'Creating [dbo].[T_DKT_FELADATFILE].[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_DKT_FELADATFILE', @level2type = N'COLUMN', @level2name = N'CREATOR';


GO
PRINT N'Creating [dbo].[T_DKT_FELADATFILE].[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_DKT_FELADATFILE', @level2type = N'COLUMN', @level2name = N'ELOZOTANEVIREKORDID';


GO
PRINT N'Creating [dbo].[T_DKT_FILE].[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_DKT_FILE', @level2type = N'COLUMN', @level2name = N'ID';


GO
PRINT N'Creating [dbo].[T_DKT_FILE].[C_INTEZMENYID].[MS_Description]...';


GO
EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'Az intézmény ID-ja, amihez a rekord tartozik', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_DKT_FILE', @level2type = N'COLUMN', @level2name = N'C_INTEZMENYID';


GO
PRINT N'Creating [dbo].[T_DKT_FILE].[C_TANEVID].[MS_Description]...';


GO
EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'A tanév ID-ja, amihez a rekord tartozik', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_DKT_FILE', @level2type = N'COLUMN', @level2name = N'C_TANEVID';


GO
PRINT N'Creating [dbo].[T_DKT_FILE].[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_DKT_FILE', @level2type = N'COLUMN', @level2name = N'TOROLT';


GO
PRINT N'Creating [dbo].[T_DKT_FILE].[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_DKT_FILE', @level2type = N'COLUMN', @level2name = N'SERIAL';


GO
PRINT N'Creating [dbo].[T_DKT_FILE].[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_DKT_FILE', @level2type = N'COLUMN', @level2name = N'LASTCHANGED';


GO
PRINT N'Creating [dbo].[T_DKT_FILE].[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_DKT_FILE', @level2type = N'COLUMN', @level2name = N'CREATED';


GO
PRINT N'Creating [dbo].[T_DKT_FILE].[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_DKT_FILE', @level2type = N'COLUMN', @level2name = N'MODIFIER';


GO
PRINT N'Creating [dbo].[T_DKT_FILE].[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_DKT_FILE', @level2type = N'COLUMN', @level2name = N'CREATOR';


GO
PRINT N'Creating [dbo].[T_DKT_FILE].[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_DKT_FILE', @level2type = N'COLUMN', @level2name = N'ELOZOTANEVIREKORDID';


GO
PRINT N'Creating [dbo].[T_DKT_TANULOFELADATBEADASFILE].[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_DKT_TANULOFELADATBEADASFILE', @level2type = N'COLUMN', @level2name = N'ID';


GO
PRINT N'Creating [dbo].[T_DKT_TANULOFELADATBEADASFILE].[C_INTEZMENYID].[MS_Description]...';


GO
EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'Az intézmény ID-ja, amihez a rekord tartozik', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_DKT_TANULOFELADATBEADASFILE', @level2type = N'COLUMN', @level2name = N'C_INTEZMENYID';


GO
PRINT N'Creating [dbo].[T_DKT_TANULOFELADATBEADASFILE].[C_TANEVID].[MS_Description]...';


GO
EXECUTE dev.uspAddOrUpdateExtendedProperty @name = N'MS_Description', @value = N'A tanév ID-ja, amihez a rekord tartozik', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'T_DKT_TANULOFELADATBEADASFILE', @level2type = N'COLUMN', @level2name = N'C_TANEVID';


GO
PRINT N'Creating [dbo].[T_DKT_TANULOFELADATBEADASFILE].[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_DKT_TANULOFELADATBEADASFILE', @level2type = N'COLUMN', @level2name = N'TOROLT';


GO
PRINT N'Creating [dbo].[T_DKT_TANULOFELADATBEADASFILE].[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_DKT_TANULOFELADATBEADASFILE', @level2type = N'COLUMN', @level2name = N'SERIAL';


GO
PRINT N'Creating [dbo].[T_DKT_TANULOFELADATBEADASFILE].[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_DKT_TANULOFELADATBEADASFILE', @level2type = N'COLUMN', @level2name = N'LASTCHANGED';


GO
PRINT N'Creating [dbo].[T_DKT_TANULOFELADATBEADASFILE].[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_DKT_TANULOFELADATBEADASFILE', @level2type = N'COLUMN', @level2name = N'CREATED';


GO
PRINT N'Creating [dbo].[T_DKT_TANULOFELADATBEADASFILE].[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_DKT_TANULOFELADATBEADASFILE', @level2type = N'COLUMN', @level2name = N'MODIFIER';


GO
PRINT N'Creating [dbo].[T_DKT_TANULOFELADATBEADASFILE].[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_DKT_TANULOFELADATBEADASFILE', @level2type = N'COLUMN', @level2name = N'CREATOR';


GO
PRINT N'Creating [dbo].[T_DKT_TANULOFELADATBEADASFILE].[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_DKT_TANULOFELADATBEADASFILE', @level2type = N'COLUMN', @level2name = N'ELOZOTANEVIREKORDID';





GO
ALTER TABLE [dbo].[T_DKT_FELADATFILE] WITH CHECK CHECK CONSTRAINT [FK_DKT_FeladatFile_FeladatId_REF_DKT_Feladat];

ALTER TABLE [dbo].[T_DKT_FELADATFILE] WITH CHECK CHECK CONSTRAINT [FK_DKT_FeladatFile_FileId_REF_DKT_File];

ALTER TABLE [dbo].[T_DKT_FELADATFILE] WITH CHECK CHECK CONSTRAINT [FK_DKT_FeladatFile_IntezmenyId_REF_Intezmeny];

ALTER TABLE [dbo].[T_DKT_FELADATFILE] WITH CHECK CHECK CONSTRAINT [FK_DKT_FeladatFile_TanevId_REF_Tanev];

ALTER TABLE [dbo].[T_DKT_FILE] WITH CHECK CHECK CONSTRAINT [FK_DKT_File_FeltoltoTanuloId_REF_Tanulo];

ALTER TABLE [dbo].[T_DKT_FILE] WITH CHECK CHECK CONSTRAINT [FK_DKT_File_FeltoltoAlkalmazottId_REF_Alkalmazott];

ALTER TABLE [dbo].[T_DKT_FILE] WITH CHECK CHECK CONSTRAINT [FK_DKT_File_IntezmenyId_REF_Intezmeny];

ALTER TABLE [dbo].[T_DKT_FILE] WITH CHECK CHECK CONSTRAINT [FK_DKT_File_TanevId_REF_Tanev];

ALTER TABLE [dbo].[T_DKT_TANULOFELADATBEADASFILE] WITH CHECK CHECK CONSTRAINT [FK_DKT_TanuloFeladatbeadasFile_FileId_REF_DKT_File];

ALTER TABLE [dbo].[T_DKT_TANULOFELADATBEADASFILE] WITH CHECK CHECK CONSTRAINT [FK_DKT_TanuloFeladatbeadasFile_TanuloFeladatbeadasId_REF_DKT_TanuloFeladatbeadas];

ALTER TABLE [dbo].[T_DKT_TANULOFELADATBEADASFILE] WITH CHECK CHECK CONSTRAINT [FK_DKT_TanuloFeladatbeadasFile_IntezmenyId_REF_Intezmeny];

ALTER TABLE [dbo].[T_DKT_TANULOFELADATBEADASFILE] WITH CHECK CHECK CONSTRAINT [FK_DKT_TanuloFeladatbeadasFile_TanevId_REF_Tanev];


GO
PRINT N'Update complete.';


GO

EXEC dev.uspCreateSchemaViews 'T_DKT_TANULOFELADATBEADASFILE, T_DKT_FILE, T_DKT_FELADATFILE'

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
