From 1f93aef749cff03e7818fdbeedbf9dc11a58789b Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 25 Nov 2024 19:55:53 +0000 Subject: [PATCH] Create tables for Cardtrader data --- .../00008_create_cardtrader_tables.sql | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 sevenkeys/database/migrations/00008_create_cardtrader_tables.sql diff --git a/sevenkeys/database/migrations/00008_create_cardtrader_tables.sql b/sevenkeys/database/migrations/00008_create_cardtrader_tables.sql new file mode 100644 index 0000000..b258d34 --- /dev/null +++ b/sevenkeys/database/migrations/00008_create_cardtrader_tables.sql @@ -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