mirror of
				https://github.com/dani-garcia/vaultwarden.git
				synced 2025-11-04 04:08:20 +02:00 
			
		
		
		
	
		
			
				
	
	
		
			17 lines
		
	
	
		
			411 B
		
	
	
	
		
			SQL
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			411 B
		
	
	
	
		
			SQL
		
	
	
	
	
	
CREATE TABLE favorites (
 | 
						|
  user_uuid   CHAR(36) NOT NULL REFERENCES users(uuid),
 | 
						|
  cipher_uuid CHAR(36) NOT NULL REFERENCES ciphers(uuid),
 | 
						|
 | 
						|
  PRIMARY KEY (user_uuid, cipher_uuid)
 | 
						|
);
 | 
						|
 | 
						|
-- Transfer favorite status for user-owned ciphers.
 | 
						|
INSERT INTO favorites(user_uuid, cipher_uuid)
 | 
						|
SELECT user_uuid, uuid
 | 
						|
FROM ciphers
 | 
						|
WHERE favorite = TRUE
 | 
						|
  AND user_uuid IS NOT NULL;
 | 
						|
 | 
						|
ALTER TABLE ciphers
 | 
						|
DROP COLUMN favorite;
 |