Files
MistoxCom-Angular/database/mistox.sql
T

110 lines
2.8 KiB
SQL
Executable File

CREATE DATABASE IF NOT EXISTS `mistox`;
USE `mistox`;
CREATE TABLE IF NOT EXISTS `Account` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`UserName` varchar(60) DEFAULT NULL,
`Email` varchar(60) DEFAULT NULL,
`EmailVerified` tinyint(4) DEFAULT NULL,
`PasswordHash` varchar(100) 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,
`Description` text DEFAULT NULL,
`Cost` int(11) DEFAULT NULL,
`URL` varchar(200) DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `ID_UNIQUE` (`ID`)
) AUTO_INCREMENT=1;
CREATE TABLE IF NOT EXISTS `ProductImage` (
`ImageID` int(11) NOT NULL AUTO_INCREMENT,
`ProductID` int(11) NOT NULL,
'Image' MEDIUMBLOB DEFAULT NULL,
PRIMARY KEY (`ImageID`,`ProductID`)
)
CREATE TABLE IF NOT EXISTS `Cart` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`AccountID` int(11) DEFAULT NULL,
`ProductID` int(11) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `AccountID` (`AccountID`),
KEY `ProductID` (`ProductID`),
CONSTRAINT `Cart_ibfk_1` FOREIGN KEY (`AccountID`) REFERENCES `Account` (`ID`),
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,
`ReceiptID` varchar(45) NOT NULL,
`LineItem` int(11) NOT NULL,
`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`)
);
INSERT INTO Account (
ID,
UserName,
Email,
EmailVerified,
PasswordHash
) VALUES (
'1',
'admin',
'admin@mistox.com',
'1',
''
);
INSERT INTO WebsiteData (
AccountID,
FailedPasswordLock,
PasswordAttempts,
CurrentPasswordAttempts,
Role,
EmailToken
) VALUES (
'1',
'1',
'5',
'0',
'Admin',
''
);