Skip to content

Commit

Permalink
Merge pull request #469 from RADAR-base/fix/users
Browse files Browse the repository at this point in the history
Update 'users' unique constraints
  • Loading branch information
mpgxvii committed May 24, 2024
2 parents 885c9cf + 3b62834 commit b722d22
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/org/radarbase/appserver/entity/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
@Table(
name = "users",
uniqueConstraints = {
@UniqueConstraint(columnNames = {"subject_id", "fcm_token", "project_id"})
@UniqueConstraint(columnNames = {"subject_id", "project_id"}),
@UniqueConstraint(columnNames = {"fcm_token"})
})
@Entity
@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public synchronized Map<String, Protocol> fetchProtocols() {
Map<String, Protocol> subjectProtocolMap = users.parallelStream()
.map(u -> this.fetchProtocolForSingleUser(u, u.getProject().getProjectId(), protocolPaths))
.filter(c -> c.getProtocol() != null)
.distinct()
.collect(Collectors.toMap(ProtocolCacheEntry::getId, ProtocolCacheEntry::getProtocol));

log.info("Refreshed Protocols from Github");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
databaseChangeLog:
- changeSet:
id: 1543511610622-8
author: pauline
changes:
- dropUniqueConstraint:
tableName: users
constraintName: UKmm6u3xspqfqoolkjhsvdrqefq
- changeSet:
id: 1716400827373-1
author: pauline
changes:
- addUniqueConstraint:
columnNames: subject_id, project_id
constraintName: UKg6m4nzwvxqpwtrbeynasdcplo
tableName: users

0 comments on commit b722d22

Please sign in to comment.