Skip to content

Commit

Permalink
feat: H2 동작하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
wonjun0120 committed Jul 4, 2024
1 parent 73c8706 commit 3298f46
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-validation'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public abstract class BaseEntity {
@Column(name = "updated_at")
private LocalDateTime updatedAt;

@Column(name = "deleted", nullable = false, columnDefinition = "bit(1) default 0")
@Column(name = "deleted", nullable = false)
private Boolean isDeleted = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table(name="Users")
public class User extends BaseEntity {

@Id
Expand Down
30 changes: 24 additions & 6 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ${MYSQL_DATABASE}
username: ${MYSQL_USER}
password: ${MYSQL_PASSWORD}

# driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://localhost:3306/spot?useSSL=false&allowPublicKeyRetrieval=true
url: jdbc:h2:mem:spotdb
username: root
password:
driver-class-name: org.h2.Driver
h2:
console:
enabled: true
path: /h2-console
jpa:
hibernate:
ddl-auto: update
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
show-sql: true
properties:
hibernate.dialect: org.hibernate.dialect.MySQLDialect
hibernate:
dialect: org.hibernate.dialect.H2Dialect
format_sql: true
show_sql: true
# properties:
# hibernate.dialect: org.hibernate.dialect.MySQLDialect
# jpa:
# hibernate:
# ddl-auto: update
# naming:
# physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
# show-sql: true
# properties:
# hibernate.dialect: org.hibernate.dialect.MySQLDialect

0 comments on commit 3298f46

Please sign in to comment.