fix(gift): 카테고리 접수 코드 중복을 허용한다
This commit is contained in:
@@ -126,3 +126,5 @@ CREATE TABLE gift_application_no_sequence (
|
||||
UNIQUE KEY uk_gift_application_no_sequence_category_date (category_id, sequence_date),
|
||||
CONSTRAINT fk_gift_application_no_sequence_category FOREIGN KEY (category_id) REFERENCES gift_category (id)
|
||||
) COMMENT='선물 신청번호 날짜별 채번';
|
||||
|
||||
ALTER TABLE gift_category DROP INDEX uk_gift_category_receipt_code;
|
||||
|
||||
+1
-2
@@ -11,8 +11,7 @@ import javax.persistence.UniqueConstraint
|
||||
name = "gift_category",
|
||||
uniqueConstraints = [
|
||||
UniqueConstraint(name = "uk_gift_category_classification_number", columnNames = ["classification_number"]),
|
||||
UniqueConstraint(name = "uk_gift_category_code", columnNames = ["category_code"]),
|
||||
UniqueConstraint(name = "uk_gift_category_receipt_code", columnNames = ["receipt_code"])
|
||||
UniqueConstraint(name = "uk_gift_category_code", columnNames = ["category_code"])
|
||||
]
|
||||
)
|
||||
class GiftCategory(
|
||||
|
||||
+11
-4
@@ -92,7 +92,7 @@ class GiftEntityMappingTest @Autowired constructor(
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("신청번호와 카테고리 unique 값과 리뷰 선물 ID는 중복 저장할 수 없다")
|
||||
@DisplayName("신청번호와 카테고리 분류번호 및 코드와 리뷰 선물 ID는 중복 저장할 수 없다")
|
||||
fun shouldRejectDuplicateUniqueValues() {
|
||||
val category = giftCategoryRepository.save(giftCategory("100", "DOLL", "A"))
|
||||
val gift = giftRepository.save(gift(category.id!!, "G20260929000001"))
|
||||
@@ -108,14 +108,21 @@ class GiftEntityMappingTest @Autowired constructor(
|
||||
assertThrows(DataIntegrityViolationException::class.java) {
|
||||
giftCategoryRepository.saveAndFlush(giftCategory("100", "TOY", "B"))
|
||||
}
|
||||
assertThrows(DataIntegrityViolationException::class.java) {
|
||||
giftCategoryRepository.saveAndFlush(giftCategory("101", "TOY", "A"))
|
||||
}
|
||||
assertThrows(DataIntegrityViolationException::class.java) {
|
||||
giftReviewRepository.saveAndFlush(GiftReview(giftId = gift.id!!, senderMemberId = 1L, rating = 4))
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("카테고리 접수 코드는 중복 저장할 수 있다")
|
||||
fun shouldAllowDuplicateReceiptCode() {
|
||||
val first = giftCategoryRepository.saveAndFlush(giftCategory("100", "DOLL", "A"))
|
||||
val second = giftCategoryRepository.saveAndFlush(giftCategory("101", "TOY", "A"))
|
||||
|
||||
assertNotNull(first.id)
|
||||
assertNotNull(second.id)
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("카테고리와 날짜별 신청번호 채번 sequence를 저장한다")
|
||||
fun shouldSaveApplicationNoSequence() {
|
||||
|
||||
Reference in New Issue
Block a user