Reset Embedded H2 database periodically

前端 未结 6 1129
青春惊慌失措
青春惊慌失措 2021-02-01 13:17

I\'m setting up a new version of my application in a demo server and would love to find a way of resetting the database daily. I guess I can always have a cron job executing dro

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-01 13:46

    H2 supports a special SQL statement to drop all objects:

    DROP ALL OBJECTS [DELETE FILES]
    

    If you don't want to drop all tables, you might want to use truncate table:

    TRUNCATE TABLE 
    

提交回复
热议问题