agrosner / DBFlow

A blazing fast, powerful, and very simple ORM android database library that writes database code for you.
MIT License
4.87k stars 598 forks source link

Equivalent DROP TABLE #1105

Closed pishguy closed 7 years ago

pishguy commented 7 years ago

in sql command we can use DROP TABLE IF EXISTS how can i use DBFlow to run this command without using StringQuery ?

andro-jedi commented 7 years ago

As I remember there is no such method just use simple code to drop it

 private void dropTables(DatabaseWrapper database, Class... models) {
            for (Class cl : models) {
                ModelAdapter myAdapter = FlowManager.getModelAdapter(cl);
                database.execSQL("DROP TABLE IF EXISTS " + myAdapter.getTableName());
                database.execSQL(myAdapter.getCreationQuery());
            }
        } 
pishguy commented 7 years ago

I found it, you can use Delete.table(s)

D330 commented 6 years ago

Delete.table clear all rows in the table but id ordering not reset.