Skip to content

Commit

Permalink
fix: entity 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
12xii committed Oct 4, 2023
1 parent 434708e commit 37f2c46
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package kr.hs.dsm.inq.domain.question.persistence

import javax.persistence.*

@Table(name = "tbl_problem")
@Entity
data class Problem (
@Id
@Column(columnDefinition = "BIGINT", nullable = false)
val id: Long = 0L,

@Column(columnDefinition = "VARCHAR(30)", nullable = false)
@Enumerated(EnumType.STRING)
val type: ProblemType
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ class QuestionSets (
@Column(columnDefinition = "DATETIME(6)", nullable = false, updatable = false)
var createdAt: LocalDateTime = LocalDateTime.now(),

@Column(columnDefinition = "INT", nullable = false)
var answerCount: Int,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "post_id", columnDefinition = "BIGINT",nullable = false)
var postId: Post,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "problem_id", columnDefinition = "BITINT", nullable = false)
var problemId: Problem,
)
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,10 @@ class QuestionSolvingHistory (
@JoinColumn(name = "user_id", columnDefinition = "BIGINT", nullable = false)
var userId: User,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "question_id", columnDefinition = "BIGINT")
var questionId: Questions,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "question_set_id", columnDefinition = "BIGINT",)
var questionSetID: QuestionSets,

@Column(columnDefinition = "VARCHAR(30)")
@Enumerated(EnumType.STRING)
var type: ProblemType,

@Column(columnDefinition = "DATETIME(6)", nullable = false)
var solvedAt: LocalDateTime = LocalDateTime.now(),

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "problem", columnDefinition = "BIGINT", nullable = false)
var problem: Problem
)
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ data class Questions(
var category: Category,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "author_id", columnDefinition = "VARCHAR(1000)", nullable = false)
@JoinColumn(name = "author_id", columnDefinition = "BIGINT", nullable = false)
var author: User,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "problem_id", columnDefinition = "BIGINT", nullable = false)
var problem: Problem,

@Column(nullable = false, updatable = false, columnDefinition = "DATETIME(6)")
val createdAt: LocalDateTime = LocalDateTime.now()

Expand Down

0 comments on commit 37f2c46

Please sign in to comment.