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

How to create temp table with DbFlow? #1666

Closed anton8900 closed 3 years ago

anton8900 commented 5 years ago

Do you support temp tables? If yes please explain me how to create and use temp table using DbFlow

agrosner commented 3 years ago

not yet, but will add it

agrosner commented 3 years ago

in develop. use: @Table(..., temporary = true, createWithDatabase = false)

disabling createWithDatabase can ensure on db startup it doesn't get created (if you wish to manually create and drop it)

then to activate it:

  database<MyDatabase> { db ->
            modelAdapter<MyTempModel>().createIfNotExists(db)

            // can drop it later if so wish
            modelAdapter<MyTempModel>().drop(db)
}