ALTER TABLE [VCLib].[T_TEMPLATE_OVERRIDE] ADD [Entities] int NULL
GO

ALTER TABLE [VCLib].[T_TEMPLATE_OVERRIDE] WITH NOCHECK ADD CONSTRAINT [FK_T_ENTITIES_T_TEMPLATE_OVERRIDE_Entities]
FOREIGN KEY([Entities]) REFERENCES [VCLib].[T_ENTITIES] ([EntityID])
GO



-- Tables

/***** Object:  Table [VCLib].[T_LEXEM_PARAMETER] *****/
CREATE TABLE [VCLib].[T_LEXEM_PARAMETER]
(
    [LexemParameterID] uniqueidentifier NOT NULL,
    [ParamName] varchar(255) NOT NULL,
    [ParamValue] text NOT NULL,
    [type_] int NOT NULL
)
ON [PRIMARY]
GO

-- Alters

ALTER TABLE [VCLib].[T_LEXEM_PARAMETER] WITH NOCHECK ADD CONSTRAINT [PK_T_LEXEM_PARAMETER]
PRIMARY KEY CLUSTERED ([LexemParameterID]) ON [PRIMARY]
GO

ALTER TABLE [VCLib].[T_LEXEM_PARAMETER] WITH NOCHECK ADD CONSTRAINT [FK_T_ENTITIES_T_LEXEM_PARAMETER_type_]
FOREIGN KEY([type_]) REFERENCES [VCLib].[T_ENTITIES] ([EntityID])
GO

ALTER TABLE [VCLib].[T_LEXEM_PARAMETER] ADD [TemplateOverride] uniqueidentifier NULL
GO
ALTER TABLE [VCLib].[T_LEXEM_PARAMETER] WITH NOCHECK ADD CONSTRAINT [FK_T_TEMPLATE_OVERRIDE_T_LEXEM_PARAMETER_TemplateOverride]
FOREIGN KEY([TemplateOverride]) REFERENCES [VCLib].[T_TEMPLATE_OVERRIDE] ([TemplateOverrideID])
GO

ALTER TABLE [VCLib].[T_LEXEM_PARAMETER] ADD [ExtraTemplate] uniqueidentifier NULL
GO
ALTER TABLE [VCLib].[T_LEXEM_PARAMETER] WITH NOCHECK ADD CONSTRAINT [FK_T_EXTRA_TEMPLATE_T_LEXEM_PARAMETER_ExtraTemplate]
FOREIGN KEY([ExtraTemplate]) REFERENCES [VCLib].[T_EXTRA_TEMPLATE] ([FileID])
GO



update o
set o.OutputName = '"' + o.OutputName + '"'
from VCLib.T_TEMPLATE_OVERRIDE o
where o.OutputName is not null
GO