69 lines
1.5 KiB
SQL
69 lines
1.5 KiB
SQL
CREATE DATABASE IF NOT EXISTS sevenkeys;
|
|
|
|
USE sevenkeys;
|
|
|
|
CREATE TABLE IF NOT EXISTS CacheTimestamp (
|
|
CacheType ENUM('AllCardsBulkData') PRIMARY KEY,
|
|
Stamp DATETIME NOT NULL
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS ExpansionSet (
|
|
SetCode VARCHAR(6) PRIMARY KEY,
|
|
Name VARCHAR(60) NOT NULL,
|
|
CardCount INT NOT NULL,
|
|
IconSvgUri VARCHAR(60) NOT NULL
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS CardPrinting (
|
|
Id VARCHAR(37) PRIMARY KEY, -- GUID, plus one character for foil/nonfoil
|
|
Name VARCHAR(150) NOT NULL,
|
|
SetCode VARCHAR(6) NOT NULL,
|
|
FOREIGN KEY (SetCode) REFERENCES ExpansionSet(SetCode),
|
|
IsFoil BOOLEAN NOT NULL,
|
|
IsPromo BOOLEAN NOT NULL,
|
|
CollectorNumber VARCHAR(10) NOT NULL,
|
|
ImageUrl VARCHAR(100) NOT NULL,
|
|
Language VARCHAR(3) NOT NULL
|
|
);
|
|
|
|
INSERT INTO CardPrinting (
|
|
Id,
|
|
Name,
|
|
SetCode,
|
|
IsFoil,
|
|
IsPromo,
|
|
CollectorNumber,
|
|
ImageUrl,
|
|
Language,
|
|
) VALUES (
|
|
'00000000-0000-0000-0000-0000000000000',
|
|
'Scanned Card Placeholder',
|
|
'lea',
|
|
0,
|
|
0,
|
|
0,
|
|
'',
|
|
'en',
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS StorageArea (
|
|
Id INT AUTO_INCREMENT PRIMARY KEY,
|
|
Name VARCHAR(100) NOT NULL,
|
|
StorageType ENUM('Binder', 'Box')
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS CardLocation (
|
|
Id INT AUTO_INCREMENT PRIMARY KEY,
|
|
CardPrintingId VARCHAR(37) NULL,
|
|
FOREIGN KEY (CardPrintingId) REFERENCES CardPrinting(Id),
|
|
StorageAreaId INT NOT NULL,
|
|
FOREIGN KEY (StorageAreaId) REFERENCES StorageArea(Id),
|
|
Position INT NULL
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS CardScan (
|
|
Id INT PRIMARY KEY AUTO_INCREMENT,
|
|
CardLocationId INT NOT NULL,
|
|
Filename VARCHAR(100) NOT NULL
|
|
);
|