mirror of
				https://github.com/dani-garcia/vaultwarden.git
				synced 2025-10-30 21:31:13 +00:00 
			
		
		
		
	Fixed issue #965
PostgreSQL updates/inserts ignored None/null values. This is nice for new entries, but not for updates. Added derive option to allways add these none/null values for Option<> variables. This solves issue #965
This commit is contained in:
		
					parent
					
						
							
								e3feba2a2c
							
						
					
				
			
			
				commit
				
					
						1ee8e44912
					
				
			
		
					 4 changed files with 4 additions and 0 deletions
				
			
		|  | @ -5,6 +5,7 @@ use crate::CONFIG; | ||||||
| 
 | 
 | ||||||
| #[derive(Debug, Identifiable, Queryable, Insertable, Associations, AsChangeset)] | #[derive(Debug, Identifiable, Queryable, Insertable, Associations, AsChangeset)] | ||||||
| #[table_name = "attachments"] | #[table_name = "attachments"] | ||||||
|  | #[changeset_options(treat_none_as_null="true")] | ||||||
| #[belongs_to(Cipher, foreign_key = "cipher_uuid")] | #[belongs_to(Cipher, foreign_key = "cipher_uuid")] | ||||||
| #[primary_key(id)] | #[primary_key(id)] | ||||||
| pub struct Attachment { | pub struct Attachment { | ||||||
|  |  | ||||||
|  | @ -7,6 +7,7 @@ use super::{ | ||||||
| 
 | 
 | ||||||
| #[derive(Debug, Identifiable, Queryable, Insertable, Associations, AsChangeset)] | #[derive(Debug, Identifiable, Queryable, Insertable, Associations, AsChangeset)] | ||||||
| #[table_name = "ciphers"] | #[table_name = "ciphers"] | ||||||
|  | #[changeset_options(treat_none_as_null="true")] | ||||||
| #[belongs_to(User, foreign_key = "user_uuid")] | #[belongs_to(User, foreign_key = "user_uuid")] | ||||||
| #[belongs_to(Organization, foreign_key = "organization_uuid")] | #[belongs_to(Organization, foreign_key = "organization_uuid")] | ||||||
| #[primary_key(uuid)] | #[primary_key(uuid)] | ||||||
|  |  | ||||||
|  | @ -5,6 +5,7 @@ use crate::CONFIG; | ||||||
| 
 | 
 | ||||||
| #[derive(Debug, Identifiable, Queryable, Insertable, Associations, AsChangeset)] | #[derive(Debug, Identifiable, Queryable, Insertable, Associations, AsChangeset)] | ||||||
| #[table_name = "devices"] | #[table_name = "devices"] | ||||||
|  | #[changeset_options(treat_none_as_null="true")] | ||||||
| #[belongs_to(User, foreign_key = "user_uuid")] | #[belongs_to(User, foreign_key = "user_uuid")] | ||||||
| #[primary_key(uuid)] | #[primary_key(uuid)] | ||||||
| pub struct Device { | pub struct Device { | ||||||
|  |  | ||||||
|  | @ -6,6 +6,7 @@ use crate::CONFIG; | ||||||
| 
 | 
 | ||||||
| #[derive(Debug, Identifiable, Queryable, Insertable, AsChangeset)] | #[derive(Debug, Identifiable, Queryable, Insertable, AsChangeset)] | ||||||
| #[table_name = "users"] | #[table_name = "users"] | ||||||
|  | #[changeset_options(treat_none_as_null="true")] | ||||||
| #[primary_key(uuid)] | #[primary_key(uuid)] | ||||||
| pub struct User { | pub struct User { | ||||||
|     pub uuid: String, |     pub uuid: String, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue