MySQL + Sequelize is working, signup emails working

This commit is contained in:
2021-01-25 07:32:47 +11:00
parent d0b383f5de
commit 9cd57f17fa
19 changed files with 760 additions and 283 deletions
+52
View File
@@ -0,0 +1,52 @@
# account system
CREATE TABLE IF NOT EXISTS pendingSignups (
email VARCHAR(320) UNIQUE,
username VARCHAR(100) UNIQUE,
hash VARCHAR(100),
verify INTEGER DEFAULT 0
);
CREATE TABLE IF NOT EXISTS accounts (
id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE,
td TIMESTAMP DEFAULT CURRENT_TIMESTAMP(),
privilege ENUM ('administrator', 'moderator', 'alpha', 'beta', 'normal') DEFAULT 'normal',
email VARCHAR(320) UNIQUE,
username VARCHAR(100) UNIQUE,
hash VARCHAR(100),
lastActivityTime TIMESTAMP DEFAULT '2021-01-01 00:00:00',
deletionTime TIMESTAMP NULL DEFAULT NULL
);
#CREATE TABLE IF NOT EXISTS sessions (
# id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE,
# td TIMESTAMP DEFAULT CURRENT_TIMESTAMP(),
#
# accountId INTEGER UNSIGNED,
# token INTEGER DEFAULT 0,
#
# CONSTRAINT FOREIGN KEY fk_sessions_accountId(accountId) REFERENCES accounts(id) ON UPDATE CASCADE ON DELETE CASCADE
#);
CREATE TABLE IF NOT EXISTS passwordRecover (
id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE,
td TIMESTAMP DEFAULT CURRENT_TIMESTAMP(),
accountId INTEGER UNSIGNED UNIQUE,
token INTEGER DEFAULT 0,
CONSTRAINT FOREIGN KEY fk_passwordRecover_accountId(accountId) REFERENCES accounts(id) ON UPDATE CASCADE ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS bannedEmails (
id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE,
td TIMESTAMP DEFAULT CURRENT_TIMESTAMP(),
email VARCHAR(320) UNIQUE,
reason TEXT,
expiry TIMESTAMP NULL DEFAULT NULL
);