Room persistance library. Delete all

How can I delete all entries on specific table using Room Persistence Library? I need to drop table, but I cannot to find any information how to do this.

Only when database is migrating or to load all entries and delete them 🙂

Answer

You can create a DAO method to do this.

@Dao 
interface MyDao {
    @Query("DELETE FROM myTableName")
    public void nukeTable();
}

Leave a Reply

Your email address will not be published. Required fields are marked *