{"action":"created","issue":{"url":"https://api.github.com/repos/Oyvindkg/swiftydb/issues/28","repository_url":"https://api.github.com/repos/Oyvindkg/swiftydb","labels_url":"https://api.github.com/repos/Oyvindkg/swiftydb/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/Oyvindkg/swiftydb/issues/28/comments","events_url":"https://api.github.com/repos/Oyvindkg/swiftydb/issues/28/events","html_url":"https://github.com/Oyvindkg/swiftydb/issues/28","id":175934768,"number":28,"title":"BUG. [addObjects] add some different object","user":{"login":"izouxv","id":1646763,"avatar_url":"https://avatars.githubusercontent.com/u/1646763?v=3","gravatar_id":"","url":"https://api.github.com/users/izouxv","html_url":"https://github.com/izouxv","followers_url":"https://api.github.com/users/izouxv/followers","following_url":"https://api.github.com/users/izouxv/following{/other_user}","gists_url":"https://api.github.com/users/izouxv/gists{/gist_id}","starred_url":"https://api.github.com/users/izouxv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/izouxv/subscriptions","organizations_url":"https://api.github.com/users/izouxv/orgs","repos_url":"https://api.github.com/users/izouxv/repos","events_url":"https://api.github.com/users/izouxv/events{/privacy}","received_events_url":"https://api.github.com/users/izouxv/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Oyvindkg/swiftydb/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/Oyvindkg/swiftydb/labels/wontfix","name":"wontfix","color":"ffffff"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-09T06:04:41Z","updated_at":"2016-09-09T08:18:20Z","closed_at":null,"body":"    \r\n    public func addObjects <S: Storable> (objects: [S], update: Bool = true) -> Result<Bool> {\r\n        guard objects.count > 0 else {\r\n            return Result.Success(true)\r\n        }\r\n        \r\n        do {\r\n            if !(try tableExistsForType(S)) {\r\n                //!!! BUG !!! , if objects is different model, they have different table, \r\n                createTableForTypeRepresentedByObject(objects.first!)\r\n            }\r\n            \r\n            let insertStatement = StatementGenerator.insertStatementForType(S.self, update: update)\r\n            \r\n      \r\n            try databaseQueue.transaction { (database) -> Void in\r\n                let statement = try database.prepare(insertStatement)\r\n                \r\n                defer {\r\n                    /* If an error occurs, try to finalize the statement */\r\n                    let _ = try? statement.finalize()\r\n                }\r\n                \r\n                for object in objects {\r\n                    let data = self.dataFromObject(object)\r\n                    try statement.executeUpdate(data)\r\n                }\r\n            }\r\n        } catch let error {\r\n            return Result.Error(error)\r\n        }\r\n        \r\n        return Result.Success(true)\r\n    }"},"comment":{"url":"https://api.github.com/repos/Oyvindkg/swiftydb/issues/comments/245849861","html_url":"https://github.com/Oyvindkg/swiftydb/issues/28#issuecomment-245849861","issue_url":"https://api.github.com/repos/Oyvindkg/swiftydb/issues/28","id":245849861,"user":{"login":"Oyvindkg","id":1858790,"avatar_url":"https://avatars.githubusercontent.com/u/1858790?v=3","gravatar_id":"","url":"https://api.github.com/users/Oyvindkg","html_url":"https://github.com/Oyvindkg","followers_url":"https://api.github.com/users/Oyvindkg/followers","following_url":"https://api.github.com/users/Oyvindkg/following{/other_user}","gists_url":"https://api.github.com/users/Oyvindkg/gists{/gist_id}","starred_url":"https://api.github.com/users/Oyvindkg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Oyvindkg/subscriptions","organizations_url":"https://api.github.com/users/Oyvindkg/orgs","repos_url":"https://api.github.com/users/Oyvindkg/repos","events_url":"https://api.github.com/users/Oyvindkg/events{/privacy}","received_events_url":"https://api.github.com/users/Oyvindkg/received_events","type":"User","site_admin":false},"created_at":"2016-09-09T08:18:20Z","updated_at":"2016-09-09T08:18:20Z","body":"You are correct. Thanks for pointing it out. \r\n\r\nThis is fixed in the upcoming v2.0.\r\n\r\nAn initial description can be found here: https://github.com/Oyvindkg/swiftydb/blob/swiftydb-2.0-dev/README.md"}}
{"actor":{"display_login":"Oyvindkg"}}