Change database to be better suited for website

This commit is contained in:
2025-06-29 22:00:48 -07:00
parent dc36f91353
commit 74c6776aaa
2 changed files with 38 additions and 75 deletions
+20 -42
View File
@@ -7,18 +7,14 @@ CREATE TABLE IF NOT EXISTS `Account` (
`Email` varchar(60) DEFAULT NULL,
`EmailVerified` tinyint(4) DEFAULT NULL,
`PasswordHash` varchar(100) DEFAULT NULL,
`FailedPasswordLock` tinyint(4) DEFAULT NULL,
`PasswordAttempts` int(11) DEFAULT NULL,
`CurrentPasswordAttempts` int(11) DEFAULT NULL,
`Role` varchar(45) DEFAULT NULL,
`EmailToken` varchar(45) DEFAULT NULL,
PRIMARY KEY (`ID`)
) AUTO_INCREMENT=1;
CREATE TABLE IF NOT EXISTS `AccountInventory` (
`AccountID` int(11) NOT NULL,
`ProductID` int(11) NOT NULL,
`Item` varchar(45) NOT NULL,
`Quantity` int(11) DEFAULT NULL,
`Stats` varchar(45) DEFAULT NULL,
PRIMARY KEY (`AccountID`,`ProductID`,`Item`)
);
CREATE TABLE IF NOT EXISTS `Product` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(45) DEFAULT NULL,
@@ -36,6 +32,14 @@ CREATE TABLE IF NOT EXISTS `ProductImage` (
PRIMARY KEY (`ImageID`,`ProductID`)
) AUTO_INCREMENT=1;
CREATE TABLE IF NOT EXISTS `ProductInventory` (
`AccountID` int(11) NOT NULL,
`ProductID` int(11) NOT NULL,
`Key` varchar(45) NOT NULL,
`Value` text DEFAULT NULL,
PRIMARY KEY (`AccountID`,`ProductID`,`Key`)
);
CREATE TABLE IF NOT EXISTS `Cart` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`AccountID` int(11) DEFAULT NULL,
@@ -47,17 +51,6 @@ CREATE TABLE IF NOT EXISTS `Cart` (
CONSTRAINT `Cart_ibfk_2` FOREIGN KEY (`ProductID`) REFERENCES `Product` (`ID`)
) AUTO_INCREMENT=1;
CREATE TABLE IF NOT EXISTS `ProjectMistData` (
`AccountID` int(11) NOT NULL,
`Credits` int(11) DEFAULT NULL,
`OddballTimer` double DEFAULT NULL,
`SessionToken` varchar(45) DEFAULT NULL,
`SessionID` int(11) DEFAULT NULL,
`Kills` int(11) DEFAULT NULL,
`Deaths` int(11) DEFAULT NULL,
PRIMARY KEY (`AccountID`)
);
CREATE TABLE IF NOT EXISTS `Receipt` (
`AccountID` int(11) NOT NULL,
`ProductID` int(11) NOT NULL,
@@ -66,17 +59,7 @@ CREATE TABLE IF NOT EXISTS `Receipt` (
`Time` datetime DEFAULT NULL,
`TaxAmount` int(11) DEFAULT NULL,
`TotalCost` int(11) DEFAULT NULL,
PRIMARY KEY (`AccountID`,`ProductID`,`ReceiptID`,`LineItem`)
);
CREATE TABLE IF NOT EXISTS `WebsiteData` (
`AccountID` int(11) NOT NULL,
`FailedPasswordLock` tinyint(4) DEFAULT NULL,
`PasswordAttempts` int(11) DEFAULT NULL,
`CurrentPasswordAttempts` int(11) DEFAULT NULL,
`Role` varchar(45) DEFAULT NULL,
`EmailToken` varchar(45) DEFAULT NULL,
PRIMARY KEY (`AccountID`)
PRIMARY KEY (`AccountID`,`ProductID`,`ReceiptID`)
);
INSERT INTO Account (
@@ -84,23 +67,18 @@ INSERT INTO Account (
UserName,
Email,
EmailVerified,
PasswordHash
) VALUES (
1,
'admin',
'admin@mistox.com',
1,
'$2a$11$0UeWLLqTXe3FG161QVuI0OQJ9rulspUpMG581DI6KSzDXBbFKd00S'
);
INSERT INTO WebsiteData (
AccountID,
PasswordHash,
FailedPasswordLock,
PasswordAttempts,
CurrentPasswordAttempts,
Role,
EmailToken
) VALUES (
1,
'admin',
'admin@mistox.com',
1,
'$2a$11$0UeWLLqTXe3FG161QVuI0OQJ9rulspUpMG581DI6KSzDXBbFKd00S',
1,
1,
5,