UPDATE TBDD_MODULES SET DB_VERSION = '1.0.0.1' where SHORT_NAME = 'EMLP' 
GO 
ALTER TABLE TBEMLP_POLL_INDEXING_STEPS ADD USE_FOR_DIRECT_ANSWER BIT NOT NULL DEFAULT 0
GO 
ALTER TABLE TBEMLP_POLL_PROCESS ADD WM_IDX_BODY_TEXT VARCHAR(50) NOT NULL DEFAULT ''
GO
ALTER TABLE TBEMLP_POLL_PROCESS ADD WM_IDX_BODY_SUBSTR_LENGTH INTEGER NOT NULL DEFAULT 0
GO  
ALTER TRIGGER TBEMLP_POLL_PROFILES_AFT_UPD ON TBEMLP_POLL_PROFILES
FOR UPDATE
AS
	UPDATE TBEMLP_POLL_PROFILES SET CHANGED_WHEN = GETDATE() FROM INSERTED WHERE TBEMLP_POLL_PROFILES.GUID = INSERTED.GUID
GO
ALTER TRIGGER TBEMLP_POLL_PROCESS_AFT_UPD ON TBEMLP_POLL_PROCESS
FOR UPDATE
AS
	UPDATE TBEMLP_POLL_PROCESS SET CHANGED_WHEN = GETDATE() FROM INSERTED WHERE TBEMLP_POLL_PROCESS.GUID = INSERTED.GUID
GO
ALTER TRIGGER TBEMLP_POLL_STEPS_AFT_UPD ON TBEMLP_POLL_STEPS
FOR UPDATE
AS
	UPDATE TBEMLP_POLL_STEPS SET CHANGED_WHEN = GETDATE() FROM INSERTED WHERE TBEMLP_POLL_STEPS.GUID = INSERTED.GUID
GO
CREATE TRIGGER TBEMLP_POLL_INDEXING_STEPS_AFT_UPD ON TBEMLP_POLL_INDEXING_STEPS
FOR UPDATE
AS
	UPDATE TBEMLP_POLL_INDEXING_STEPS SET CHANGED_WHEN = GETDATE() FROM INSERTED WHERE TBEMLP_POLL_INDEXING_STEPS.GUID = INSERTED.GUID
GO
ALTER TABLE TBEMLP_CONFIG ADD CHECK_INTERVALL_MINUTES INT NOT NULL DEFAULT 5
GO 
CREATE TABLE TBEMLP_HISTORY
(
	GUID				INTEGER		IDENTITY(1,1),              		
	WORK_PROCESS		VARCHAR(100),
	EMAIL_MSGID			VARCHAR(500)			NOT NULL,
	EMAIL_SUBJECT		VARCHAR(MAX),
	EMAIL_DATE			DATETIME,
	EMAIL_BODY			VARCHAR(MAX),
	EMAIL_SUBSTRING1	VARCHAR(2000),
	EMAIL_SUBSTRING2	VARCHAR(2000),
	COMMENT				VARCHAR(500),
	ADDED_WHEN	    DATETIME 		DEFAULT GETDATE(),
	CONSTRAINT		PK_TBEMLP_HISTORY	PRIMARY KEY (GUID)
)
GO
CREATE TRIGGER TBEMLP_CONFIG_AFT_UPD ON TBEMLP_CONFIG
FOR UPDATE
AS
	UPDATE TBEMLP_CONFIG SET CHANGED_WHEN = GETDATE() FROM INSERTED WHERE TBEMLP_CONFIG.GUID = INSERTED.GUID
GO
ALTER TABLE TBEMLP_POLL_PROCESS ADD PATH_ORIGINAL VARCHAR(1000)
GO  

