@@ -188,6 +188,24 @@ .. GenerateFollowerCachingChanges(oldState, newState, db => db.Tables, "Table",
188188 .. GenerateFollowerCachingChanges ( oldState , newState , db => db . MaterializedViews , "MV" , "materialized-view" ) ,
189189
190190 ] ;
191+
192+ if ( oldState . Permissions . ModificationKind != newState . Permissions . ModificationKind )
193+ {
194+ var kind = newState . Permissions . ModificationKind . ToString ( ) . ToLower ( ) ;
195+ result . Add ( new BasicChange ( "FollowerDatabase" , "PermissionsModificationKind" , $ "From { oldState . Permissions . ModificationKind } to { newState . Permissions . ModificationKind } ", new List < DatabaseScriptContainer >
196+ {
197+ new DatabaseScriptContainer ( new DatabaseScript ( $ ".alter follower database { newState . DatabaseName } principals-modification-kind = { kind } ", 0 ) , "FollowerChangePolicyModificationKind" )
198+ } ) ) ;
199+ }
200+ if ( oldState . Cache . ModificationKind != newState . Cache . ModificationKind )
201+ {
202+ var kind = newState . Cache . ModificationKind . ToString ( ) . ToLower ( ) ;
203+ result . Add ( new BasicChange ( "FollowerDatabase" , "ChangeModificationKind" , $ "From { oldState . Cache . ModificationKind } to { newState . Cache . ModificationKind } ", new List < DatabaseScriptContainer >
204+ {
205+ new DatabaseScriptContainer ( new DatabaseScript ( $ ".alter follower database { newState . DatabaseName } caching-policies-modification-kind = { kind } ", 0 ) , "FollowerChangePolicyModificationKind" )
206+ } ) ) ;
207+ }
208+
191209 if ( oldState . Cache . DefaultHotCache != newState . Cache . DefaultHotCache )
192210 {
193211 if ( newState . Cache . DefaultHotCache != null )
@@ -208,41 +226,6 @@ .. GenerateFollowerCachingChanges(oldState, newState, db => db.MaterializedViews
208226
209227 return result ;
210228
211-
212-
213- /*
214- * public class FollowerDatabase
215- {
216- public required string DatabaseName { get; set; }
217- public FollowerCache Cache { get; set; } = new FollowerCache();
218- public FollowerPermissions Permissions { get; set; } = new FollowerPermissions();
219- }
220-
221- public class FollowerPermissions
222- {
223- public FollowerModificationKind? ModificationKind { get; set; }
224- public List<AADObject> Viewers { get; set; } = new List<AADObject>();
225- public List<AADObject> Admins { get; set; } = new List<AADObject>();
226- }
227-
228- public class FollowerCache
229- {
230- public string? DefaultHotCache { get; set; }
231- public FollowerModificationKind? ModificationKind { get; set; }
232- public Dictionary<string, string> Tables { get; set; } = new Dictionary<string, string>();
233- public Dictionary<string, string> MaterializedViews { get; set; } = new Dictionary<string, string>();
234- }
235-
236- public enum FollowerModificationKind
237- {
238- None,
239- Union,
240- Replace
241- }
242- */
243-
244-
245- return result ;
246229 }
247230
248231 private static List < IChange > GenerateFollowerCachingChanges ( FollowerDatabase oldState , FollowerDatabase newState , Func < FollowerCache , Dictionary < string , string > > selector , string type , string kustoType )
0 commit comments