Add updates to database schema

This commit is contained in:
The Magician 2024-04-13 14:35:00 +01:00
parent 07ad091168
commit d15cc864bc
1 changed files with 14 additions and 1 deletions

View File

@ -2,6 +2,8 @@ USE DATABASE sevenkeys;
CREATE TABLE IF NOT EXISTS Gamepiece ( CREATE TABLE IF NOT EXISTS Gamepiece (
Id INT AUTO_INCREMENT PRIMARY KEY, Id INT AUTO_INCREMENT PRIMARY KEY,
ArenaId INT NULL,
ScryfallId VARCHAR(36) NOT NULL,
OracleId VARCHAR(36) NOT NULL, OracleId VARCHAR(36) NOT NULL,
Name VARCHAR(141) NOT NULL, Name VARCHAR(141) NOT NULL,
Layout ENUM("normal", Layout ENUM("normal",
@ -34,7 +36,6 @@ CREATE TABLE IF NOT EXISTS Gamepiece (
OracleText VARCHAR(800) NOT NULL, OracleText VARCHAR(800) NOT NULL,
Power VARCHAR(5) NULL, Power VARCHAR(5) NULL,
Toughness VARCHAR(5) NULL, Toughness VARCHAR(5) NULL,
Legalities, -- TODO: many-to-many table
ReserveList BOOLEAN NOT NULL, ReserveList BOOLEAN NOT NULL,
); );
@ -65,6 +66,14 @@ CREATE TABLE IF NOT EXISTS GamepieceColorIdentity (
FOREIGN KEY (GamepieceId) REFERENCES Gamepiece(Id) FOREIGN KEY (GamepieceId) REFERENCES Gamepiece(Id)
); );
CREATE TABLE IF NOT EXISTS GamepieceColorIndicator (
ColorId INT,
GamepieceId INT,
PRIMARY KEY (ColorId, GamepieceId),
FOREIGN KEY (ColorId) REFERENCES Color(Id),
FOREIGN KEY (GamepieceId) REFERENCES Gamepiece(Id)
);
CREATE TABLE IF NOT EXISTS Keyword ( CREATE TABLE IF NOT EXISTS Keyword (
Id INT AUTO_INCREMENT PRIMARY KEY, Id INT AUTO_INCREMENT PRIMARY KEY,
Name VARCHAR(20) NOT NULL Name VARCHAR(20) NOT NULL
@ -112,4 +121,8 @@ CREATE TABLE IF NOT EXISTS CardPrinting (
StorySpotlight BOOLEAN NOT NULL, StorySpotlight BOOLEAN NOT NULL,
FlavorName VARCHAR(40) NULL, -- TODO: check length FlavorName VARCHAR(40) NULL, -- TODO: check length
FlavorText VARCHAR(300) NULL, -- TODO: check length FlavorText VARCHAR(300) NULL, -- TODO: check length
DigitalOnly BOOLEAN NOT NULL,
Variation BOOLEAN NOT NULL,
VariationId VARCHAR(36) NULL,
SecurityStamp ENUM("oval", "triangle", "acorn", "circle", "arena", "heart") NULL,
); );