ALTER TABLE gam.Repository ALTER COLUMN RepUserSessionCacheTimeout TYPE integer
ALTER TABLE gam.Repository ALTER COLUMN RepUserTimeToUnblock TYPE integer
ALTER TABLE gam.Repository ALTER COLUMN RepUserRecPwdKeyTimeOut TYPE integer
ALTER TABLE gam.Repository ALTER COLUMN RepUserActTimeOut TYPE integer

ALTER TABLE gam.Session ADD SesEndedByOtherLogin BOOLEAN , ADD SesOTPExpire timestamp without time zone , ADD SesOTP VARCHAR(250) , ADD SesIdToken VARCHAR(4096)
DROP INDEX gam.ISESSION1
DROP INDEX gam.ISESSION
CREATE INDEX ISESOPESYS ON gam.Session (OpeSysId )
CREATE INDEX ISESUSER ON gam.Session (UserGUID ,RepId )
CREATE INDEX USESTOKEN ON gam.Session (SesToken )
CREATE INDEX USESREPPARENTTOKENUSERSTS ON gam.Session (RepId ,SesExtToken ,UserGUID ,SesSts )
CREATE INDEX USESREFRESHTOKEN ON gam.Session (RepId ,SesType ,SesSts ,SesAppId ,SesRefreshToken )
CREATE INDEX USESUSERAPPPARENT ON gam.Session (UserGUID ,SesAppId ,SesExtToken )
CREATE INDEX USESPARENTTOKENUSERSTS ON gam.Session (SesExtToken ,UserGUID ,SesSts )
CREATE INDEX USESSIONUSEROTPCODE ON gam.Session (RepId ,SesAppId ,SesAutTypeName ,UserGUID ,SesSts ,SesOTP ,SesDate DESC)

ALTER TABLE gam.SecurityPolicy ALTER COLUMN SecPolFrecMinChangePwd TYPE integer
ALTER TABLE gam.SecurityPolicy ALTER COLUMN SecPolSesTimeOut TYPE integer

ALTER TABLE gam.SessionHistory ADD SesHisEndedByOtherLogin BOOLEAN , ADD SesHisIdToken VARCHAR(4096)

ALTER TABLE gam."User" ADD UserLastFailedLoginAttempt timestamp without time zone , ADD UserFailedLoginAttempts smallint , ADD UserOTPFailedAttempts smallint , ADD UserOTPLastDateRequestCode date , ADD UserOTPDailyNumberCodes smallint , ADD UserOTPLastLockedDate timestamp without time zone , ADD UserOTPNumberLocked smallint , ADD UserEnableTwoFactorAuth BOOLEAN

CREATE TABLE gam.SysConnectionConfig (SysConnCfgKey CHAR(40) NOT NULL , SysConnCfgRep CHAR(40) NOT NULL , SysConnCfgName VARCHAR(120) NOT NULL , SysConnCfgUser VARCHAR(100) , SysConnCfgPwd CHAR(254) NOT NULL , SysConnCfgJson TEXT , PRIMARY KEY(SysConnCfgKey, SysConnCfgRep, SysConnCfgName))

DROP INDEX gam.UEVENTSUSCRIPTION
CREATE INDEX UEVENTSUSCRIPTION ON gam.EventSuscription (RepId ,EveSusEntity ,EveSusStatus ,EveSusDsc )

