way to truncate tables after tests #3909
Replies: 4 comments 25 replies
-
The one thing I do worry about is sequences. Many databases do offer a means to reset them, but I doubt all do. I guess worst case we just drop/create the sequences. Also, the general interpretation for "create" in Hibernate is really "drop and create". "create-drop" simply adds a drop at SF close also. I only point this out because it is a deviation from the normal for that term and we need to be explicit about that - because "drop-create-truncate" is obviously pointless. |
Beta Was this translation helpful? Give feedback.
-
Actually, do you folks think that a reason to not do this is that somebody will someday leave this setting turned on when deploying to production, and Hibernate's database user will have the permissions to do the |
Beta Was this translation helpful? Give feedback.
-
OK, so this has grown into a whole What's there right now is still a little unfinished, lacking:
|
Beta Was this translation helpful? Give feedback.
-
After all that, I ended up going back to my original idea of making this a part of the schema export framework, but only available via the new API. And I ended up throwing away the code of But I'm very happy with it now. |
Beta Was this translation helpful? Give feedback.
-
I think we should add a schema export mode,
create-truncate
, or whatever, that deletes all the data without actually dropping the tables. This would be very helpful for testing on databases where DDL execution is slow.(Of course there's other ways we could provide this functionality, but I'm not a fan of having a
truncate()
method onSession
.)Beta Was this translation helpful? Give feedback.
All reactions