KEYCLOAK-5162 Add index to even table

This commit is contained in:
stianst 2020-03-17 12:12:18 +01:00 committed by Hynek Mlnařík
parent 84d099e48f
commit aece5d1b4c
2 changed files with 9 additions and 1 deletions

View file

@ -45,4 +45,12 @@
<addUniqueConstraint columnNames="REALM_ID,PARENT_GROUP,NAME" constraintName="SIBLING_NAMES" tableName="KEYCLOAK_GROUP"/>
</changeSet>
<changeSet author="keycloak" id="9.0.1-add-index-to-events">
<createIndex indexName="IDX_EVENT_TIME" tableName="EVENT_ENTITY">
<column name="REALM_ID" type="VARCHAR(255)"/>
<column name="EVENT_TIME" type="BIGINT"/>
</createIndex>
</changeSet>
</databaseChangeLog>

View file

@ -295,7 +295,7 @@ public class AccountFormService extends AbstractSecuredLocalService {
}
if (auth != null) {
List<Event> events = eventStore.createQuery().type(Constants.EXPOSED_LOG_EVENTS).user(auth.getUser().getId()).maxResults(30).getResultList();
List<Event> events = eventStore.createQuery().type(Constants.EXPOSED_LOG_EVENTS).realm(auth.getRealm().getId()).user(auth.getUser().getId()).maxResults(30).getResultList();
for (Event e : events) {
if (e.getDetails() != null) {
Iterator<Map.Entry<String, String>> itr = e.getDetails().entrySet().iterator();