44 lines
1.2 KiB
SQL
44 lines
1.2 KiB
SQL
-- +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 CardtraderBlueprint;
|
|
|
|
DROP TABLE IF EXISTS CardtraderExpansion;
|
|
|
|
DROP TABLE IF EXISTS CardtraderCategory;
|
|
|
|
DROP TABLE IF EXISTS CardtraderGame;
|
|
-- +goose StatementEnd
|