Browse Source
			
			
			Fix db issues with Option<> values and upd crates (#5594)
			
				Some tables were lacking an option to convert Option<> to NULL.
This commit will fix that.
Also updated the crates to the latest version available.
			
			
				pull/5618/head
			
			
		 
		
			
				
					
						
						Mathijs van Veluw
					
					9 months ago
					
						
							committed by
							
								
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: B5690EEEBB952194
						
					
				
			
		
		
		
	
		
			
				 6 changed files with 
14 additions and 
10 deletions
			 
			
		 
		
			
				- 
					
					
					 
					Cargo.lock
				
 
			
				- 
					
					
					 
					Cargo.toml
				
 
			
				- 
					
					
					 
					src/db/models/collection.rs
				
 
			
				- 
					
					
					 
					src/db/models/event.rs
				
 
			
				- 
					
					
					 
					src/db/models/group.rs
				
 
			
				- 
					
					
					 
					src/db/models/organization.rs
				
 
			
		
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -489,9 +489,9 @@ checksum = "ade8366b8bd5ba243f0a58f036cc0ca8a2f069cff1a2351ef1cac6b083e16fc0" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					[[package]] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					name = "cc" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					version = "1.2.13" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					version = "1.2.14" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					source = "registry+https://github.com/rust-lang/crates.io-index" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					checksum = "c7777341816418c02e033934a09f20dc0ccaf65a5201ef8a450ae0105a573fda" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					checksum = "0c3d1b2e905a3a7b00a6141adb0e4c0bb941d11caf55349d863942a1cc44e3c9" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					dependencies = [ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 "shlex", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					] | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -2130,9 +2130,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					[[package]] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					name = "miniz_oxide" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					version = "0.8.3" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					version = "0.8.4" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					source = "registry+https://github.com/rust-lang/crates.io-index" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					checksum = "b8402cab7aefae129c6977bb0ff1b8fd9a04eb5b51efc50a70bea51cda0c7924" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					checksum = "b3b1c9bd4fe1f0f8b387f6eb9eb3b4a1aa26185e5750efb9140301703f62cd1b" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					dependencies = [ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 "adler2", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					] | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -2682,9 +2682,9 @@ checksum = "33cb294fe86a74cbcf50d4445b37da762029549ebeea341421c7c70370f86cac" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					[[package]] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					name = "psm" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					version = "0.1.24" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					version = "0.1.25" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					source = "registry+https://github.com/rust-lang/crates.io-index" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					checksum = "200b9ff220857e53e184257720a14553b2f4aa02577d2ed9842d45d4b9654810" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					checksum = "f58e5423e24c18cc840e1c98370b3993c6649cd1678b4d24318bcf0a083cbe88" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					dependencies = [ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 "cc", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					] | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -2963,15 +2963,14 @@ dependencies = [ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					[[package]] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					name = "ring" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					version = "0.17.8" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					version = "0.17.9" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					source = "registry+https://github.com/rust-lang/crates.io-index" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					checksum = "e75ec5e92c4d8aede845126adc388046234541629e76029599ed35a003c7ed24" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					dependencies = [ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 "cc", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 "cfg-if", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 "getrandom 0.2.15", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 "libc", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 "spin", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 "untrusted", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 "windows-sys 0.52.0", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					] | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -90,7 +90,7 @@ libsqlite3-sys = { version = "0.31.0", features = ["bundled"], optional = true } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# Crypto-related libraries | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					rand = "0.9.0" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					ring = "0.17.8" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					ring = "0.17.9" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# UUID generation | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					uuid = { version = "1.13.1", features = ["v4"] } | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -11,6 +11,7 @@ use macros::UuidFromParam; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					db_object! { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[derive(Identifiable, Queryable, Insertable, AsChangeset)] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[diesel(table_name = collections)] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[diesel(treat_none_as_null = true)] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[diesel(primary_key(uuid))] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    pub struct Collection { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        pub uuid: CollectionId, | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -13,6 +13,7 @@ db_object! { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // Upstream SQL: https://github.com/bitwarden/server/blob/8a22c0479e987e756ce7412c48a732f9002f0a2d/src/Sql/dbo/Tables/Event.sql
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[derive(Identifiable, Queryable, Insertable, AsChangeset)] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[diesel(table_name = event)] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[diesel(treat_none_as_null = true)] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[diesel(primary_key(uuid))] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    pub struct Event { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        pub uuid: EventId, | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -10,6 +10,7 @@ use serde_json::Value; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					db_object! { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[derive(Identifiable, Queryable, Insertable, AsChangeset)] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[diesel(table_name = groups)] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[diesel(treat_none_as_null = true)] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[diesel(primary_key(uuid))] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    pub struct Group { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        pub uuid: GroupId, | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -17,6 +17,7 @@ use macros::UuidFromParam; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					db_object! { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[derive(Identifiable, Queryable, Insertable, AsChangeset)] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[diesel(table_name = organizations)] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[diesel(treat_none_as_null = true)] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[diesel(primary_key(uuid))] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    pub struct Organization { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        pub uuid: OrganizationId, | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -28,6 +29,7 @@ db_object! { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[derive(Identifiable, Queryable, Insertable, AsChangeset)] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[diesel(table_name = users_organizations)] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[diesel(treat_none_as_null = true)] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    #[diesel(primary_key(uuid))] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    pub struct Membership { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        pub uuid: MembershipId, | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |