title: Updating object with primary key not working
body: <p><strong>This is the object I created with primary key username and the error when I try to run the add object code.</strong></p>
  
  <pre><code>class Login_item: Object {
  dynamic var username = String()
  dynamic var password = String()
  
  override static func primaryKey() -&gt; String? {
      return "username"
  }
  </code></pre>
  
  <p>}</p>
  
  <p><strong>This is the code that add new object and update object.</strong></p>
  
  <pre><code>func save_login_info() {
      let new_login_entry = Login_item()
  
      new_login_entry.username = Username.text!
      new_login_entry.password = Password.text!
  
      let realm = try! Realm()
      try! realm.write {
          realm.add(new_login_entry)
          print("Login info save as: \(Realm.Configuration.defaultConfiguration.fileURL!)")
      }
  
      try! realm.write {
          realm.add(new_login_entry, update: true)
      }
  }
  </code></pre>
  
  <p><strong>Error I got when execute the code.</strong></p>
  
  <blockquote>
    <p>fatal error: 'try!' expression unexpectedly raised an error: Error Domain=io.realm Code=10 "Migration is required due to the following errors:
    - Property 'username' has been made a primary key." UserInfo={NSLocalizedDescription=Migration is required due to the following errors:
    - Property 'username' has been made a primary key., Error Code=10}: file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-703.0.18.8/src/swift/stdlib/public/core/ErrorType.swift, line 54</p>
  </blockquote>