How could I know if a database table is exists in ScalaQuery

前端 未结 6 934
日久生厌
日久生厌 2020-12-29 13:15

I\'m trying ScalaQuery, it is really amazing. I could defined the database table using Scala class, and query it easily.

But I would like to know, in the following c

6条回答
  •  一整个雨季
    2020-12-29 13:53

    This thread is a bit old, but maybe someone will find this useful. All my DAOs include this:

    def create = db withSession {
        if (!MTable.getTables.list.exists(_.name.name == MyTable.tableName))
            MyTable.ddl.create
    }
    

提交回复
热议问题