The following files exists in this folder. Click to view.
Stegen_1c.sql89 lines ASCII Unix (LF) 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
-- Created by Redgate Data Modeler (https://datamodeler.redgate-platform.com)
-- Last modification date: 2025-12-13 23:27:30.139
-- tables
-- Table: Ladders
CREATE TABLE Ladders (
ladderId int NOT NULL AUTO_INCREMENT,
userId int NOT NULL,
laddername varchar(30) NOT NULL,
description varchar(1000) NULL,
pointsystem varchar(10) NOT NULL,
startingpoints int NOT NULL,
minbet int NOT NULL,
minbetPercent int NULL,
minbetTime int NULL,
open int NOT NULL,
playerroof int NULL,
startdate datetime NOT NULL,
enddate datetime NULL,
createdate timestamp NOT NULL,
CONSTRAINT Ladders_pk PRIMARY KEY (ladderId)
);
-- Table: Matches
CREATE TABLE Matches (
matchId int NOT NULL AUTO_INCREMENT,
challengerId int NOT NULL,
defenderId int NOT NULL,
winnerId int NULL,
challengerpoints int NOT NULL,
defenderpoints int NOT NULL,
createdate timestamp NOT NULL,
responsedate datetime NULL,
matchdate datetime NULL,
status varchar(10) NOT NULL,
CONSTRAINT Matches_pk PRIMARY KEY (matchId)
);
-- Table: Players
CREATE TABLE Players (
playerId int NOT NULL AUTO_INCREMENT,
userId int NOT NULL,
ladderId int NOT NULL,
createdate timestamp NOT NULL,
active int NOT NULL DEFAULT 1,
CONSTRAINT Players_pk PRIMARY KEY (playerId)
);
-- Table: Users
CREATE TABLE Users (
userId int NOT NULL AUTO_INCREMENT,
userlvl varchar(10) NOT NULL,
password varchar(80) NOT NULL,
username varchar(50) NOT NULL,
incorrectLoginAttempts int NOT NULL DEFAULT 0,
latestLogin datetime NOT NULL,
active int NOT NULL DEFAULT 1,
createdate timestamp NOT NULL,
CONSTRAINT Users_pk PRIMARY KEY (userId)
);
-- foreign keys
-- Reference: Ladders_Users (table: Ladders)
ALTER TABLE Ladders ADD CONSTRAINT Ladders_Users FOREIGN KEY Ladders_Users (userId)
REFERENCES Users (userId);
-- Reference: Matches_challengers (table: Matches)
ALTER TABLE Matches ADD CONSTRAINT Matches_challengers FOREIGN KEY Matches_challengers (challengerId)
REFERENCES Players (playerId);
-- Reference: Matches_defenders (table: Matches)
ALTER TABLE Matches ADD CONSTRAINT Matches_defenders FOREIGN KEY Matches_defenders (defenderId)
REFERENCES Players (playerId);
-- Reference: Matches_winners (table: Matches)
ALTER TABLE Matches ADD CONSTRAINT Matches_winners FOREIGN KEY Matches_winners (winnerId)
REFERENCES Players (playerId);
-- Reference: Players_Ladders (table: Players)
ALTER TABLE Players ADD CONSTRAINT Players_Ladders FOREIGN KEY Players_Ladders (ladderId)
REFERENCES Ladders (ladderId);
-- Reference: Players_Users (table: Players)
ALTER TABLE Players ADD CONSTRAINT Players_Users FOREIGN KEY Players_Users (userId)
REFERENCES Users (userId);
-- End of file.