You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
507 B
16 lines
507 B
6 years ago
|
CREATE TABLE twofactor (
|
||
6 years ago
|
uuid VARCHAR(40) NOT NULL PRIMARY KEY,
|
||
|
user_uuid VARCHAR(40) NOT NULL REFERENCES users (uuid),
|
||
6 years ago
|
type INTEGER NOT NULL,
|
||
6 years ago
|
enabled BOOLEAN NOT NULL,
|
||
|
data TEXT NOT NULL,
|
||
|
|
||
6 years ago
|
UNIQUE (user_uuid, type)
|
||
6 years ago
|
);
|
||
|
|
||
|
|
||
6 years ago
|
INSERT INTO twofactor (uuid, user_uuid, type, enabled, data)
|
||
6 years ago
|
SELECT UUID(), uuid, 0, 1, u.totp_secret FROM users u where u.totp_secret IS NOT NULL;
|
||
6 years ago
|
|
||
6 years ago
|
UPDATE users SET totp_secret = NULL; -- Instead of recreating the table, just leave the columns empty
|