sql_Upgrade_From_Previous_Version.txt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/****** 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