jpa, spring batch meta table들을 활용할때

 

h2 db를 임의로 초기화하고싶을때가 있다. 

 

근데 truncate할때 fk 등등의 제약조건 걸려서 못할때 (개빡침) 하는 방법

 

 

SET REFERENTIAL_INTEGRITY FALSE --제약조건 무효화

SHOW TABLES

TRUNCATE TABLE {TABLE_NAME}

SET REFERENTIAL_INTEGRITY TRUE --제약조건 재설정

 

 

 

 

stackoverflow.com/questions/27045568/h2-how-to-truncate-all-tables

 

H2 - How to truncate all tables?

I assume there is a way of doing this from code, at least some good workaround. Please consider that I do not want to delete all tables (I've seen this command), just to delete rows from them but to

stackoverflow.com

 

+ Recent posts