Adding Indexes to Existing Properties: Safe?

Suppose I have an app that uses Realm and Atlas Device Sync. This app has a model object:

final class Foo: Object
{
   @Persisted var name: String = ""
}

There are 900,000 of these objects in the database. Is it possible for me to add an index to this property without any schema problems, sync failures, or migrations? Can I simply change the declaration to this:

@Persisted(indexed: true) var name: String = ""

If I cannot do this, what is the process for adding an index to an already-existent property?

1 Like