-
Notifications
You must be signed in to change notification settings - Fork 1
/
dbsetting.txt
7 lines (3 loc) · 948 Bytes
/
dbsetting.txt
1
2
3
4
5
6
7
CREATE TABLE cards ( card_id INT NOT NULL AUTO_INCREMENT, id VARCHAR(255) NOT NULL, rest VARCHAR(255) NOT NULL, update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, img_name VARCHAR(255), text VARCHAR(1023), likes INT, hates INT, comment_cnt INT, FOREIGN KEY(id) REFERENCES users(id) ON DELETE CASCADE, PRIMARY KEY(card_id));
CREATE TABLE cardlikes ( card_id INT NOT NULL, id VARCHAR(255) NOT NULL, update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, flag INT NOT NULL, FOREIGN KEY(card_id) REFERENCES cards(card_id) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY(id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY(card_id, id) );
CREATE TABLE verify ( id VARCHAR(255) NOT NULL, md5 VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, last TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL, FOREIGN KEY(id) REFERENCES users(id), PRIMARY KEY(id));