Skip to content

Commit

Permalink
fix: Fix FamilyScoreEventListnerTest failed error by skip truncating …
Browse files Browse the repository at this point in the history
…flyway table (#214)

Co-authored-by: Kwon770 <sckwon770@gmail.com>
  • Loading branch information
Ji-soo708 and Kwon770 authored Mar 23, 2024
1 parent f8d19bd commit 817487f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gateway/src/test/java/com/oing/event/DatabaseCleaner.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ public void clear() {
private void truncateAllTables() {
entityManager.createNativeQuery(String.format("SET FOREIGN_KEY_CHECKS %d", 0)).executeUpdate();
for (String tableName : tableNames) {
// Don't truncate flyway tables
if(tableName.startsWith("flyway")) continue;

entityManager.createNativeQuery(String.format("TRUNCATE TABLE %s", tableName)).executeUpdate();
}
entityManager.createNativeQuery(String.format("SET FOREIGN_KEY_CHECKS %d", 1)).executeUpdate();
}
}
}

0 comments on commit 817487f

Please sign in to comment.