This commit is contained in:
shoopea 2019-05-03 15:29:17 +08:00
parent 528e95fde9
commit ddfbdc4cdf

12
sql.go
View File

@ -65,12 +65,12 @@ func initDB() {
}
_, err = db.Exec(`CREATE TABLE msg (
id BIGINT UNSIGNED NOT NULL,
user_id BIGINT UNSIGNED NOT NULL,
direction ENUM('incoming', 'outgoing'),
date TIMESTAMP NOT NULL,
text VARCHAR(4096) NOT NULL,
FOREIGN KEY (user_id) REFERENCES user(id) ON DELETE CASCADE
id BIGINT UNSIGNED NOT NULL
,user_id BIGINT UNSIGNED NOT NULL
,direction ENUM('incoming', 'outgoing')
,date TIMESTAMP NOT NULL
,text VARCHAR(4096) NOT NULL
-- ,FOREIGN KEY (user_id) REFERENCES user(id) ON DELETE CASCADE
) ENGINE = InnoDB CHARSET=utf8 COLLATE utf8_unicode_ci;`)
if err != nil {
log.Fatal(err)