title: Realm - Delete objects from realm in migration block
body: <p>I need to delete objects from a realm during a migration.</p>
  
  <p>I have an AccountManager which contains :</p>
  
  <pre><code>func logOut() {
      let realm = try! Realm()
      try! realm.write {
          realm.delete(realm.objects(Account.self))
          realm.delete(realm.objects(Address.self))
          ... // Other deletions
      }
  }
  </code></pre>
  
  <p>But whenever I use the logOut() function in a migration block it just fails.</p>
  
  <pre><code>    let config = Realm.Configuration(
          schemaVersion: 11,
          migrationBlock: { migration, oldSchemaVersion in
              if (oldSchemaVersion &lt; 11) {
                  // Delete objects from realm
                  AccountManager().logOut() // DOESN'T WORK
              }
      })
  
      Realm.Configuration.defaultConfiguration = config
  </code></pre>
  
  <p>I absolutely need users to relog after this update - Is there any way I could perform these deletions in a migration block ?</p>