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

SET NUMERIC_ROUNDABORT OFF;


GO


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


GO
ALTER TABLE [dbo].[T_OGORARENDIORA] DROP CONSTRAINT [FK_4027863_4027861];


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


GO
ALTER TABLE [dbo].[T_MUNKAUGYIADATOK] DROP CONSTRAINT [FK_4026129_4026127];


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


GO
ALTER TABLE [dbo].[T_ORAK_TANAROK] DROP CONSTRAINT [FK_4025633_4025631];


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


GO
ALTER TABLE [dbo].[T_FOGLALKOZASOK_TANAROK] DROP CONSTRAINT [FK_4025437_4025435];


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


GO
ALTER TABLE [dbo].[T_PEDAGOGUSIKTADATSZOLGALTATAS] DROP CONSTRAINT [FK_4027463_4027462];


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


GO
ALTER TABLE [dbo].[T_NEMKOTOTTMUNKAIDO] DROP CONSTRAINT [FK_4026685_4026684];


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


GO
ALTER TABLE [dbo].[T_OGFOGLALKOZAS] DROP CONSTRAINT [FK_4027815_4027814];


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


GO
ALTER TABLE [dbo].[T_TANULOERTEKELES] DROP CONSTRAINT [FK_4025670_4025669];


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


GO
ALTER TABLE [dbo].[T_TANITASIORA] DROP CONSTRAINT [FK_4025629_4025628];


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


GO
ALTER TABLE [dbo].[T_TEVEKENYSEG] DROP CONSTRAINT [FK_4025850_4025849];


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


GO
ALTER TABLE [dbo].[T_ALKALMAZOTT] DROP CONSTRAINT [FK_T_8935_4025165];


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


GO
ALTER TABLE [dbo].[T_ALKALMAZOTT] DROP CONSTRAINT [FK_402513902_402513900];


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


GO
ALTER TABLE [dbo].[T_ALKALMAZOTT] DROP CONSTRAINT [FK_402513905_402513903];


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


GO
ALTER TABLE [dbo].[T_OGTANARFOGLALTSAG] DROP CONSTRAINT [FK_4027771_4027769];


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


GO
ALTER TABLE [dbo].[T_TANMENET] DROP CONSTRAINT [FK_4025605_4025604];


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


GO
ALTER TABLE [dbo].[T_ORARENDIORA] DROP CONSTRAINT [FK_4026327_4026325];


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


GO
ALTER TABLE [dbo].[T_TEREM] DROP CONSTRAINT [FK_4026131_4026130];


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


GO
ALTER TABLE [dbo].[T_OSZTALY] DROP CONSTRAINT [FK_4025320_4025319];


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


GO
ALTER TABLE [dbo].[T_OSZTALY] DROP CONSTRAINT [FK_4025323_4025322];


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


GO
ALTER TABLE [dbo].[T_IGAZOLAS] DROP CONSTRAINT [FK_4025761_4025759];


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


GO
ALTER TABLE [dbo].[T_ESZKOZ] DROP CONSTRAINT [FK_4025281_4025280];


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


GO
ALTER TABLE [dbo].[T_ORALATOGATAS] DROP CONSTRAINT [FK_4025792_4025791];


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


GO
ALTER TABLE [dbo].[T_TANARITANTARGY] DROP CONSTRAINT [FK_4025945_4025944];


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


GO
ALTER TABLE [dbo].[T_HELYETTESITESIIDOSZAK] DROP CONSTRAINT [FK_4026291_4026289];


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


GO
ALTER TABLE [dbo].[T_CSOPORT] DROP CONSTRAINT [FK_4025326_4025325];


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


GO
ALTER TABLE [dbo].[T_TOVABBIMUNKAUGYIADATOK] DROP CONSTRAINT [FK_4027571_4027569];


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


GO
ALTER TABLE [dbo].[T_JOGYAKORLAT] DROP CONSTRAINT [FK_4025910_4025909];


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


GO
ALTER TABLE [dbo].[T_TANULOESEMENY] DROP CONSTRAINT [FK_4025714_4025713];


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


GO
ALTER TABLE [dbo].[T_TANULOKOZOSSEGISZOLGALAT] DROP CONSTRAINT [FK_4026179_4026177];


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


GO
ALTER TABLE [dbo].[T_TANULOKOZOSSEGISZOLGALAT] DROP CONSTRAINT [FK_4026300_4026299];


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


GO
ALTER TABLE [dbo].[T_TANULOKOZOSSEGISZOLGALAT] DROP CONSTRAINT [FK_402617202_402617200];


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


GO
ALTER TABLE [dbo].[T_TANULOKOZOSSEGISZOLGALAT] DROP CONSTRAINT [FK_402617205_402617203];


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


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


GO
PRINT N'Creating [dbo].[T_KOZOSSEGISZOLGALATTIPUS].[I_T_402791102_402791100]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402791102_402791100]
    ON [dbo].[T_KOZOSSEGISZOLGALATTIPUS]([C_ALINTEZMENYID] ASC);


GO
PRINT N'Creating [dbo].[T_KOZOSSEGISZOLGALATTIPUS].[I_T_402791105_402791103]...';


GO
CREATE NONCLUSTERED INDEX [I_T_402791105_402791103]
    ON [dbo].[T_KOZOSSEGISZOLGALATTIPUS]([C_ALTANEVID] ASC);


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


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


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


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


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


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


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


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


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


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


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


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


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


GO
ALTER TABLE [dbo].[T_KOZOSSEGISZOLGALATTIPUS] WITH CHECK CHECK CONSTRAINT [FK_T_21038_4027912];

ALTER TABLE [dbo].[T_KOZOSSEGISZOLGALATTIPUS] WITH CHECK CHECK CONSTRAINT [FK_402791102_402791100];

ALTER TABLE [dbo].[T_KOZOSSEGISZOLGALATTIPUS] WITH CHECK CHECK CONSTRAINT [FK_402791105_402791103];


GO
PRINT N'Update complete.';


GO
