feat(platforms): added platform support (#67)

Now libraries can be assigned to platforms in the admin section.
Games will be assigned to libraries on scanning.

Resolves grimsi/gameyfin#31

Co-authored-by: shawly <shawlyde@gmail.com>
This commit is contained in:
Simon
2022-10-25 21:55:35 +03:00
committed by GitHub
parent 7504cd3500
commit 8e23549336
54 changed files with 1426 additions and 113 deletions
@@ -0,0 +1,45 @@
-- Add platforms
-- Platforms
CREATE TABLE platform
(
slug VARCHAR(255) NOT NULL,
name VARCHAR(255),
logo_id VARCHAR(255),
PRIMARY KEY (slug)
);
-- Game <-> Platforms
CREATE TABLE detected_game_platforms
(
detected_game_slug VARCHAR(255) NOT NULL,
platforms_slug VARCHAR(255) NOT NULL
);
ALTER TABLE detected_game_platforms
ADD CONSTRAINT platforms_platform_slug FOREIGN KEY (platforms_slug) REFERENCES platform;
ALTER TABLE detected_game_platforms
ADD CONSTRAINT platforms_detected_game_slug FOREIGN KEY (detected_game_slug) REFERENCES detected_game;
-- Add libraries
-- Libraries
CREATE TABLE library
(
path VARCHAR(255) NOT NULL,
PRIMARY KEY (path)
);
-- Library <-> Platforms
CREATE TABLE library_platforms
(
library_path VARCHAR(255) NOT NULL,
platforms_slug VARCHAR(255) NOT NULL
);
ALTER TABLE library_platforms
ADD CONSTRAINT libraries_platform_slug FOREIGN KEY (platforms_slug) REFERENCES platform;
ALTER TABLE library_platforms
ADD CONSTRAINT libraries_library_path FOREIGN KEY (library_path) REFERENCES library;
-- Library <-> Game
ALTER TABLE detected_game
ADD library VARCHAR(255);