mirror of
				https://github.com/dani-garcia/vaultwarden.git
				synced 2025-10-30 17:58:19 +02:00 
			
		
		
		
	initial mysql support
This commit is contained in:
		
				
					committed by
					
						 Nils Domrose
						Nils Domrose
					
				
			
			
				
	
			
			
			
						parent
						
							badd22ac3d
						
					
				
				
					commit
					ff759397f6
				
			| @@ -0,0 +1,8 @@ | ||||
| UPDATE users | ||||
| SET totp_secret = ( | ||||
|     SELECT twofactor.data FROM twofactor | ||||
|     WHERE twofactor.type = 0  | ||||
|     AND twofactor.user_uuid = users.uuid | ||||
| ); | ||||
|  | ||||
| DROP TABLE twofactor; | ||||
| @@ -0,0 +1,15 @@ | ||||
| CREATE TABLE twofactor ( | ||||
|   uuid      TEXT     NOT NULL PRIMARY KEY, | ||||
|   user_uuid TEXT     NOT NULL REFERENCES users (uuid), | ||||
|   type      INTEGER  NOT NULL, | ||||
|   enabled   BOOLEAN  NOT NULL, | ||||
|   data      TEXT     NOT NULL, | ||||
|  | ||||
|   UNIQUE (user_uuid, type) | ||||
| ); | ||||
|  | ||||
|  | ||||
| INSERT INTO twofactor (uuid, user_uuid, type, enabled, data)  | ||||
| SELECT lower(hex(randomblob(16))) , uuid, 0, 1, u.totp_secret FROM users u where u.totp_secret IS NOT NULL; | ||||
|  | ||||
| UPDATE users SET totp_secret = NULL; -- Instead of recreating the table, just leave the columns empty | ||||
		Reference in New Issue
	
	Block a user