refactor(storage): totp_configurations table (#2657)
Rename column totp_period to period.pull/2655/head^2
parent
2075e76015
commit
f3f3b31b12
|
@ -12,7 +12,7 @@ type TOTPConfiguration struct {
|
||||||
Issuer string `db:"issuer" json:"-"`
|
Issuer string `db:"issuer" json:"-"`
|
||||||
Algorithm string `db:"algorithm" json:"-"`
|
Algorithm string `db:"algorithm" json:"-"`
|
||||||
Digits uint `db:"digits" json:"digits"`
|
Digits uint `db:"digits" json:"digits"`
|
||||||
Period uint `db:"totp_period" json:"period"`
|
Period uint `db:"period" json:"period"`
|
||||||
Secret []byte `db:"secret" json:"-"`
|
Secret []byte `db:"secret" json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS totp_configurations (
|
||||||
issuer VARCHAR(100),
|
issuer VARCHAR(100),
|
||||||
algorithm VARCHAR(6) NOT NULL DEFAULT 'SHA1',
|
algorithm VARCHAR(6) NOT NULL DEFAULT 'SHA1',
|
||||||
digits INTEGER NOT NULL DEFAULT 6,
|
digits INTEGER NOT NULL DEFAULT 6,
|
||||||
totp_period INTEGER NOT NULL DEFAULT 30,
|
period INTEGER NOT NULL DEFAULT 30,
|
||||||
secret BLOB NOT NULL,
|
secret BLOB NOT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE KEY (username)
|
UNIQUE KEY (username)
|
||||||
|
|
|
@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS totp_configurations (
|
||||||
issuer VARCHAR(100),
|
issuer VARCHAR(100),
|
||||||
algorithm VARCHAR(6) NOT NULL DEFAULT 'SHA1',
|
algorithm VARCHAR(6) NOT NULL DEFAULT 'SHA1',
|
||||||
digits INTEGER NOT NULL DEFAULT 6,
|
digits INTEGER NOT NULL DEFAULT 6,
|
||||||
totp_period INTEGER NOT NULL DEFAULT 30,
|
period INTEGER NOT NULL DEFAULT 30,
|
||||||
secret BYTEA NOT NULL,
|
secret BYTEA NOT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE (username)
|
UNIQUE (username)
|
||||||
|
|
|
@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS totp_configurations (
|
||||||
issuer VARCHAR(100),
|
issuer VARCHAR(100),
|
||||||
algorithm VARCHAR(6) NOT NULL DEFAULT 'SHA1',
|
algorithm VARCHAR(6) NOT NULL DEFAULT 'SHA1',
|
||||||
digits INTEGER NOT NULL DEFAULT 6,
|
digits INTEGER NOT NULL DEFAULT 6,
|
||||||
totp_period INTEGER NOT NULL DEFAULT 30,
|
period INTEGER NOT NULL DEFAULT 30,
|
||||||
secret BLOB NOT NULL,
|
secret BLOB NOT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE (username)
|
UNIQUE (username)
|
||||||
|
|
|
@ -75,12 +75,12 @@ const (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
queryFmtSelectTOTPConfiguration = `
|
queryFmtSelectTOTPConfiguration = `
|
||||||
SELECT id, username, issuer, algorithm, digits, totp_period, secret
|
SELECT id, username, issuer, algorithm, digits, period, secret
|
||||||
FROM %s
|
FROM %s
|
||||||
WHERE username = ?;`
|
WHERE username = ?;`
|
||||||
|
|
||||||
queryFmtSelectTOTPConfigurations = `
|
queryFmtSelectTOTPConfigurations = `
|
||||||
SELECT id, username, issuer, algorithm, digits, totp_period, secret
|
SELECT id, username, issuer, algorithm, digits, period, secret
|
||||||
FROM %s
|
FROM %s
|
||||||
LIMIT ?
|
LIMIT ?
|
||||||
OFFSET ?;`
|
OFFSET ?;`
|
||||||
|
@ -98,14 +98,14 @@ const (
|
||||||
WHERE username = ?;`
|
WHERE username = ?;`
|
||||||
|
|
||||||
queryFmtUpsertTOTPConfiguration = `
|
queryFmtUpsertTOTPConfiguration = `
|
||||||
REPLACE INTO %s (username, issuer, algorithm, digits, totp_period, secret)
|
REPLACE INTO %s (username, issuer, algorithm, digits, period, secret)
|
||||||
VALUES (?, ?, ?, ?, ?, ?);`
|
VALUES (?, ?, ?, ?, ?, ?);`
|
||||||
|
|
||||||
queryFmtPostgresUpsertTOTPConfiguration = `
|
queryFmtPostgresUpsertTOTPConfiguration = `
|
||||||
INSERT INTO %s (username, issuer, algorithm, digits, totp_period, secret)
|
INSERT INTO %s (username, issuer, algorithm, digits, period, secret)
|
||||||
VALUES ($1, $2, $3, $4, $5, $6)
|
VALUES ($1, $2, $3, $4, $5, $6)
|
||||||
ON CONFLICT (username)
|
ON CONFLICT (username)
|
||||||
DO UPDATE SET issuer = $2, algorithm = $3, digits = $4, totp_period = $5, secret = $6;`
|
DO UPDATE SET issuer = $2, algorithm = $3, digits = $4, period = $5, secret = $6;`
|
||||||
|
|
||||||
queryFmtDeleteTOTPConfiguration = `
|
queryFmtDeleteTOTPConfiguration = `
|
||||||
DELETE FROM %s
|
DELETE FROM %s
|
||||||
|
|
|
@ -36,7 +36,7 @@ const (
|
||||||
ORDER BY username ASC;`
|
ORDER BY username ASC;`
|
||||||
|
|
||||||
queryFmtPre1To1InsertTOTPConfiguration = `
|
queryFmtPre1To1InsertTOTPConfiguration = `
|
||||||
INSERT INTO %s (username, issuer, totp_period, secret)
|
INSERT INTO %s (username, issuer, period, secret)
|
||||||
VALUES (?, ?, ?, ?);`
|
VALUES (?, ?, ?, ?);`
|
||||||
|
|
||||||
queryFmt1ToPre1InsertTOTPConfiguration = `
|
queryFmt1ToPre1InsertTOTPConfiguration = `
|
||||||
|
|
Loading…
Reference in New Issue