Create tables for Cardtrader data

This commit is contained in:
The Magician 2024-11-25 19:55:53 +00:00
parent cb78b86fa1
commit 1f93aef749
1 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,43 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE IF NOT EXISTS CardtraderGame (
Id INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(255) NOT NULL
);
CREATE TABLE IF NOT EXISTS CardtraderCategory (
Id INT PRIMARY KEY AUTO_INCREMENT,
CardtraderGameId INT NOT NULL,
FOREIGN KEY (CardtraderGameId) REFERENCES CardtraderGame(Id),
Name VARCHAR(255) NOT NULL
);
CREATE TABLE IF NOT EXISTS CardtraderExpansion (
Id INT PRIMARY KEY AUTO_INCREMENT,
CardtraderGameId INT NOT NULL,
FOREIGN KEY (CardtraderGameId) REFERENCES CardtraderGame(Id)
);
CREATE TABLE IF NOT EXISTS CardtraderBlueprint (
Id INT PRIMARY KEY AUTO_INCREMENT,
CardtraderGameId INT NOT NULL,
FOREIGN KEY (CardtraderGameId) REFERENCES CardtraderGame(Id),
CardtraderCategoryId INT NOT NULL,
FOREIGN KEY (CardtraderCategoryId) REFERENCES CardtraderCategory(Id),
CardtraderExpansionId INT NOT NULL,
FOREIGN KEY (CardtraderExpansionId) REFERENCES CardtraderExpansion(Id),
Name VARCHAR(255) NOT NULL,
CollectorNumber VARCHAR(10) NOT NULL
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS CardtraderGame;
DROP TABLE IF EXISTS CardtraderCategory;
DROP TABLE IF EXISTS CardtraderExpansion;
DROP TABLE IF EXISTS CardtraderBlueprint;
-- +goose StatementEnd