refactor(storage): totp_configurations table (#2657)

Rename column totp_period to period.
pull/2655/head^2
James Elliott 2021-12-02 12:24:10 +11:00 committed by GitHub
parent 2075e76015
commit f3f3b31b12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 10 deletions

View File

@ -12,7 +12,7 @@ type TOTPConfiguration struct {
Issuer string `db:"issuer" json:"-"`
Algorithm string `db:"algorithm" json:"-"`
Digits uint `db:"digits" json:"digits"`
Period uint `db:"totp_period" json:"period"`
Period uint `db:"period" json:"period"`
Secret []byte `db:"secret" json:"-"`
}

View File

@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS totp_configurations (
issuer VARCHAR(100),
algorithm VARCHAR(6) NOT NULL DEFAULT 'SHA1',
digits INTEGER NOT NULL DEFAULT 6,
totp_period INTEGER NOT NULL DEFAULT 30,
period INTEGER NOT NULL DEFAULT 30,
secret BLOB NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY (username)

View File

@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS totp_configurations (
issuer VARCHAR(100),
algorithm VARCHAR(6) NOT NULL DEFAULT 'SHA1',
digits INTEGER NOT NULL DEFAULT 6,
totp_period INTEGER NOT NULL DEFAULT 30,
period INTEGER NOT NULL DEFAULT 30,
secret BYTEA NOT NULL,
PRIMARY KEY (id),
UNIQUE (username)

View File

@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS totp_configurations (
issuer VARCHAR(100),
algorithm VARCHAR(6) NOT NULL DEFAULT 'SHA1',
digits INTEGER NOT NULL DEFAULT 6,
totp_period INTEGER NOT NULL DEFAULT 30,
period INTEGER NOT NULL DEFAULT 30,
secret BLOB NOT NULL,
PRIMARY KEY (id),
UNIQUE (username)

View File

@ -75,12 +75,12 @@ const (
const (
queryFmtSelectTOTPConfiguration = `
SELECT id, username, issuer, algorithm, digits, totp_period, secret
SELECT id, username, issuer, algorithm, digits, period, secret
FROM %s
WHERE username = ?;`
queryFmtSelectTOTPConfigurations = `
SELECT id, username, issuer, algorithm, digits, totp_period, secret
SELECT id, username, issuer, algorithm, digits, period, secret
FROM %s
LIMIT ?
OFFSET ?;`
@ -98,14 +98,14 @@ const (
WHERE username = ?;`
queryFmtUpsertTOTPConfiguration = `
REPLACE INTO %s (username, issuer, algorithm, digits, totp_period, secret)
REPLACE INTO %s (username, issuer, algorithm, digits, period, secret)
VALUES (?, ?, ?, ?, ?, ?);`
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)
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 = `
DELETE FROM %s

View File

@ -36,7 +36,7 @@ const (
ORDER BY username ASC;`
queryFmtPre1To1InsertTOTPConfiguration = `
INSERT INTO %s (username, issuer, totp_period, secret)
INSERT INTO %s (username, issuer, period, secret)
VALUES (?, ?, ?, ?);`
queryFmt1ToPre1InsertTOTPConfiguration = `