{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-java/issues/1703","labels_url":"https://api.github.com/repos/realm/realm-java/issues/1703/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-java/issues/1703/comments","events_url":"https://api.github.com/repos/realm/realm-java/issues/1703/events","html_url":"https://github.com/realm/realm-java/issues/1703","id":114244669,"number":1703,"title":"realm file incompatible if model has PrimaryKey","user":{"login":"zaki50","id":406660,"avatar_url":"https://avatars.githubusercontent.com/u/406660?v=3","gravatar_id":"","url":"https://api.github.com/users/zaki50","html_url":"https://github.com/zaki50","followers_url":"https://api.github.com/users/zaki50/followers","following_url":"https://api.github.com/users/zaki50/following{/other_user}","gists_url":"https://api.github.com/users/zaki50/gists{/gist_id}","starred_url":"https://api.github.com/users/zaki50/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zaki50/subscriptions","organizations_url":"https://api.github.com/users/zaki50/orgs","repos_url":"https://api.github.com/users/zaki50/repos","events_url":"https://api.github.com/users/zaki50/events{/privacy}","received_events_url":"https://api.github.com/users/zaki50/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/realm/realm-java/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/realm/realm-java/labels/Pending","name":"Pending","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"cmelchior","id":406066,"avatar_url":"https://avatars.githubusercontent.com/u/406066?v=3","gravatar_id":"","url":"https://api.github.com/users/cmelchior","html_url":"https://github.com/cmelchior","followers_url":"https://api.github.com/users/cmelchior/followers","following_url":"https://api.github.com/users/cmelchior/following{/other_user}","gists_url":"https://api.github.com/users/cmelchior/gists{/gist_id}","starred_url":"https://api.github.com/users/cmelchior/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmelchior/subscriptions","organizations_url":"https://api.github.com/users/cmelchior/orgs","repos_url":"https://api.github.com/users/cmelchior/repos","events_url":"https://api.github.com/users/cmelchior/events{/privacy}","received_events_url":"https://api.github.com/users/cmelchior/received_events","type":"User","site_admin":false},"milestone":null,"comments":12,"created_at":"2015-10-30T10:41:42Z","updated_at":"2015-11-22T13:15:11Z","closed_at":null,"body":"from slack.\r\n\r\nRealm Swift reports an error when opening the realm file generated on Android.\r\n\r\nmodel definition in Java:\r\n\r\n```\r\npublic class DataItem extends RealmObject {\r\n    @PrimaryKey\r\n    private int id;\r\n\r\n    // seter and getter here\r\n}\r\n```\r\n\r\nmodel definition in Swift:\r\n\r\n```\r\nclass DataItem: Object {\r\n    dynamic var id = 0\r\n\r\n    override static func primaryKey() -> String? {\r\n        return \"id\"\r\n    }\r\n}\r\n```\r\n\r\nreported error:\r\n\r\n```\r\nfatal error: 'try!' expression unexpectedly raised an error: Error Domain=io.realm Code=0 \"Migration is required for object type 'DataItem' due to the following errors:\r\n- Property 'id' has been made a primary key.\" UserInfo={NSLocalizedDescription=Migration is required for object type 'DataItem' due to the following errors:\r\n- Property 'id' has been made a primary key.}: file /Library/Caches/com.apple.xbs/Sources/swiftlang_PONDEROSA/swiftlang_PONDEROSA-700.1.101.6/src/swift/stdlib/public/core/ErrorType.swift, line 50\r\n```"},"comment":{"url":"https://api.github.com/repos/realm/realm-java/issues/comments/158758950","html_url":"https://github.com/realm/realm-java/issues/1703#issuecomment-158758950","issue_url":"https://api.github.com/repos/realm/realm-java/issues/1703","id":158758950,"user":{"login":"skyisle","id":71561,"avatar_url":"https://avatars.githubusercontent.com/u/71561?v=3","gravatar_id":"","url":"https://api.github.com/users/skyisle","html_url":"https://github.com/skyisle","followers_url":"https://api.github.com/users/skyisle/followers","following_url":"https://api.github.com/users/skyisle/following{/other_user}","gists_url":"https://api.github.com/users/skyisle/gists{/gist_id}","starred_url":"https://api.github.com/users/skyisle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skyisle/subscriptions","organizations_url":"https://api.github.com/users/skyisle/orgs","repos_url":"https://api.github.com/users/skyisle/repos","events_url":"https://api.github.com/users/skyisle/events{/privacy}","received_events_url":"https://api.github.com/users/skyisle/received_events","type":"User","site_admin":false},"created_at":"2015-11-22T13:15:11Z","updated_at":"2015-11-22T13:15:11Z","body":"@cmelchior Nothing special configuration with single thread environment.  I did some experimenting with this, so I made a sample project to reproduce this issue easily. https://github.com/skyisle/realm-migration-bug"}}