55 lines
1.5 KiB
Plaintext
55 lines
1.5 KiB
Plaintext
# Do not use this file - this is just a guide for my own use
|
|
|
|
|
|
# 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
|
|
); |