저는 mysql
을 사용했고 데이터베이스 툴로 DBeaver
를 사용했습니다.
seamless
라는 데이터베이스를 생성하고 users
테이블을 만들어 UserEntity
에서 작성했던 대로 필드를 작성했습니다.
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String email;
private String password;
private String nickname;
private String gender;
private int age;
private LocalDate birthdate;
private LocalDateTime created_at;
private LocalDateTime updated_at;
private int access;
id
필드는 PK(primary key)로 등록해주고 Not Null
과 Auto Increment
옵션을 사용해 null값이 들어오지 못하고 새로운 데이터가 들어올때마다 1씩 증가하게 설정했습니다.
email
, password
, gender
, age
필드를 not null로 두어 반드시 데이터가 들어오게끔 설정해줬습니다.
email
, password
는 회원가입에 기본이 되는 내용이기에 not null을 두었는데 추후 소셜로그인을 사용해게되면 password필드는 not null을 풀어줄 생각입니다.
gender
, age
는 심리상담을 위해 반드시 필요한 내용이라고 들었기에 우선 null이 들어오지 못하게 하고, 추후 소셜로그인을 사용해 얻게 될 나이, 연령대, 생년월일 등 들어오는 데이터에 따라 로직을 수정하고 필드를 수정하여 확실히 잡아 나가겠습니다.
dependencies {
runtimeOnly 'com.mysql:mysql-connector-j'
}
#DB URL
spring.datasource.url=jdbc:mysql://localhost:<포트번호>/<DB이름>?useSSL=false&serverTimezone=UTC
# 계정 이름
spring.datasource.username=<계정명>
# 비밀번호
spring.datasource.password=<비밀번호>
# MYSQL 설정
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/seamless?useSSL=false&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=123456789
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver