Skip to content

Commit 6869352

Browse files
committed
Add composite key for user role to prevent duplication.
1 parent 5405ce1 commit 6869352

File tree

1 file changed

+3
-1
lines changed
  • src/main/java/com/theateam/waaprojectspringbackend/entity

1 file changed

+3
-1
lines changed

src/main/java/com/theateam/waaprojectspringbackend/entity/User.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010
@Entity
1111
@Data
12-
@Table(name = "users")
12+
@Table(name = "users", uniqueConstraints = {
13+
@UniqueConstraint(columnNames = {"user_id", "role_id"})
14+
})
1315
public class User {
1416
@Id
1517
@GeneratedValue(strategy = GenerationType.IDENTITY)

0 commit comments

Comments
 (0)