-
Notifications
You must be signed in to change notification settings - Fork 3
ERD & DDL
joohongpark edited this page Mar 27, 2023
·
3 revisions

create table DEVICE_INFO
(
DEVICE_ID int not null comment '세콤 기기의 고유 번호'
primary key,
CAMPUS varchar(15) not null comment '기기가 설치되어있는 캠퍼스(혹은 건물) 정보',
IO_TYPE varchar(3) not null comment '입/출입',
constraint DEVICE_ID_UNIQUE
unique (DEVICE_ID)
)
comment '세콤 기기 기본정보';
create table PAIR_INFO
(
IN_DEVICE int not null comment '입장 기기',
OUT_DEVICE int not null comment '퇴장 기기',
primary key (IN_DEVICE, OUT_DEVICE)
)
comment '바람직한 입출로 인정하는 세콤기기의 짝 목록';
create table TAG_LOG
(
IDX int auto_increment comment '태그 기록 고유 번호'
primary key,
CARD_ID varchar(45) not null comment '태그가 발생한 카드의 번호',
TAG_AT datetime not null comment '태그가 발생한 시점',
DEVICE_ID int not null comment '태그가 발생한 기기',
INDEX CARD_ID_TAG_AT (CARD_ID, TAG_AT)
)
comment '카드 태그 기록';
create table USER_INFO
(
USER_ID int not null comment '42 intra에서 사용하는 유저계정의 고유 id'
primary key,
LOGIN varchar(50) not null comment '42 intra에서 사용하는 유저계정의 login',
IS_ADMIN tinyint(1) default 0 not null comment '관리자 페이지 이용 가능 여부',
constraint IDX_UNIQUE
unique (USER_ID)
)
comment '사용자의 기본 정보';
create table CARD_ISSUANCE
(
IDX bigint auto_increment
primary key,
USER_ID int not null comment '카드의 소유자 고유 ID',
CARD_ID varchar(20) not null comment '카드의 번호',
START_USE datetime not null comment '카드의 사용 시작 시간',
END_USE datetime default '9999-12-31 23:59:59' not null comment '카드의 사용 종료 시간',
constraint IDX_UNIQUE
unique (IDX),
constraint FK_USER_ID
foreign key (USER_ID) references USER_INFO (USER_ID)
)
comment '유저별 카드 발급/재발급 기록';