You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add the ability to compare existing index definitions to the projected one for a type (#479)
* feat: Add the ability to compare existing index definitions to the projected one for a type.
* fix(ci): docker-compose should now be docker compose (v2)
* adding `IsIndexCurrent` and tests
---------
Co-authored-by: James Abbott <james.abbott@crispthinking.com>
Co-authored-by: slorello89 <steve.lorello@redis.com>
Redis OM provides limited support for schema migration at this time. You can check if the index definition in Redis matches your current index definition using the `IsIndexCurrent` method on the `RedisConnection`. Then you may use that output to determine when to re-create your indexes when your types change. An example implementation of this would look like:
There are two methods for indexing embedded documents with Redis.OM, an embedded document is a complex object, e.g. if our `Customer` model had an `Address` property with the following model:
Copy file name to clipboardExpand all lines: src/Redis.OM/Modeling/RedisIndex.cs
+67-1Lines changed: 67 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
usingSystem;
2
2
usingSystem.Collections.Generic;
3
+
usingSystem.Linq;
3
4
usingRedis.OM;
4
5
usingRedis.OM.Modeling;
5
6
@@ -8,8 +9,73 @@ namespace Redis.OM.Modeling
8
9
/// <summary>
9
10
/// A utility class for serializing objects into Redis Indices.
10
11
/// </summary>
11
-
internalstaticclassRedisIndex
12
+
publicstaticclassRedisIndex
12
13
{
14
+
/// <summary>
15
+
/// Verifies whether the given index schema definition matches the current definition.
16
+
/// </summary>
17
+
/// <param name="redisIndexInfo">The index definition.</param>
18
+
/// <param name="type">The type to be indexed.</param>
19
+
/// <returns>A bool indicating whether the current index definition has drifted from the current definition, which may be used to determine when to re-create an index..</returns>
0 commit comments