if not exists(select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'CSEasyVerifyVerifications' and COLUMN_NAME = 'Action')
begin
	alter table dbo.CSEasyVerifyVerifications
		add [Action] nchar(1) not null default('M')
end
go

if exists(select * from DDTests where Tablename = 'CSEasyVerifyVerifications' and FieldName = 'Action')
begin
	delete from DDTests where Tablename = 'CSEasyVerifyVerifications' and FieldName = 'Action'
end
go


if not exists(select * from DDTests where Tablename = 'CSEasyVerifyVerifications' and FieldName = 'Action')
begin
	insert into DDTests(DatabaseChar, Tablename, FieldName, DisplayChar, Description, TermId, options, SeqNr) values('M', 'CSEasyVerifyVerifications', 'Action', 'M', 'Message', 1778, '', 0)
	insert into DDTests(DatabaseChar, Tablename, FieldName, DisplayChar, Description, TermId, options, SeqNr) values('O', 'CSEasyVerifyVerifications', 'Action', 'O', 'BPA Platform (Orbis)', 0, '', 1)
	insert into DDTests(DatabaseChar, Tablename, FieldName, DisplayChar, Description, TermId, options, SeqNr) values('S', 'CSEasyVerifyVerifications', 'Action', 'S', 'Stored Procedure', 0, '', 2)
	insert into DDTests(DatabaseChar, Tablename, FieldName, DisplayChar, Description, TermId, options, SeqNr) values('T', 'CSEasyVerifyVerifications', 'Action', 'T', 'Tabel uitvoeren', 0, '', 3)
end
go

if not exists(select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'CSEasyVerifyVerifications' and COLUMN_NAME = 'ActionData')
begin
	alter table dbo.CSEasyVerifyVerifications
		add [ActionData] [nvarchar](max) NULL
end
go


if exists(select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'CSEasyVerifyVerifications' and COLUMN_NAME = 'Message' and IS_NULLABLE = 'NO')
begin
	alter table CSEasyVerifyVerifications
		alter column [Message] [nvarchar](max) NULL
end
go



if not exists(select * from CSEasyVerifyPages where BusinessComponent = 'BDDocument')
begin
	insert into [dbo].[CSEasyVerifyPages]([ID], [Caption], [CaptionID], [ASPXPage], [IsMaintScreen], [TableName], [KeyColumn], [KeyInputField], [BusinessComponent], [BCDataSource], [BCErrorMessages], [CardID], [SysCreated])
		select 'B35A9A9A-576A-491B-A121-1DA165442B6B' as [ID], N'Document' as [Caption], 7226 as [CaptionID], N'DocView.aspx' as [ASPXPage], 0 as [IsMaintScreen], N'BacoDiscussions' as [TableName], N'ID' as [KeyColumn], N'DocumentID' as [KeyInputField], N'BDDocument' as [BusinessComponent], NULL as [BCDataSource], N'errFound' as [BCErrorMessages], null as [CardID], getdate() as [SysCreated]
		union
		select 'B35A9A9A-576A-491B-A121-1DA165442B6C' as [ID], N'Document' as [Caption], 7226 as [CaptionID], N'DocDocumentEdit.aspx' as [ASPXPage], 1 as [IsMaintScreen], N'BacoDiscussions' as [TableName], N'ID' as [KeyColumn], N'ID' as [KeyInputField], N'BDDocument' as [BusinessComponent], N'bc' as [BCDataSource], N'errFound' as [BCErrorMessages], null as [CardID], getdate() as [SysCreated]
end
go


if not exists(select * from CSEasyVerifyPropertiesChanged where BusinessComponent = 'BDDocument')
begin
	insert into CSEasyVerifyPropertiesChanged(ID, BusinessComponent, PropName, SysCreated) values('05EE62F1-88FF-4790-8215-2F29D5C4EB39', 'BDDocument', 'Associate', getdate())
	insert into CSEasyVerifyPropertiesChanged(ID, BusinessComponent, PropName, SysCreated) values('35EE62F1-88FF-4790-8215-2F29D5C4EB39', 'BDDocument', 'Item', getdate())
	insert into CSEasyVerifyPropertiesChanged(ID, BusinessComponent, PropName, SysCreated) values('45EE62F1-88FF-4790-8215-2F29D5C4EB39', 'BDDocument', 'Person', getdate())
	insert into CSEasyVerifyPropertiesChanged(ID, BusinessComponent, PropName, SysCreated) values('55EE62F1-88FF-4790-8215-2F29D5C4EB39', 'BDDocument', 'ProjectNr', getdate())
	insert into CSEasyVerifyPropertiesChanged(ID, BusinessComponent, PropName, SysCreated) values('65EE62F1-88FF-4790-8215-2F29D5C4EB39', 'BDDocument', 'Type', getdate())
end
go


if not exists(select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'CSEasyVerifyVerifications' and COLUMN_NAME = 'ExecuteTable')
begin
	alter table CSEasyVerifyVerifications
		add [ExecuteTable] [nvarchar](128) NULL
end
go
