mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-04-03 03:27:13 +08:00
update init.sql
This commit is contained in:
parent
99ea09f493
commit
b66e0fd690
91
init.sql
91
init.sql
@ -1,44 +1,55 @@
|
|||||||
CREATE TABLE accounts (
|
CREATE TABLE `accounts` (
|
||||||
uuid BINARY(16) NOT NULL PRIMARY KEY,
|
`uuid` binary(16) NOT NULL,
|
||||||
username VARCHAR(16) NOT NULL,
|
`username` varchar(16) NOT NULL,
|
||||||
hash BINARY(32) NOT NULL,
|
`hash` binary(32) NOT NULL,
|
||||||
salt BINARY(16) NOT NULL,
|
`salt` binary(16) NOT NULL,
|
||||||
registered DATETIME NOT NULL DEFAULT NOW(),
|
`registered` timestamp NOT NULL,
|
||||||
lastActivity DATETIME NOT NULL DEFAULT NOW(),
|
`lastLoggedIn` timestamp NULL DEFAULT NULL,
|
||||||
lastLoggedIn DATETIME NULL,
|
`lastActivity` timestamp NULL DEFAULT NULL,
|
||||||
INDEX (lastActivity),
|
`banned` tinyint(2) NOT NULL DEFAULT 0,
|
||||||
INDEX (username),
|
PRIMARY KEY (`uuid`),
|
||||||
UNIQUE (username)
|
UNIQUE KEY `username` (`username`)
|
||||||
);
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
|
||||||
|
|
||||||
CREATE TABLE sessions (
|
|
||||||
token BINARY(32) NOT NULL PRIMARY KEY,
|
|
||||||
uuid BINARY(16) NOT NULL,
|
|
||||||
expire DATETIME NOT NULL,
|
|
||||||
FOREIGN KEY (uuid) REFERENCES accounts(uuid) ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE dailyRuns (
|
CREATE TABLE `sessions` (
|
||||||
seed VARCHAR(255) NOT NULL,
|
`token` binary(32) NOT NULL,
|
||||||
date DATE NOT NULL PRIMARY KEY
|
`uuid` binary(16) NOT NULL,
|
||||||
);
|
`expire` timestamp NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`token`),
|
||||||
|
KEY `uuid` (`uuid`),
|
||||||
|
CONSTRAINT `uuid` FOREIGN KEY (`uuid`) REFERENCES `accounts` (`uuid`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
|
||||||
|
|
||||||
CREATE TABLE accountDailyRuns (
|
|
||||||
uuid BINARY(16) NOT NULL PRIMARY KEY,
|
|
||||||
date DATE NOT NULL,
|
|
||||||
score INT NOT NULL,
|
|
||||||
wave INT NOT NULL,
|
|
||||||
timestamp DATETIME,
|
|
||||||
FOREIGN KEY (date) REFERENCES dailyRuns(date),
|
|
||||||
FOREIGN KEY (uuid) REFERENCES accounts(uuid) ON DELETE CASCADE,
|
|
||||||
UNIQUE (uuid, date)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE seedCompletions (
|
CREATE TABLE `seedCompletions` (
|
||||||
uuid BINARY(16) NOT NULL PRIMARY KEY,
|
`uuid` binary(16) NOT NULL,
|
||||||
seed VARCHAR(255) NOT NULL,
|
`seed` char(24) NOT NULL,
|
||||||
mode INT NOT NULL,
|
`mode` int(11) NOT NULL DEFAULT 0,
|
||||||
timestamp DATETIME NOT NULL DEFAULT NOW(),
|
`timestamp` timestamp NOT NULL,
|
||||||
FOREIGN KEY (uuid) REFERENCES accounts(uuid) ON DELETE CASCADE,
|
`score` int(11) NOT NULL DEFAULT 0,
|
||||||
UNIQUE (seed, mode, uuid)
|
PRIMARY KEY (`uuid`,`seed`),
|
||||||
);
|
KEY `uuid` (`uuid`),
|
||||||
|
CONSTRAINT `seedCompletions_ibfk_1` FOREIGN KEY (`uuid`) REFERENCES `accounts` (`uuid`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE `dailyRuns` (
|
||||||
|
`date` date NOT NULL,
|
||||||
|
`seed` char(24) NOT NULL,
|
||||||
|
PRIMARY KEY (`date`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE `accountDailyRuns` (
|
||||||
|
`uuid` binary(16) NOT NULL,
|
||||||
|
`date` date NOT NULL,
|
||||||
|
`timestamp` timestamp NOT NULL,
|
||||||
|
`score` int(11) NOT NULL DEFAULT 0,
|
||||||
|
`wave` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`uuid`,`date`),
|
||||||
|
KEY `uuid` (`uuid`),
|
||||||
|
KEY `date` (`date`),
|
||||||
|
CONSTRAINT `accountDailyRuns_ibfk_1` FOREIGN KEY (`uuid`) REFERENCES `accounts` (`uuid`),
|
||||||
|
CONSTRAINT `accountDailyRuns_ibfk_2` FOREIGN KEY (`date`) REFERENCES `dailyRuns` (`date`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
|
Loading…
x
Reference in New Issue
Block a user