0
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden synced 2024-07-03 03:08:22 +02:00
bitwarden_rs/migrations/2018-07-11-181453_create_u2f_twofactor/up.sql

16 lines
510 B
MySQL
Raw Normal View History

CREATE TABLE twofactor (
2019-05-20 21:12:41 +02:00
uuid VARCHAR(40) NOT NULL PRIMARY KEY,
user_uuid VARCHAR(40) NOT NULL REFERENCES users (uuid),
atype INTEGER NOT NULL,
enabled BOOLEAN NOT NULL,
data TEXT NOT NULL,
2019-05-20 21:12:41 +02:00
UNIQUE (user_uuid, atype)
);
2019-05-20 21:12:41 +02:00
INSERT INTO twofactor (uuid, user_uuid, atype, enabled, data)
SELECT UUID(), uuid, 0, 1, u.totp_secret FROM users u where u.totp_secret IS NOT NULL;
2019-05-20 21:12:41 +02:00
UPDATE users SET totp_secret = NULL; -- Instead of recreating the table, just leave the columns empty