Day 103

ChangWoo·2023년 1월 31일
0

중앙 HTA

목록 보기
47/51

1. ERM 수정

  • 기존의 ERM에서 팀 프로젝트에 맞게 기본값 혹은 NOT NULL을 설정해준다.

2. GIT 연동

  • 코드를 복사한다.
  • Import 선택 후 Git에서 Project from Git -> CloneURI을 선택한다.
  • GIT에서 내 계정의 SETTING에서 Developer settings -> Personal access tokens를 생성한다.
  • token을 생성한다.
  • 생성된 token을 Password에 복사 붙여넣기 해준다.
  • branch를 선택한다.
  • 작업할 위치를 선택한다.
  • import as general project 선택 후 import를 마무리한다.

3. 테이블 생성



/* Create Tables */

CREATE TABLE CLASS_REGISTRATION_HISTORIES
(
	CLASS_REGISTRATION_NO NUMBER(5,0) NOT NULL,
	USER_NO NUMBER(7,0) NOT NULL,
	PROGRAM_NO NUMBER(5,0) NOT NULL,
	CLASS_PAYMENT_STATUS VARCHAR2(20) DEFAULT 'N',
	TOTAL_PRICE NUMBER(7,0),
	PAYMENT_TYPE VARCHAR2(100),
	TOTAL_DISCOUNT_PRICE NUMBER(7,0),
	TOTAL_PAYMENT_PRICE NUMBER(7,0),
	PAYMENT_COMPLETED_DATE DATE DEFAULT SYSDATE,
	CLASS_CREATED_DATE DATE DEFAULT SYSDATE,
	CLASS_UPDATED_DATE DATE DEFAULT SYSDATE,
	PRIMARY KEY (CLASS_REGISTRATION_NO)
);


CREATE TABLE DUTY_SCHEDULES
(
	DUTY_DATE DATE,
	EMPLOYEE_ID VARCHAR2(100) NOT NULL
);


CREATE TABLE EMPLOYEES
(
	EMPLOYEE_ID VARCHAR2(100) NOT NULL,
	EMPLOYEE_NAME VARCHAR2(100),
	EMPLOYEE_PASSWORD CHAR(64),
	EMPLOYEE_EMAIL VARCHAR2(255),
	EMPLOYEE_TEL VARCHAR2(20),
	EMPLOYEE_PHOTO VARCHAR2(100),
	EMPLOYEE_ZIPCODE CHAR(5),
	EMPLOYEE_BASIC_ADDRESS VARCHAR2(255),
	EMPLOYEE_DETAIL_ADDRESS VARCHAR2(255),
	EMPLOYEE_EMPLOYMENT_STATUS CHAR(6) DEFAULT '재직',
	EMPLOYEE_CREATED_DATE DATE DEFAULT SYSDATE,
	EMPLOYEE_UPDATED_DATE DATE DEFAULT SYSDATE,
	FITNESS_NO NUMBER(5,0) NOT NULL,
	PRIMARY KEY (EMPLOYEE_ID)
);


CREATE TABLE EMPLOYEE_ATTENDANCES
(
	EMPLOYEE_ID VARCHAR2(100) NOT NULL,
	WORK_YEAR NUMBER(4,0),
	WORK_DATE DATE,
	WORK_START_TIME CHAR(5),
	WORK_END_DATE CHAR(5),
	EMPLOYEE_ATTENDANCES VARCHAR2(100) DEFAULT '미등록'
);


CREATE TABLE EMPLOYEE_MONTHLY_SALES
(
	EMPLOYEE_ID VARCHAR2(100) NOT NULL,
	PROGRAM_NO NUMBER(5,0) NOT NULL,
	REGISTRATION_YEAR NUMBER(4,0),
	REGISTRATION_MONTH NUMBER(2,0),
	REGISTRATION_MONTHLY_COUNT NUMBER(5,0),
	REGISTRATION_MONTHLY_AMOUNT NUMBER(10,0)
);


CREATE TABLE EMPLOYEE_PROGRAM_ATTENDACES
(
	EMPLOYEE_ID VARCHAR2(100) NOT NULL,
	PROGRAM_NO NUMBER(5,0) NOT NULL,
	PROGRAM_ATTENDANCE_DATE DATE
);


CREATE TABLE EMPLOYEE_ROLES
(
	EMPLOYEE_ID VARCHAR2(100) NOT NULL,
	EMPLOYEE_ROLE_NAME VARCHAR2(100)
);


CREATE TABLE FITNESS_CLUBS
(
	FITNESS_NO NUMBER(5,0) NOT NULL,
	FITNESS_NAME VARCHAR2(255),
	FITNESS_TEL VARCHAR2(20),
	FITNESS_ZIPCODE CHAR(5),
	FITNESS_BASIC_ADDRESS VARCHAR2(255),
	FITNESS_DETAIL_ADDRESS VARCHAR2(255),
	FITNESS_LATITUDE NUMBER(10,7),
	FITNUSS_LONGITUDE NUMBER(10,7),
	FITNESS_DESCRIPTION VARCHAR2(2000),
	FITNESS_WEEKDAYS_OPEN_HOURS VARCHAR2(255),
	FITNESS_WEEKENDS_OPEN_HOURS VARCHAR2(255),
	FITNESS_CLOSED_DAYS VARCHAR2(255),
	FITNESS_CREATED_DATE DATE DEFAULT SYSDATE,
	FITNESS_UPDATED_DATE DATE DEFAULT SYSDATE,
	PRIMARY KEY (FITNESS_NO)
);


CREATE TABLE FITNESS_PROGRAMS
(
	PROGRAM_NO NUMBER(5,0) NOT NULL,
	PROGRAM_NAME VARCHAR2(255),
	PROGRAM_START_DATE DATE,
	PROGRAM_END_DATE DATE,
	PROGRAM_START_HOUR CHAR(5),
	PROGRAM_END_HOUR CHAR(5),
	PROGRAM_QUOTA NUMBER(3,0),
	PROGRAM_REQUEST_COUNT NUMBER(3,0) DEFAULT 0,
	PROGRAM_PRICE NUMBER(7,0),
	PROGRAM_STATUS VARCHAR2(100) DEFAULT '신청중',
	PROGRAM_CREATED_DATE DATE DEFAULT SYSDATE,
	PROGRAM_UPDATED_DATE DATE DEFAULT SYSDATE,
	EMPLOYEE_ID VARCHAR2(100) NOT NULL,
	FITNESS_PROGRAM_CATEGORY_NO CHAR(4) NOT NULL,
	PRIMARY KEY (PROGRAM_NO)
);


CREATE TABLE FITNESS_PROGRAM_CATEGORY
(
	FITNESS_PROGRAM_CATEGORY_NO CHAR(4) NOT NULL,
	FITNESS_PROGRAM_CATEGORY_NAME VARCHAR2(100),
	PRIMARY KEY (FITNESS_PROGRAM_CATEGORY_NO)
);


CREATE TABLE FITNESS_PROGRAM_DAYS
(
	PROGRAM_NO NUMBER(5,0) NOT NULL,
	PRGRAM_OPEN_DAY CHAR(3)
);


CREATE TABLE FITNESS_VISITANT
(
	CONSULTING_NO NUMBER(5,0) NOT NULL,
	CONSULTING_RESERVATION_DATE DATE,
	CUNSULTING_RESERVATION_TIME CHAR(5),
	CONSULTING_PURPOSE VARCHAR2(100),
	CONSULTING_CONTENT VARCHAR2(2000),
	CONSULTING_STATUS VARCHAR2(100),
	CONSULTING_CREATE_DATE DATE DEFAULT SYSDATE,
	CONSULTING_UPDATED_DATE DATE DEFAULT SYSDATE,
	USER_NO NUMBER(7,0) NOT NULL,
	PROGRAM_NO NUMBER(5,0),
	EMPLOYEE_ID VARCHAR2(100) NOT NULL,
	PRIMARY KEY (CONSULTING_NO)
);


CREATE TABLE MEMBERSHIP_HISTORIES
(
	MEMBERSHIP_NO NUMBER(5,0) NOT NULL,
	MEMBERSHIP_START_DATE DATE DEFAULT SYSDATE,
	MEMBERSHIP_END_DATE DATE DEFAULT SYSDATE,
	MEMBERSHIP_PERIOD NUMBER(2,0),
	MEMBERSHIP_PAYMENT_STATUS VARCHAR2(100) DEFAULT 'N',
	MEMBERSHIP_CREATED_DATE DATE DEFAULT SYSDATE,
	MEMBERSHIP_UPDATED_DATE DATE DEFAULT SYSDATE,
	TOTAL_PRICE NUMBER(7,0),
	PAYMENT_TYPE VARCHAR2(100),
	TOTAL_DISCOUNT_PRICE NUMBER(7,0),
	TOTAL_PAYMENT_PRICE NUMBER(7,0),
	PAYMENT_COMPLETED_DATE DATE DEFAULT SYSDATE,
	USER_NO NUMBER(7,0) NOT NULL,
	PRIMARY KEY (MEMBERSHIP_NO)
);


CREATE TABLE MEMBERSHIP_SALES
(
	REGISTRATION_YEAR NUMBER(5,0),
	REGISTRATION_MONTH NUMBER(2,0),
	REGISTRATION_MONTHLY_COUNT NUMBER(5,0),
	REGISTRATION_MONTHLY_AMOUNT NUMBER(10,0),
	MEMBERSHIP_NO NUMBER(5,0) NOT NULL,
	EMPLOYEE_ID VARCHAR2(100) NOT NULL
);


CREATE TABLE PROGRAM_MONTHLY_SALES
(
	REGISTRATION_YEAR NUMBER(5,0),
	REGISTRATION_MONTH NUMBER(2,0),
	PROGRAM_NO NUMBER(5,0) NOT NULL,
	REGISTRATION_MONTHLY_COUNT NUMBER(5,0),
	REGISTRATION_MONTHLY_AMOUNT NUMBER(10,0)
);


CREATE TABLE USERS
(
	USER_NO NUMBER(7,0) NOT NULL,
	USER_ID VARCHAR2(100) NOT NULL UNIQUE,
	USER_PASSWORD CHAR(64),
	USER_NAME VARCHAR2(100) NOT NULL,
	USER_GENDER CHAR(1) NOT NULL,
	USER_BIRTHDAY DATE NOT NULL,
	USER_EMAIL VARCHAR2(255) NOT NULL UNIQUE,
	USER_PHOTO VARCHAR2(100),
	USER_ZIPCODE CHAR(5) NOT NULL,
	USER_BASIC_ADDRESS VARCHAR2(255) NOT NULL,
	USER_DETAIL_ADDRESS VARCHAR2(255) NOT NULL,
	USER_TEL VARCHAR2(10) NOT NULL,
	USER_DELETED CHAR(1) DEFAULT 'N',
	USER_CREATED_DATE DATE DEFAULT SYSDATE,
	USER_UPDATED_DATE DATE DEFAULT SYSDATE,
	PRIMARY KEY (USER_NO)
);


CREATE TABLE USER_ATTENDANCES
(
	CLASS_ATTENDANCE_DATE DATE,
	USER_NO NUMBER(7,0) NOT NULL,
	USER_START_TIME CHAR(5),
	USER_END_TIME CHAR(5)
);


CREATE TABLE USER_CLASS_ATTENDANCES
(
	USER_NO NUMBER(7,0) NOT NULL,
	PROGRAM_NO NUMBER(5,0) NOT NULL,
	CLASS_ATTENDANCE_DATE DATE
);


CREATE TABLE USER_ROLES
(
	USER_NO NUMBER(7,0) NOT NULL,
	USER_ROLE_NAME VARCHAR2(20),
	CONSTRAINT USER_ROLES_PK UNIQUE (USER_NO, USER_ROLE_NAME)
);



/* Create Foreign Keys */

ALTER TABLE DUTY_SCHEDULES
	ADD FOREIGN KEY (EMPLOYEE_ID)
	REFERENCES EMPLOYEES (EMPLOYEE_ID)
;


ALTER TABLE EMPLOYEE_ATTENDANCES
	ADD FOREIGN KEY (EMPLOYEE_ID)
	REFERENCES EMPLOYEES (EMPLOYEE_ID)
;


ALTER TABLE EMPLOYEE_MONTHLY_SALES
	ADD FOREIGN KEY (EMPLOYEE_ID)
	REFERENCES EMPLOYEES (EMPLOYEE_ID)
;


ALTER TABLE EMPLOYEE_PROGRAM_ATTENDACES
	ADD FOREIGN KEY (EMPLOYEE_ID)
	REFERENCES EMPLOYEES (EMPLOYEE_ID)
;


ALTER TABLE EMPLOYEE_ROLES
	ADD FOREIGN KEY (EMPLOYEE_ID)
	REFERENCES EMPLOYEES (EMPLOYEE_ID)
;


ALTER TABLE FITNESS_PROGRAMS
	ADD FOREIGN KEY (EMPLOYEE_ID)
	REFERENCES EMPLOYEES (EMPLOYEE_ID)
;


ALTER TABLE FITNESS_VISITANT
	ADD FOREIGN KEY (EMPLOYEE_ID)
	REFERENCES EMPLOYEES (EMPLOYEE_ID)
;


ALTER TABLE MEMBERSHIP_SALES
	ADD FOREIGN KEY (EMPLOYEE_ID)
	REFERENCES EMPLOYEES (EMPLOYEE_ID)
;


ALTER TABLE EMPLOYEES
	ADD FOREIGN KEY (FITNESS_NO)
	REFERENCES FITNESS_CLUBS (FITNESS_NO)
;


ALTER TABLE CLASS_REGISTRATION_HISTORIES
	ADD FOREIGN KEY (PROGRAM_NO)
	REFERENCES FITNESS_PROGRAMS (PROGRAM_NO)
;


ALTER TABLE EMPLOYEE_MONTHLY_SALES
	ADD FOREIGN KEY (PROGRAM_NO)
	REFERENCES FITNESS_PROGRAMS (PROGRAM_NO)
;


ALTER TABLE EMPLOYEE_PROGRAM_ATTENDACES
	ADD FOREIGN KEY (PROGRAM_NO)
	REFERENCES FITNESS_PROGRAMS (PROGRAM_NO)
;


ALTER TABLE FITNESS_PROGRAM_DAYS
	ADD FOREIGN KEY (PROGRAM_NO)
	REFERENCES FITNESS_PROGRAMS (PROGRAM_NO)
;


ALTER TABLE FITNESS_VISITANT
	ADD FOREIGN KEY (PROGRAM_NO)
	REFERENCES FITNESS_PROGRAMS (PROGRAM_NO)
;


ALTER TABLE PROGRAM_MONTHLY_SALES
	ADD FOREIGN KEY (PROGRAM_NO)
	REFERENCES FITNESS_PROGRAMS (PROGRAM_NO)
;


ALTER TABLE USER_CLASS_ATTENDANCES
	ADD FOREIGN KEY (PROGRAM_NO)
	REFERENCES FITNESS_PROGRAMS (PROGRAM_NO)
;


ALTER TABLE FITNESS_PROGRAMS
	ADD FOREIGN KEY (FITNESS_PROGRAM_CATEGORY_NO)
	REFERENCES FITNESS_PROGRAM_CATEGORY (FITNESS_PROGRAM_CATEGORY_NO)
;


ALTER TABLE MEMBERSHIP_SALES
	ADD FOREIGN KEY (MEMBERSHIP_NO)
	REFERENCES MEMBERSHIP_HISTORIES (MEMBERSHIP_NO)
;


ALTER TABLE CLASS_REGISTRATION_HISTORIES
	ADD FOREIGN KEY (USER_NO)
	REFERENCES USERS (USER_NO)
;


ALTER TABLE FITNESS_VISITANT
	ADD FOREIGN KEY (USER_NO)
	REFERENCES USERS (USER_NO)
;


ALTER TABLE MEMBERSHIP_HISTORIES
	ADD FOREIGN KEY (USER_NO)
	REFERENCES USERS (USER_NO)
;


ALTER TABLE USER_ATTENDANCES
	ADD FOREIGN KEY (USER_NO)
	REFERENCES USERS (USER_NO)
;


ALTER TABLE USER_CLASS_ATTENDANCES
	ADD FOREIGN KEY (USER_NO)
	REFERENCES USERS (USER_NO)
;


ALTER TABLE USER_ROLES
	ADD FOREIGN KEY (USER_NO)
	REFERENCES USERS (USER_NO)
;
profile
한 걸음 한 걸음 나아가는 개발자

0개의 댓글