sql_Upgrade_From_Previous_Version.txt

/****** SQL script query only needs to be executed on sMFA database if you are doing upgrade from previous version ******/
 
alter table SecureMfaOTP.dbo.secrets
alter column secret char(48) NOT NULL;
 
IF COL_LENGTH('SecureMfaOTP.dbo.secrets', 'failedlogoncount') IS NULL
BEGIN
    alter table SecureMfaOTP.dbo.secrets
    ADD failedlogoncount INT DEFAULT 0 NOT NULL;
END
 
IF COL_LENGTH('SecureMfaOTP.dbo.secrets', 'failedlastlogon') IS NULL
BEGIN
    alter table SecureMfaOTP.dbo.secrets
    ADD failedlastlogon datetime NULL;
END
 
IF COL_LENGTH('SecureMfaOTP.dbo.secrets', 'failedcode') IS NULL
BEGIN
    alter table SecureMfaOTP.dbo.secrets
    ADD failedcode char(6);
END
 
IF COL_LENGTH('SecureMfaOTP.dbo.secrets', 'logonip') IS NULL
BEGIN
    alter table SecureMfaOTP.dbo.secrets
    ADD logonip varchar(39);
END
 
IF COL_LENGTH('SecureMfaOTP.dbo.secrets', 'useragent') IS NULL
BEGIN
    alter table SecureMfaOTP.dbo.secrets
    ADD useragent varchar(128);
END
 
ALTER TABLE SecureMfaOTP.dbo.secrets ALTER COLUMN logonip VARCHAR (64) NULL;