Add indexes for models in postgres
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
		@@ -147,7 +147,17 @@ WHERE table_name = $1
 | 
			
		||||
            )
 | 
			
		||||
            .map_err(Error::from)?;
 | 
			
		||||
 | 
			
		||||
            // TODO: Create indexes
 | 
			
		||||
            for indexed_field in M::indexed_fields() {
 | 
			
		||||
                tx.execute(
 | 
			
		||||
                    &format!(
 | 
			
		||||
                        "CREATE INDEX {0}_{1}_idx ON {0} ( (value->'{1}') )",
 | 
			
		||||
                        Self::collection_name::<M>(),
 | 
			
		||||
                        indexed_field,
 | 
			
		||||
                    ),
 | 
			
		||||
                    &[],
 | 
			
		||||
                )
 | 
			
		||||
                .map_err(Error::from)?;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            tx.commit().map_err(Error::from)?;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user