IF not EXISTS(select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_ID_DbSyncTimeStamp') create table ACT_ID_DbSyncTimeStamp (
	id bigint identity(1,1),
    accountId int,
    dbTimeStamp varbinary(8),
	primary key (id)
);

IF not EXISTS(select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RE_VARIABLE') CREATE TABLE ACT_RE_VARIABLE(
	ID_ nvarchar(64),
	DEPLOYMENT_ID_ nvarchar(300),
	NAME_ nvarchar(64),
    VALUE_ nvarchar(max),
	CREATE_TIME_ DateTime2 default GETDATE(),
    REV_ int,
    primary key (ID_)
);


IF not EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_NAME = 'UK_RE_VARIABLE_DEPLOYMENT_ID_NAME') ALTER TABLE ACT_RE_VARIABLE ADD CONSTRAINT UK_RE_VARIABLE_DEPLOYMENT_ID_NAME UNIQUE (DEPLOYMENT_ID_, NAME_);
