Skip to content

Commit

Permalink
properly creating index only if it doesn't already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
antleb committed Jan 23, 2025
1 parent 665c570 commit 146a06e
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ public void postInit() {
"exectime int default 0 not null," +
"profile varchar(100) not null)");

boolean indexExists = jdbcTemplate.queryForObject("select count(*) from INFORMATION_SCHEMA.SYSTEM_INDEXINFO where table_name='cache_entry' and index_name='key_idx'", Integer.class) == 1;

if (!indexExists)
jdbcTemplate.execute("create index key_idx on cache_entry(key)");
jdbcTemplate.execute("create index if not exists key_idx on cache_entry(key)");
}

@Override
Expand Down

0 comments on commit 146a06e

Please sign in to comment.