UPDATE TBDD_BASECONFIG SET DB_VERSION = '1.9.3.0'
CREATE TABLE TBDD_NOTIFICATIONS_SYSTEM
(
	GUID			INTEGER			NOT NULL	IDENTITY (1, 1),
	TITLE			VARCHAR(250)	NOT NULL,
	MODULE			VARCHAR(250)	NOT NULL,
	DISPLAY_TYPE	VARCHAR(100)	NOT NULL,
	MSG_STRING		NVARCHAR(MAX)	NOT NULL,
	DISPLAY_UNTIL	DATE,
	VALIDATE_READ	BIT				NOT NULL	DEFAULT 0,
	ADDED_WHO		VARCHAR(100),
	ADDED_WHEN		DATETIME					DEFAULT GETDATE(),
	CHANGED_WHO	    VARCHAR(100),
	CHANGED_WHEN   	DATETIME,
	CONSTRAINT PK_TBDD_NOTIFICATIONS_SYSTEM    PRIMARY KEY (GUID),
	)
GO
CREATE TRIGGER TTBDD_NOTIFICATIONS_SYSTEM_AFT_UPD ON TBDD_NOTIFICATIONS_SYSTEM
FOR UPDATE
AS
  UPDATE TBDD_NOTIFICATIONS_SYSTEM SET CHANGED_WHEN = GETDATE()
  FROM INSERTED
  WHERE TBDD_NOTIFICATIONS_SYSTEM .GUID = INSERTED.GUID
GO

CREATE TABLE TBDD_NOTIFICATIONS_USER_HISTORY
(
	GUID			INTEGER	IDENTITY(1,1),         				
	NOTIFY_ID		INT			NOT NULL,
	USR_ID			INT				NOT NULL,
	ADDED_WHEN		DATETIME 		DEFAULT GETDATE(),
	CONSTRAINT		PK_TBDD_NOTIFICATIONS_USER_HISTORY	PRIMARY KEY (GUID),
	CONSTRAINT		FK_TBDD_NOTIFICATIONS_USER_HISTORY_NID	FOREIGN KEY(NOTIFY_ID)	REFERENCES TBDD_NOTIFICATIONS_SYSTEM(GUID),
)
GO