{"action":"created","issue":{"url":"https://api.github.com/repos/yahoo/squidb/issues/16","labels_url":"https://api.github.com/repos/yahoo/squidb/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/yahoo/squidb/issues/16/comments","events_url":"https://api.github.com/repos/yahoo/squidb/issues/16/events","html_url":"https://github.com/yahoo/squidb/issues/16","id":73869513,"number":16,"title":"DatabaseDao - method to clear table","user":{"login":"LukaszGrela","id":7643591,"avatar_url":"https://avatars.githubusercontent.com/u/7643591?v=3","gravatar_id":"","url":"https://api.github.com/users/LukaszGrela","html_url":"https://github.com/LukaszGrela","followers_url":"https://api.github.com/users/LukaszGrela/followers","following_url":"https://api.github.com/users/LukaszGrela/following{/other_user}","gists_url":"https://api.github.com/users/LukaszGrela/gists{/gist_id}","starred_url":"https://api.github.com/users/LukaszGrela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LukaszGrela/subscriptions","organizations_url":"https://api.github.com/users/LukaszGrela/orgs","repos_url":"https://api.github.com/users/LukaszGrela/repos","events_url":"https://api.github.com/users/LukaszGrela/events{/privacy}","received_events_url":"https://api.github.com/users/LukaszGrela/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-07T06:48:47Z","updated_at":"2015-05-07T06:58:11Z","closed_at":"2015-05-07T06:58:11Z","body":"I wasn't able to find a quick \"clear table\" method, I've found this to work in that fashion:\r\n\r\n\r\n        Criterion everywhere = Todo.ID.isNotNull();\r\n        app.todosDao().deleteWhere(Todo.class, everywhere);\r\n\r\nis it useful wrapped as a public method of `DatabaseDao` \r\n\r\n\r\n    /**\r\n     * Delete all rows in the given {@Link TableModel} table\r\n     * \r\n     * @param modelClass the model class corresponding to the table to delete from\r\n     * @return the number of rows deleted on success, -1 on failure\r\n     */\r\n    public int deleteAll(Class<? extends TableModel> modelClass){\r\n        return deleteWhere(modelClass, TableModel.ID_PROPERTY.isNotNull());\r\n    }"},"comment":{"url":"https://api.github.com/repos/yahoo/squidb/issues/comments/99749342","html_url":"https://github.com/yahoo/squidb/issues/16#issuecomment-99749342","issue_url":"https://api.github.com/repos/yahoo/squidb/issues/16","id":99749342,"user":{"login":"jdkoren","id":771156,"avatar_url":"https://avatars.githubusercontent.com/u/771156?v=3","gravatar_id":"","url":"https://api.github.com/users/jdkoren","html_url":"https://github.com/jdkoren","followers_url":"https://api.github.com/users/jdkoren/followers","following_url":"https://api.github.com/users/jdkoren/following{/other_user}","gists_url":"https://api.github.com/users/jdkoren/gists{/gist_id}","starred_url":"https://api.github.com/users/jdkoren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdkoren/subscriptions","organizations_url":"https://api.github.com/users/jdkoren/orgs","repos_url":"https://api.github.com/users/jdkoren/repos","events_url":"https://api.github.com/users/jdkoren/events{/privacy}","received_events_url":"https://api.github.com/users/jdkoren/received_events","type":"User","site_admin":false},"created_at":"2015-05-07T06:58:11Z","updated_at":"2015-05-07T06:58:11Z","body":"You can use `databaseDao.deleteWhere(Model.class, Criterion.all);` to delete all the rows."}}