-
Notifications
You must be signed in to change notification settings - Fork 20
Application local 실행
Jungseok Sung edited this page Jul 13, 2023
·
2 revisions
각자의 OS 에 맞는 mysql 도커 이미지 pull 해서 사용
docker run --name zzimkkong-mysql -e MYSQL_ROOT_PASSWORD=1234 -d -p 13306:3306 -v zzimkkong-mysql-volume:/var/lib/mysql {docker_image_name:tag}
# MAC m1 기준 예시
docker run --name zzimkkong-mysql -e MYSQL_ROOT_PASSWORD=1234 -d -p 13306:3306 -v zzimkkong-mysql-volume:/var/lib/mysql arm64v8/mysql
docker exec -it zzimkkong-mysql /bin/bash
# 컨테이너 내부 (비번 1234)
mysql -u root -p
-
mysql>
이 나오면서 로그인 성공하면 아래 sql 구문 실행
# 20230713 기준 PROD 환경 DDL
create database zzimkkong;
create table zzimkkong.member
(
id bigint auto_increment
primary key,
email varchar(50) not null,
password varchar(128) null,
organization varchar(20) null,
oauth_provider varchar(10) null,
user_name varchar(20) not null,
emoji varchar(255) not null,
constraint email
unique (email),
constraint user_name
unique (user_name)
);
create table zzimkkong.map
(
id bigint auto_increment
primary key,
map_drawing longtext not null,
thumbnail longtext not null,
name varchar(20) not null,
member_id bigint not null,
slack_url longtext null,
notice longtext null,
constraint map_ibfk_1
foreign key (member_id) references zzimkkong.member (id)
);
create index member_id
on zzimkkong.map (member_id);
create table zzimkkong.preset
(
id bigint auto_increment
primary key,
name varchar(20) not null,
setting_start_time time not null,
setting_end_time time not null,
reservation_time_unit int not null,
reservation_minimum_time_unit int not null,
reservation_maximum_time_unit int not null,
enabled_day_of_week varchar(255) null,
member_id bigint not null,
constraint preset_ibfk_1
foreign key (member_id) references zzimkkong.member (id)
);
create index manager_id
on zzimkkong.preset (member_id);
create table zzimkkong.space
(
id bigint auto_increment
primary key,
area varchar(255) not null,
color varchar(25) null,
name varchar(20) not null,
reservation_enable bit not null,
map_id bigint not null,
constraint space_ibfk_1
foreign key (map_id) references zzimkkong.map (id)
);
create index map_id
on zzimkkong.space (map_id);
create table zzimkkong.reservation
(
id bigint auto_increment
primary key,
description varchar(100) not null,
start_time datetime not null,
end_time datetime not null,
password varchar(4) null,
user_name varchar(20) not null,
space_id bigint not null,
date date not null,
member_id bigint null,
constraint fk_reservation_member
foreign key (member_id) references zzimkkong.member (id),
constraint reservation_ibfk_1
foreign key (space_id) references zzimkkong.space (id)
)
collate = utf8mb4_unicode_ci;
create index i_memberid_date
on zzimkkong.reservation (member_id, date);
create index i_spaceid_date
on zzimkkong.reservation (space_id, date);
create index i_username_date
on zzimkkong.reservation (user_name, date);
create index space_id
on zzimkkong.reservation (space_id);
create table zzimkkong.setting
(
id bigint auto_increment
primary key,
space_id bigint not null,
enabled_day_of_week varchar(255) null,
setting_start_time time not null,
setting_end_time time not null,
reservation_maximum_time_unit int not null,
reservation_minimum_time_unit int not null,
reservation_time_unit int not null,
constraint setting_ibfk_1
foreign key (space_id) references zzimkkong.space (id)
);
create index space_id
on zzimkkong.setting (space_id);
/~https://github.com/zzimkkong/db_backup_prod
위 링크에서 최신 dump sql 파일 다운로드 받아서 실행 (위 database, table 생성과 동일하게 mysql 로그인한 상태에서) 해당 organization에 접근 권한이 없다면 zzimkkong 팀에 요청
Application을 local 에서 실행한지 아주아주 오래되어 local 관련 코드는 outdated 된 부분이 좀 있다 (보통 로컬에서는 테스트만 돌리고 바로 dev 환경에 올려서 UI 활용한 테스트로 넘어감). 따라서 로컬 관련 코드는 추후 수정/반영 필요.
spring.jpa.hibernate.ddl-auto=validate
- Bean 등록 해제 (@Component 주석 처리)
- 원래 local 실행 시, 자동으로 더미데이터를 넣어주는 목적으로 사용되었음.
- 로컬 실행을 점점 안하게 되면서 outdated 됨.