-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
CREATE TABLE USER_INFO | ||
( | ||
USER_ID INT NOT NULL PRIMARY KEY, | ||
LOGIN VARCHAR(50) NOT NULL, | ||
IS_ADMIN BOOLEAN NOT NULL DEFAULT FALSE, | ||
CONSTRAINT IDX_UNIQUE UNIQUE (USER_ID) | ||
); | ||
|
||
CREATE TABLE CARD_ISSUANCE | ||
( | ||
IDX BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
USER_ID INT NOT NULL, | ||
CARD_ID VARCHAR(20) NOT NULL, | ||
START_USE DATETIME NOT NULL, | ||
END_USE DATETIME NOT NULL DEFAULT '9999-12-31 23:59:59', | ||
CONSTRAINT FK_USER_ID FOREIGN KEY (USER_ID) REFERENCES USER_INFO (USER_ID), | ||
CONSTRAINT IDX_UNIQUE UNIQUE (IDX) | ||
); | ||
|
||
CREATE TABLE DEVICE_INFO | ||
( | ||
DEVICE_ID INT NOT NULL PRIMARY KEY, | ||
CAMPUS VARCHAR(15) NOT NULL, | ||
IO_TYPE VARCHAR(3) NOT NULL, | ||
CONSTRAINT DEVICE_ID_UNIQUE UNIQUE (DEVICE_ID) | ||
); | ||
|
||
CREATE TABLE TAG_LOG | ||
( | ||
IDX BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
TAG_AT DATETIME NOT NULL, | ||
CARD_ID VARCHAR(15) NOT NULL, | ||
DEVICE_ID INT NOT NULL, | ||
CONSTRAINT IDX_UNIQUE UNIQUE (IDX) | ||
); | ||
|
||
CREATE TABLE PAIR_INFO | ||
( | ||
IN_DEVICE INT NOT NULL, | ||
OUT_DEVICE INT NOT NULL, | ||
CONSTRAINT PAIR_INFO_PK PRIMARY KEY (IN_DEVICE, OUT_DEVICE) | ||
); |