﻿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_KIRSZIRFELADATELLATASIHELY]...';


GO
ALTER TABLE [dbo].[T_KIRSZIRFELADATELLATASIHELY]
    ADD [C_DATUM] DATETIME NOT NULL;


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


GO
ALTER TABLE [dbo].[T_SOROLASOKATIPUS]
    ADD [C_ISBIZONYITVANYBANMEGJELENIK] CHAR (1) DEFAULT ('F') NOT NULL,
        [C_ISNAPLOBANMEGJELENIK]        CHAR (1) DEFAULT ('F') NOT NULL,
        [C_ISTORZSLAPONMEGJELENIK]      CHAR (1) DEFAULT ('F') NOT NULL;


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


GO
CREATE TABLE [dbo].[T_ORAFILE] (
    [ID]                  INT      IDENTITY (1, 1) NOT NULL,
    [C_ISTANULOLATHATO]   CHAR (1) NOT NULL,
    [C_ORADATUM]          DATETIME NOT NULL,
    [C_ORAFILETIPUSID]    INT      NOT NULL,
    [C_ORARENDIORAID]     INT      NULL,
    [C_TANITASIORAID]     INT      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,
    [ELOZOTANEVIREKORDID] INT      NULL,
    CONSTRAINT [PK_OraFile] PRIMARY KEY CLUSTERED ([ID] ASC)
);


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


GO
CREATE TABLE [dbo].[T_ORAFILETIPUS] (
    [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_OraFileTipus] PRIMARY KEY CLUSTERED ([ID] ASC, [C_ALINTEZMENYID] ASC, [C_ALTANEVID] ASC)
);


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


GO
CREATE TABLE [dbo].[T_ZARADEK] (
    [ID]                            INT            IDENTITY (1, 1) NOT NULL,
    [C_ISBIZONYITVANYBANMEGJELENIK] CHAR (1)       NOT NULL,
    [C_ISKIVAGYATSOROLASIZARADEK]   CHAR (1)       NOT NULL,
    [C_ISOSZTALYNAPLOBANMEGJELENIK] CHAR (1)       NOT NULL,
    [C_ISTORZSLAPONMEGJELENIK]      CHAR (1)       NOT NULL,
    [C_KELTEZESDATUMA]              DATETIME       NOT NULL,
    [C_KELTEZESHELYE]               NVARCHAR (255) NOT NULL,
    [C_ROGZITESDATUMA]              DATETIME       NOT NULL,
    [C_SZOVEG]                      NVARCHAR (MAX) NOT NULL,
    [C_UTOLSOMODOSITASDATUMA]       DATETIME       NOT NULL,
    [C_ROGZITOID]                   INT            NOT NULL,
    [C_UTOLSOMODOSITOID]            INT            NOT NULL,
    [C_TANULOCSOPORTID]             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,
    [ELOZOTANEVIREKORDID]           INT            NULL,
    CONSTRAINT [PK_Zaradek] PRIMARY KEY CLUSTERED ([ID] ASC)
);


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


GO
CREATE TABLE [dbo].[T_ZARADEKNYELV] (
    [ID]                  INT            IDENTITY (1, 1) NOT NULL,
    [C_NYELVID]           INT            NOT NULL,
    [C_SZOVEG]            NVARCHAR (MAX) NOT NULL,
    [C_ZARADEKID]         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,
    [ELOZOTANEVIREKORDID] INT            NULL,
    CONSTRAINT [PK_ZaradekNyelv] PRIMARY KEY CLUSTERED ([ID] ASC)
);


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_ORAFILE]
    ADD DEFAULT ('F') FOR [C_ISTANULOLATHATO];


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


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


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_ZARADEK]
    ADD DEFAULT ('F') FOR [C_ISKIVAGYATSOROLASIZARADEK];


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


GO
ALTER TABLE [dbo].[T_ZARADEK]
    ADD DEFAULT (getdate()) FOR [C_ROGZITESDATUMA];


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


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


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


GO
ALTER TABLE [dbo].[T_ZARADEK]
    ADD DEFAULT ('T') FOR [C_ISBIZONYITVANYBANMEGJELENIK];


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


GO
ALTER TABLE [dbo].[T_ZARADEK]
    ADD DEFAULT (getdate()) FOR [C_UTOLSOMODOSITASDATUMA];


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


GO
ALTER TABLE [dbo].[T_ZARADEK]
    ADD DEFAULT (getdate()) FOR [C_KELTEZESDATUMA];


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


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


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


GO
ALTER TABLE [dbo].[T_ZARADEK]
    ADD DEFAULT ('T') FOR [C_ISOSZTALYNAPLOBANMEGJELENIK];


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


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


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


GO
ALTER TABLE [dbo].[T_ZARADEK]
    ADD DEFAULT ('T') FOR [C_ISTORZSLAPONMEGJELENIK];


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


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


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_ORAFILE] WITH NOCHECK
    ADD CONSTRAINT [FK_OraFile_OrarendiOraId_REF_OrarendiOra] FOREIGN KEY ([C_ORARENDIORAID]) REFERENCES [dbo].[T_ORARENDIORA] ([ID]);


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


GO
ALTER TABLE [dbo].[T_ORAFILE] WITH NOCHECK
    ADD CONSTRAINT [FK_OraFile_TanitasiOraId_REF_TanitasiOra] FOREIGN KEY ([C_TANITASIORAID]) REFERENCES [dbo].[T_TANITASIORA] ([ID]);


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


GO
ALTER TABLE [dbo].[T_ORAFILE] WITH NOCHECK
    ADD CONSTRAINT [FK_OraFile_FileId_REF_File] FOREIGN KEY ([C_FILEID]) REFERENCES [dbo].[T_FILE] ([ID]);


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_ORAFILE] WITH NOCHECK
    ADD CONSTRAINT [FK_OraFile_OraFileTipusId_IntezmenyId_TanevId_REF_OraFileTipus] FOREIGN KEY ([C_ORAFILETIPUSID], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_ORAFILETIPUS] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);


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


GO
ALTER TABLE [dbo].[T_ORAFILETIPUS] WITH NOCHECK
    ADD CONSTRAINT [FK_OraFileTipus_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_OraFileTipus_AlIntezmenyId_REF_Intezmeny]...';


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


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


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


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


GO
ALTER TABLE [dbo].[T_ZARADEK] WITH NOCHECK
    ADD CONSTRAINT [FK_Zaradek_RogzitoId_REF_Felhasznalo] FOREIGN KEY ([C_ROGZITOID]) REFERENCES [dbo].[T_FELHASZNALO] ([ID]);


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


GO
ALTER TABLE [dbo].[T_ZARADEK] WITH NOCHECK
    ADD CONSTRAINT [FK_Zaradek_UtolsoModositoId_REF_Felhasznalo] FOREIGN KEY ([C_UTOLSOMODOSITOID]) REFERENCES [dbo].[T_FELHASZNALO] ([ID]);


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


GO
ALTER TABLE [dbo].[T_ZARADEK] WITH NOCHECK
    ADD CONSTRAINT [FK_Zaradek_TanuloCsoportId_REF_TanuloCsoport] FOREIGN KEY ([C_TANULOCSOPORTID]) REFERENCES [dbo].[T_TANULOCSOPORT] ([ID]);


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_ZARADEKNYELV] WITH NOCHECK
    ADD CONSTRAINT [FK_ZaradekNyelv_ZaradekId_REF_Zaradek] FOREIGN KEY ([C_ZARADEKID]) REFERENCES [dbo].[T_ZARADEK] ([ID]);


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_ZARADEKNYELV] WITH NOCHECK
    ADD CONSTRAINT [FK_ZaradekNyelv_NyelvId_IntezmenyId_TanevId_REF_Anyanyelv] FOREIGN KEY ([C_NYELVID], [C_INTEZMENYID], [C_TANEVID]) REFERENCES [dbo].[T_ANYANYELV] ([ID], [C_ALINTEZMENYID], [C_ALTANEVID]);




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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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




GO
ALTER TABLE [dbo].[T_ORAFILE] WITH CHECK CHECK CONSTRAINT [FK_OraFile_OrarendiOraId_REF_OrarendiOra];

ALTER TABLE [dbo].[T_ORAFILE] WITH CHECK CHECK CONSTRAINT [FK_OraFile_TanitasiOraId_REF_TanitasiOra];

ALTER TABLE [dbo].[T_ORAFILE] WITH CHECK CHECK CONSTRAINT [FK_OraFile_FileId_REF_File];

ALTER TABLE [dbo].[T_ORAFILE] WITH CHECK CHECK CONSTRAINT [FK_OraFile_IntezmenyId_REF_Intezmeny];

ALTER TABLE [dbo].[T_ORAFILE] WITH CHECK CHECK CONSTRAINT [FK_OraFile_TanevId_REF_Tanev];

ALTER TABLE [dbo].[T_ORAFILE] WITH CHECK CHECK CONSTRAINT [FK_OraFile_OraFileTipusId_IntezmenyId_TanevId_REF_OraFileTipus];

ALTER TABLE [dbo].[T_ORAFILETIPUS] WITH CHECK CHECK CONSTRAINT [FK_OraFileTipus_Id_AlintezmenyId_AltanevId_REF_DictionaryItemBase];

ALTER TABLE [dbo].[T_ORAFILETIPUS] WITH CHECK CHECK CONSTRAINT [FK_OraFileTipus_AlIntezmenyId_REF_Intezmeny];

ALTER TABLE [dbo].[T_ORAFILETIPUS] WITH CHECK CHECK CONSTRAINT [FK_OraFileTipus_AlTanevId_REF_Tanev];

ALTER TABLE [dbo].[T_ZARADEK] WITH CHECK CHECK CONSTRAINT [FK_Zaradek_RogzitoId_REF_Felhasznalo];

ALTER TABLE [dbo].[T_ZARADEK] WITH CHECK CHECK CONSTRAINT [FK_Zaradek_UtolsoModositoId_REF_Felhasznalo];

ALTER TABLE [dbo].[T_ZARADEK] WITH CHECK CHECK CONSTRAINT [FK_Zaradek_TanuloCsoportId_REF_TanuloCsoport];

ALTER TABLE [dbo].[T_ZARADEK] WITH CHECK CHECK CONSTRAINT [FK_Zaradek_IntezmenyId_REF_Intezmeny];

ALTER TABLE [dbo].[T_ZARADEK] WITH CHECK CHECK CONSTRAINT [FK_Zaradek_TanevId_REF_Tanev];

ALTER TABLE [dbo].[T_ZARADEKNYELV] WITH CHECK CHECK CONSTRAINT [FK_ZaradekNyelv_ZaradekId_REF_Zaradek];

ALTER TABLE [dbo].[T_ZARADEKNYELV] WITH CHECK CHECK CONSTRAINT [FK_ZaradekNyelv_IntezmenyId_REF_Intezmeny];

ALTER TABLE [dbo].[T_ZARADEKNYELV] WITH CHECK CHECK CONSTRAINT [FK_ZaradekNyelv_TanevId_REF_Tanev];

ALTER TABLE [dbo].[T_ZARADEKNYELV] WITH CHECK CHECK CONSTRAINT [FK_ZaradekNyelv_NyelvId_IntezmenyId_TanevId_REF_Anyanyelv];




GO
EXEC dev.uspCreateSchemaViews 'T_KIRSZIRFELADATELLATASIHELY, T_SOROLASOKATIPUS, T_ORAFILE, T_ORAFILETIPUS, T_ZARADEK, T_ZARADEKNYELV';
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
