Skip to content

Commit

Permalink
[BE] refactor: Flyway 스크립트 V1으로 마이그레이션 및 엔티티 컬럼 반영 (#852) (#853)
Browse files Browse the repository at this point in the history
* refactor: Flyway 스크립트 V1으로 마이그레이션 및 엔티티 컬럼 반영

* fix: Member 엔티티 SQLDelete 반영

* fix: ticketing-test-data.sql 컬럼명 수정 반영

* feat: 서브모듈 업데이트
  • Loading branch information
seokjin8678 authored Apr 10, 2024
1 parent 6e04901 commit 907e33c
Show file tree
Hide file tree
Showing 26 changed files with 260 additions and 362 deletions.
2 changes: 2 additions & 0 deletions backend/src/main/java/com/festago/artist/domain/Artist.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.festago.artist.domain;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
Expand All @@ -19,6 +20,7 @@ public class Artist {

private String name;

@Column(name = "profile_image_url")
private String profileImage;

private String backgroundImageUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(
name = "bookmark",
uniqueConstraints = {
@UniqueConstraint(
name = "UNIQUE_BOOKMARK_TYPE_RESOURCE_ID_MEMBER_ID",
columnNames = {"bookmark_type", "resource_id", "member_id"}
)
}
Expand Down
15 changes: 14 additions & 1 deletion backend/src/main/java/com/festago/fcm/domain/MemberFCM.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,27 @@

import com.festago.common.domain.BaseTimeEntity;
import com.festago.common.util.Validator;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.UniqueConstraint;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

@Entity
@Table(name = "member_fcm")
@Table(
name = "member_fcm",
uniqueConstraints = {
@UniqueConstraint(
columnNames = {
"member_id",
"fcm_token"
}
)
})
public class MemberFCM extends BaseTimeEntity {

private static final int MAX_FCM_TOKEN_LENGTH = 255;
Expand All @@ -21,10 +32,12 @@ public class MemberFCM extends BaseTimeEntity {
private Long id;

@NotNull
@Column(name = "member_id")
private Long memberId;

@NotNull
@Size(max = MAX_FCM_TOKEN_LENGTH)
@Column(name = "fcm_token")
private String fcmToken;

protected MemberFCM() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.festago.common.exception.ErrorCode;
import com.festago.common.util.Validator;
import com.festago.school.domain.School;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
Expand Down Expand Up @@ -42,6 +43,7 @@ public class Festival extends BaseTimeEntity {

@NotNull
@Size(max = MAX_THUMBNAIL_LENGTH)
@Column(name = "poster_image_url")
private String thumbnail;

@NotNull
Expand Down
11 changes: 7 additions & 4 deletions backend/src/main/java/com/festago/member/domain/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.festago.auth.domain.SocialType;
import com.festago.common.domain.BaseTimeEntity;
import com.festago.common.util.Validator;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
Expand All @@ -21,15 +22,14 @@
import org.springframework.util.StringUtils;

@Entity
@SQLDelete(sql = "UPDATE member SET deleted_at = now(), nickname = '탈퇴한 회원', profile_image = '', social_id = null WHERE id=?")
@SQLDelete(sql = "UPDATE member SET deleted_at = now(), nickname = '탈퇴한 회원', profile_image_url = '', social_id = null WHERE id=?")
@Where(clause = "deleted_at is null")
@Table(
uniqueConstraints = {
@UniqueConstraint(
name = "SOCIAL_UNIQUE",
columnNames = {
"socialId",
"socialType"
"social_id",
"social_type"
}
)
}
Expand All @@ -47,10 +47,12 @@ public class Member extends BaseTimeEntity {
private Long id;

@Size(max = MAX_SOCIAL_ID_LENGTH)
@Column(name = "social_id")
private String socialId;

@NotNull
@Enumerated(value = EnumType.STRING)
@Column(name = "social_type")
private SocialType socialType;

@NotNull
Expand All @@ -59,6 +61,7 @@ public class Member extends BaseTimeEntity {

@NotNull
@Size(max = MAX_PROFILE_IMAGE_LENGTH)
@Column(name = "profile_image_url")
private String profileImage;

private LocalDateTime deletedAt = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class School extends BaseTimeEntity {

private String logoUrl;

@Column(name = "background_image_url")
private String backgroundUrl;

@Enumerated(EnumType.STRING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
name = "social_media",
uniqueConstraints = {
@UniqueConstraint(
name = "UNIQUE_OWNERTYPE_OWNERID",
columnNames = {"owner_id", "owner_type", "media_type"}
columnNames= {"owner_id", "owner_type", "media_type"}
)
}
)
Expand Down
2 changes: 1 addition & 1 deletion backend/src/main/resources/config
33 changes: 0 additions & 33 deletions backend/src/main/resources/db/migration/V10__artist_with_etc.sql

This file was deleted.

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions backend/src/main/resources/db/migration/V13__add_socialmedia.sql

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions backend/src/main/resources/db/migration/V17__add_bookmark.sql

This file was deleted.

Loading

0 comments on commit 907e33c

Please sign in to comment.