TheMathemagicians/sevenkeys/database/sql/createdb.sql

73 lines
1.6 KiB
MySQL
Raw Normal View History

2024-04-23 16:52:48 +00:00
CREATE DATABASE IF NOT EXISTS sevenkeys;
USE sevenkeys;
CREATE TABLE IF NOT EXISTS CacheTimestamp (
2024-05-19 14:01:18 +00:00
CacheType ENUM('AllCardsBulkData') PRIMARY KEY,
2024-05-19 09:05:29 +00:00
Stamp DATETIME NOT NULL
2024-05-19 09:01:57 +00:00
);
2024-05-19 19:29:50 +00:00
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
2024-05-20 15:54:49 +00:00
Name VARCHAR(150) NOT NULL,
2024-04-28 14:13:47 +00:00
SetCode VARCHAR(6) NOT NULL,
2024-05-19 19:29:50 +00:00
FOREIGN KEY (SetCode) REFERENCES ExpansionSet(SetCode),
2024-05-29 19:55:38 +00:00
IsFoil BOOLEAN NOT NULL,
2024-05-19 19:29:50 +00:00
IsPromo BOOLEAN NOT NULL,
CollectorNumber VARCHAR(10) NOT NULL,
ImageUrl VARCHAR(100) NOT NULL,
2024-05-19 19:29:50 +00:00
Language VARCHAR(3) NOT NULL
);
2024-05-27 11:05:52 +00:00
/*
INSERT INTO CardPrinting (
Id,
Name,
SetCode,
IsFoil,
IsPromo,
CollectorNumber,
ImageUrl,
2024-10-28 19:47:23 +00:00
Language
) VALUES (
'00000000-0000-0000-0000-0000000000000',
'Scanned Card Placeholder',
'lea',
0,
0,
0,
'',
2024-10-28 19:47:23 +00:00
'en'
);
*/
2024-08-17 19:14:08 +00:00
CREATE TABLE IF NOT EXISTS StorageArea (
Id INT AUTO_INCREMENT PRIMARY KEY,
Name VARCHAR(100) NOT NULL,
2024-08-19 15:23:11 +00:00
StorageType ENUM('Binder', 'Box')
2024-08-17 19:14:08 +00:00
);
CREATE TABLE IF NOT EXISTS CardLocation (
2024-05-29 21:03:40 +00:00
Id INT AUTO_INCREMENT PRIMARY KEY,
CardPrintingId VARCHAR(37) NULL,
2024-05-29 21:03:40 +00:00
FOREIGN KEY (CardPrintingId) REFERENCES CardPrinting(Id),
2024-08-17 19:14:08 +00:00
StorageAreaId INT NOT NULL,
FOREIGN KEY (StorageAreaId) REFERENCES StorageArea(Id),
Position INT NULL
2024-05-29 21:03:40 +00:00
);
ALTER TABLE CardLocation ADD CardtraderProductId INT NULL;
CREATE TABLE IF NOT EXISTS CardScan (
Id INT PRIMARY KEY AUTO_INCREMENT,
CardLocationId INT NOT NULL,
Filename VARCHAR(100) NOT NULL
);