Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: MYSQL 도커 설정 #7

Merged
merged 1 commit into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions ticket/docker/db/mysql/init/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
create database if not exists ticket;

use ticket;

create table if not exists member
(
id bigint not null auto_increment,
name varchar(255),
primary key (id)
) engine = InnoDB;

create table if not exists member_ticket
(
id bigint not null auto_increment,
member_id bigint,
ticket_id bigint,
primary key (id)
) engine = InnoDB;

create table if not exists ticket
(
id bigint not null auto_increment,
quantity bigint,
name varchar(255),
primary key (id)
) engine = InnoDB;

alter table member_ticket
add constraint FKomlguxfcardby8919wyyaxcw3
foreign key (member_id)
references member (id);

alter table member_ticket
add constraint FK4ri79r4gubettxo63roi3ksfj
foreign key (ticket_id)
references ticket (id);
17 changes: 17 additions & 0 deletions ticket/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: "3.9"
services:
db:
image: mysql:8.0.28
platform: linux/x86_64
restart: always
ports:
- "13306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: ticket
MYSQL_ROOT_USER: root
MYSQL_PASSWORD: root
TZ: Asia/Seoul
volumes:
- ./db/mysql/data:/var/lib/mysql
- ./db/mysql/init/schema.sql:/docker-entrypoint-initdb.d/schema.sql
1 change: 0 additions & 1 deletion ticket/src/main/resources/application.properties

This file was deleted.

14 changes: 14 additions & 0 deletions ticket/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:13306/ticket?useSSL=false&serverTimezone=Asia/Seoul&characterEncoding=UTF-8&allowPublicKeyRetrieval=true
username: root
password: root

jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL8Dialect
format_sql: true
show_sql: true
hbm2ddl.auto: validate