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