diff --git a/.DS_Store b/.DS_Store index 87c57ab..e163a90 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..507340c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env +WORKDIR /App +EXPOSE 80 + +# Copy everything +COPY . ./ +# Restore as distinct layers +RUN dotnet restore "gaseous-server/gaseous-server.csproj" +# Build and publish a release +RUN dotnet publish "gaseous-server/gaseous-server.csproj" -c Release -o out + +# Build runtime image +FROM mcr.microsoft.com/dotnet/aspnet:7.0 +WORKDIR /App +COPY --from=build-env /App/out . +ENTRYPOINT ["dotnet", "gaseous-server.dll"] diff --git a/Gaseous.sln b/Gaseous.sln index 9d1c2ba..4dd6c98 100644 --- a/Gaseous.sln +++ b/Gaseous.sln @@ -15,6 +15,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gaseous-tools", "gaseous-to EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gaseous-server", "gaseous-server\gaseous-server.csproj", "{A01D2EFF-C82E-473B-84D7-7C25E736F5D2}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{17FA6F12-8532-420C-9489-CB8FDE42137C}" + ProjectSection(SolutionItems) = preProject + docker-compose.yml = docker-compose.yml + Dockerfile = Dockerfile + README.MD = README.MD + LICENSE = LICENSE + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b668bc8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,39 @@ +version: '2' +services: + gaseous-server: + container_name: gaseous-server + build: + context: ./ + restart: unless-stopped + networks: + - gaseous + depends_on: + - gsdb + ports: + - 5198:80 + volumes: + - /Users/michaelgreen/.gaseous-server:/root/.gaseous-server + environment: + - dbhost=gsdb + - dbuser=root + - dbpass=gaseous + - igdbclientid= + - igdbclientsecret= + gsdb: + container_name: gsdb + image: mysql:8 + restart: unless-stopped + networks: + - gaseous + volumes: + - gsdb:/var/lib/mysql + environment: + - MYSQL_ROOT_PASSWORD=gaseous + - MYSQL_USER=gaseous + - MYSQL_PASSWORD=gaseous +networks: + gaseous: + driver: bridge +volumes: + gs: + gsdb: diff --git a/gaseous-server/Classes/ImportGames.cs b/gaseous-server/Classes/ImportGames.cs index 3ba9ef6..ec90903 100644 --- a/gaseous-server/Classes/ImportGames.cs +++ b/gaseous-server/Classes/ImportGames.cs @@ -61,7 +61,7 @@ namespace gaseous_server.Classes Common.hashObject hash = new Common.hashObject(GameFileImportPath); // check to make sure we don't already have this file imported - sql = "SELECT COUNT(Id) AS count FROM games_roms WHERE md5=@md5 AND sha1=@sha1"; + sql = "SELECT COUNT(Id) AS count FROM Games_Roms WHERE MD5=@md5 AND SHA1=@sha1"; dbDict.Add("md5", hash.md5hash); dbDict.Add("sha1", hash.sha1hash); DataTable importDB = db.ExecuteCMD(sql, dbDict); @@ -304,7 +304,7 @@ namespace gaseous_server.Classes if (UpdateId == 0) { - sql = "INSERT INTO games_roms (platformid, gameid, name, size, crc, md5, sha1, developmentstatus, flags, romtype, romtypemedia, medialabel, path, metadatasource) VALUES (@platformid, @gameid, @name, @size, @crc, @md5, @sha1, @developmentstatus, @flags, @romtype, @romtypemedia, @medialabel, @path, @metadatasource); SELECT CAST(LAST_INSERT_ID() AS SIGNED);"; + sql = "INSERT INTO Games_Roms (PlatformId, GameId, Name, Size, CRC, MD5, SHA1, DevelopmentStatus, Flags, RomType, RomTypeMedia, MediaLabel, Path, MetadataSource) VALUES (@platformid, @gameid, @name, @size, @crc, @md5, @sha1, @developmentstatus, @flags, @romtype, @romtypemedia, @medialabel, @path, @metadatasource); SELECT CAST(LAST_INSERT_ID() AS SIGNED);"; } Dictionary dbDict = new Dictionary(); dbDict.Add("platformid", Common.ReturnValueIfNull(determinedPlatform.Id, 0)); @@ -402,7 +402,7 @@ namespace gaseous_server.Classes // update the db Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); - string sql = "UPDATE games_roms SET path=@path WHERE id=@id"; + string sql = "UPDATE Games_Roms SET Path=@path WHERE Id=@id"; Dictionary dbDict = new Dictionary(); dbDict.Add("id", RomId); dbDict.Add("path", DestinationPath); @@ -423,7 +423,7 @@ namespace gaseous_server.Classes // move rom files to their new location Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); - string sql = "SELECT * FROM games_roms"; + string sql = "SELECT * FROM Games_Roms"; DataTable romDT = db.ExecuteCMD(sql); if (romDT.Rows.Count > 0) diff --git a/gaseous-server/Classes/Metadata/Games.cs b/gaseous-server/Classes/Metadata/Games.cs index 09a6be6..9a11be1 100644 --- a/gaseous-server/Classes/Metadata/Games.cs +++ b/gaseous-server/Classes/Metadata/Games.cs @@ -26,7 +26,7 @@ namespace gaseous_server.Classes.Metadata if (Id == 0) { Game returnValue = new Game(); - if (Storage.GetCacheStatus("game", 0) == Storage.CacheStatus.NotPresent) + if (Storage.GetCacheStatus("Game", 0) == Storage.CacheStatus.NotPresent) { returnValue = new Game { diff --git a/gaseous-server/Classes/Metadata/Platforms.cs b/gaseous-server/Classes/Metadata/Platforms.cs index 4e3fefa..b61969b 100644 --- a/gaseous-server/Classes/Metadata/Platforms.cs +++ b/gaseous-server/Classes/Metadata/Platforms.cs @@ -27,7 +27,7 @@ namespace gaseous_server.Classes.Metadata if (Id == 0) { Platform returnValue = new Platform(); - if (Storage.GetCacheStatus("platform", 0) == Storage.CacheStatus.NotPresent) + if (Storage.GetCacheStatus("Platform", 0) == Storage.CacheStatus.NotPresent) { returnValue = new Platform { @@ -63,11 +63,11 @@ namespace gaseous_server.Classes.Metadata Storage.CacheStatus? cacheStatus = new Storage.CacheStatus(); if (searchUsing == SearchUsing.id) { - cacheStatus = Storage.GetCacheStatus("platform", (long)searchValue); + cacheStatus = Storage.GetCacheStatus("Platform", (long)searchValue); } else { - cacheStatus = Storage.GetCacheStatus("platform", (string)searchValue); + cacheStatus = Storage.GetCacheStatus("Platform", (string)searchValue); } // set up where clause diff --git a/gaseous-server/Classes/MetadataManagement.cs b/gaseous-server/Classes/MetadataManagement.cs index 8190f53..62e66f7 100644 --- a/gaseous-server/Classes/MetadataManagement.cs +++ b/gaseous-server/Classes/MetadataManagement.cs @@ -9,7 +9,7 @@ namespace gaseous_server.Classes public static void RefreshMetadata(bool forceRefresh = false) { Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); - string sql = "SELECT id, `name` FROM game;"; + string sql = "SELECT Id, `Name` FROM Game;"; DataTable dt = db.ExecuteCMD(sql); foreach (DataRow dr in dt.Rows) diff --git a/gaseous-server/Classes/Roms.cs b/gaseous-server/Classes/Roms.cs index 919525a..a22b3e4 100644 --- a/gaseous-server/Classes/Roms.cs +++ b/gaseous-server/Classes/Roms.cs @@ -9,7 +9,7 @@ namespace gaseous_server.Classes public static List GetRoms(long GameId) { Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); - string sql = "SELECT * FROM games_roms WHERE gameid = @id ORDER BY `name`"; + string sql = "SELECT * FROM Games_Roms WHERE GameId = @id ORDER BY `Name`"; Dictionary dbDict = new Dictionary(); dbDict.Add("id", GameId); DataTable romDT = db.ExecuteCMD(sql, dbDict); @@ -33,7 +33,7 @@ namespace gaseous_server.Classes public static GameRomItem GetRom(long RomId) { Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); - string sql = "SELECT * FROM games_roms WHERE id = @id"; + string sql = "SELECT * FROM Games_Roms WHERE Id = @id"; Dictionary dbDict = new Dictionary(); dbDict.Add("id", RomId); DataTable romDT = db.ExecuteCMD(sql, dbDict); @@ -59,7 +59,7 @@ namespace gaseous_server.Classes IGDB.Models.Game game = Classes.Metadata.Games.GetGame(GameId, false, false); Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); - string sql = "UPDATE games_roms SET platformid=@platformid, gameid=@gameid WHERE id = @id"; + string sql = "UPDATE Games_Roms SET PlatformId=@platformid, GameId=@gameid WHERE Id = @id"; Dictionary dbDict = new Dictionary(); dbDict.Add("id", RomId); dbDict.Add("platformid", PlatformId); @@ -80,7 +80,7 @@ namespace gaseous_server.Classes } Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); - string sql = "DELETE FROM games_roms WHERE id = @id"; + string sql = "DELETE FROM Games_Roms WHERE Id = @id"; Dictionary dbDict = new Dictionary(); dbDict.Add("id", RomId); db.ExecuteCMD(sql, dbDict); diff --git a/gaseous-server/Classes/SignatureIngestors/TOSEC.cs b/gaseous-server/Classes/SignatureIngestors/TOSEC.cs index 72de44a..85b4557 100644 --- a/gaseous-server/Classes/SignatureIngestors/TOSEC.cs +++ b/gaseous-server/Classes/SignatureIngestors/TOSEC.cs @@ -32,7 +32,7 @@ namespace gaseous_server.SignatureIngestors.TOSEC // check tosec file md5 Common.hashObject hashObject = new Common.hashObject(tosecXMLFile); - sql = "SELECT * FROM signatures_sources WHERE sourcemd5=@sourcemd5"; + sql = "SELECT * FROM Signatures_Sources WHERE SourceMD5=@sourcemd5"; dbDict = new Dictionary(); dbDict.Add("sourcemd5", hashObject.md5hash); sigDB = db.ExecuteCMD(sql, dbDict); @@ -51,7 +51,7 @@ namespace gaseous_server.SignatureIngestors.TOSEC bool processGames = false; if (tosecObject.SourceMd5 != null) { - sql = "SELECT * FROM signatures_sources WHERE sourcemd5=@sourcemd5"; + sql = "SELECT * FROM Signatures_Sources WHERE SourceMD5=@sourcemd5"; dbDict = new Dictionary(); dbDict.Add("name", Common.ReturnValueIfNull(tosecObject.Name, "")); dbDict.Add("description", Common.ReturnValueIfNull(tosecObject.Description, "")); @@ -69,7 +69,7 @@ namespace gaseous_server.SignatureIngestors.TOSEC if (sigDB.Rows.Count == 0) { // entry not present, insert it - sql = "INSERT INTO signatures_sources (name, description, category, version, author, email, homepage, url, sourcetype, sourcemd5, sourcesha1) VALUES (@name, @description, @category, @version, @author, @email, @homepage, @uri, @sourcetype, @sourcemd5, @sourcesha1)"; + sql = "INSERT INTO Signatures_Sources (Name, Description, Category, Version, Author, Email, Homepage, Url, SourceType, SourceMD5, SourceSHA1) VALUES (@name, @description, @category, @version, @author, @email, @homepage, @uri, @sourcetype, @sourcemd5, @sourcesha1)"; db.ExecuteCMD(sql, dbDict); @@ -101,13 +101,13 @@ namespace gaseous_server.SignatureIngestors.TOSEC int gameSystem = 0; if (gameObject.System != null) { - sql = "SELECT id FROM signatures_platforms WHERE platform=@platform"; + sql = "SELECT Id FROM Signatures_Platforms WHERE Platform=@platform"; sigDB = db.ExecuteCMD(sql, dbDict); if (sigDB.Rows.Count == 0) { // entry not present, insert it - sql = "INSERT INTO signatures_platforms (platform) VALUES (@platform); SELECT CAST(LAST_INSERT_ID() AS SIGNED);"; + sql = "INSERT INTO Signatures_Platforms (Platform) VALUES (@platform); SELECT CAST(LAST_INSERT_ID() AS SIGNED);"; sigDB = db.ExecuteCMD(sql, dbDict); gameSystem = Convert.ToInt32(sigDB.Rows[0][0]); @@ -123,13 +123,13 @@ namespace gaseous_server.SignatureIngestors.TOSEC int gamePublisher = 0; if (gameObject.Publisher != null) { - sql = "SELECT * FROM signatures_publishers WHERE publisher=@publisher"; + sql = "SELECT * FROM Signatures_Publishers WHERE Publisher=@publisher"; sigDB = db.ExecuteCMD(sql, dbDict); if (sigDB.Rows.Count == 0) { // entry not present, insert it - sql = "INSERT INTO signatures_publishers (publisher) VALUES (@publisher); SELECT CAST(LAST_INSERT_ID() AS SIGNED);"; + sql = "INSERT INTO Signatures_Publishers (Publisher) VALUES (@publisher); SELECT CAST(LAST_INSERT_ID() AS SIGNED);"; sigDB = db.ExecuteCMD(sql, dbDict); gamePublisher = Convert.ToInt32(sigDB.Rows[0][0]); } @@ -142,14 +142,14 @@ namespace gaseous_server.SignatureIngestors.TOSEC // store game int gameId = 0; - sql = "SELECT * FROM signatures_games WHERE name=@name AND year=@year AND publisherid=@publisher AND systemid=@systemid AND country=@country AND language=@language"; + sql = "SELECT * FROM Signatures_Games WHERE Name=@name AND Year=@year AND Publisherid=@publisher AND Systemid=@systemid AND Country=@country AND Language=@language"; sigDB = db.ExecuteCMD(sql, dbDict); if (sigDB.Rows.Count == 0) { // entry not present, insert it - sql = "INSERT INTO signatures_games " + - "(name, description, year, publisherid, demo, systemid, systemvariant, video, country, language, copyright) VALUES " + + sql = "INSERT INTO Signatures_Games " + + "(Name, Description, Year, PublisherId, Demo, SystemId, SystemVariant, Video, Country, Language, Copyright) VALUES " + "(@name, @description, @year, @publisherid, @demo, @systemid, @systemvariant, @video, @country, @language, @copyright); SELECT CAST(LAST_INSERT_ID() AS SIGNED);"; sigDB = db.ExecuteCMD(sql, dbDict); @@ -166,7 +166,7 @@ namespace gaseous_server.SignatureIngestors.TOSEC if (romObject.Md5 != null) { int romId = 0; - sql = "SELECT * FROM signatures_roms WHERE gameid=@gameid AND md5=@md5"; + sql = "SELECT * FROM Signatures_Roms WHERE GameId=@gameid AND MD5=@md5"; dbDict = new Dictionary(); dbDict.Add("gameid", gameId); dbDict.Add("name", Common.ReturnValueIfNull(romObject.Name, "")); @@ -200,7 +200,7 @@ namespace gaseous_server.SignatureIngestors.TOSEC if (sigDB.Rows.Count == 0) { // entry not present, insert it - sql = "INSERT INTO signatures_roms (gameid, name, size, crc, md5, sha1, developmentstatus, flags, romtype, romtypemedia, medialabel, metadatasource) VALUES (@gameid, @name, @size, @crc, @md5, @sha1, @developmentstatus, @flags, @romtype, @romtypemedia, @medialabel, @metadatasource); SELECT CAST(LAST_INSERT_ID() AS SIGNED);"; + sql = "INSERT INTO Signatures_Roms (GameId, Name, Size, CRC, MD5, SHA1, DevelopmentStatus, Flags, RomType, RomTypeMedia, MediaLabel, MetadataSource) VALUES (@gameid, @name, @size, @crc, @md5, @sha1, @developmentstatus, @flags, @romtype, @romtypemedia, @medialabel, @metadatasource); SELECT CAST(LAST_INSERT_ID() AS SIGNED);"; sigDB = db.ExecuteCMD(sql, dbDict); diff --git a/gaseous-server/Controllers/FilterController.cs b/gaseous-server/Controllers/FilterController.cs index 865510a..1a5b31a 100644 --- a/gaseous-server/Controllers/FilterController.cs +++ b/gaseous-server/Controllers/FilterController.cs @@ -25,7 +25,7 @@ namespace gaseous_server.Controllers // platforms List platforms = new List(); - string sql = "SELECT platform.id, platform.abbreviation, platform.alternativename, platform.`name`, platform.platformlogo, (SELECT COUNT(games_roms.id) AS RomCount FROM games_roms WHERE games_roms.platformid = platform.id) AS RomCount FROM platform HAVING RomCount > 0 ORDER BY `name`"; + string sql = "SELECT Platform.Id, Platform.Abbreviation, Platform.AlternativeName, Platform.`Name`, Platform.PlatformLogo, (SELECT COUNT(Games_Roms.Id) AS RomCount FROM Games_Roms WHERE Games_Roms.PlatformId = Platform.Id) AS RomCount FROM Platform HAVING RomCount > 0 ORDER BY `Name`"; DataTable dbResponse = db.ExecuteCMD(sql); foreach (DataRow dr in dbResponse.Rows) @@ -36,7 +36,7 @@ namespace gaseous_server.Controllers // genres List genres = new List(); - sql = "SELECT DISTINCT t1.id, t1.`name` FROM genre AS t1 JOIN (SELECT * FROM game WHERE (SELECT COUNT(id) FROM games_roms WHERE gameid = game.id) > 0) AS t2 ON JSON_CONTAINS(t2.genres, CAST(t1.id AS char), '$') ORDER BY t1.`name`"; + sql = "SELECT DISTINCT t1.Id, t1.`Name` FROM Genre AS t1 JOIN (SELECT * FROM Game WHERE (SELECT COUNT(Id) FROM Games_Roms WHERE GameId = Game.Id) > 0) AS t2 ON JSON_CONTAINS(t2.Genres, CAST(t1.Id AS char), '$') ORDER BY t1.`Name`"; dbResponse = db.ExecuteCMD(sql); foreach (DataRow dr in dbResponse.Rows) diff --git a/gaseous-server/Controllers/GamesController.cs b/gaseous-server/Controllers/GamesController.cs index 5ec5efc..4946243 100644 --- a/gaseous-server/Controllers/GamesController.cs +++ b/gaseous-server/Controllers/GamesController.cs @@ -36,14 +36,14 @@ namespace gaseous_server.Controllers if (name.Length > 0) { - tempVal = "`name` LIKE @name"; - whereParams.Add("@name", "%" + name + "%"); + tempVal = "`Name` LIKE @Name"; + whereParams.Add("@Name", "%" + name + "%"); havingClauses.Add(tempVal); } if (platform.Length > 0) { - tempVal = "games_roms.platformid IN ("; + tempVal = "Games_Roms.PlatformId IN ("; string[] platformClauseItems = platform.Split(","); for (int i = 0; i < platformClauseItems.Length; i++) { @@ -51,7 +51,7 @@ namespace gaseous_server.Controllers { tempVal += ", "; } - string platformLabel = "@platform" + i; + string platformLabel = "@Platform" + i; tempVal += platformLabel; whereParams.Add(platformLabel, platformClauseItems[i]); } @@ -69,8 +69,8 @@ namespace gaseous_server.Controllers { tempVal += " AND "; } - string genreLabel = "@genre" + i; - tempVal += "JSON_CONTAINS(game.genres, " + genreLabel + ", '$')"; + string genreLabel = "@Genre" + i; + tempVal += "JSON_CONTAINS(Game.Genres, " + genreLabel + ", '$')"; whereParams.Add(genreLabel, genreClauseItems[i]); } tempVal += ")"; @@ -106,14 +106,14 @@ namespace gaseous_server.Controllers } // order by clause - string orderByClause = "ORDER BY `name` ASC"; + string orderByClause = "ORDER BY `Name` ASC"; if (sortdescending == true) { - orderByClause = "ORDER BY `name` DESC"; + orderByClause = "ORDER BY `Name` DESC"; } Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); - string sql = "SELECT DISTINCT games_roms.gameid AS ROMGameId, game.id, game.ageratings, game.aggregatedrating, game.aggregatedratingcount, game.alternativenames, game.artworks, game.bundles, game.category, game.collection, game.cover, game.dlcs, game.expansions, game.externalgames, game.firstreleasedate, game.`follows`, game.franchise, game.franchises, game.gameengines, game.gamemodes, game.genres, game.hypes, game.involvedcompanies, game.keywords, game.multiplayermodes, game.`name`, game.parentgame, game.platforms, game.playerperspectives, game.rating, game.ratingcount, game.releasedates, game.screenshots, game.similargames, game.slug, game.standaloneexpansions, game.`status`, game.storyline, game.summary, game.tags, game.themes, game.totalrating, game.totalratingcount, game.versionparent, game.versiontitle, game.videos, game.websites FROM gaseous.games_roms LEFT JOIN game ON game.id = games_roms.gameid " + whereClause + " " + havingClause + " " + orderByClause; + string sql = "SELECT DISTINCT Games_Roms.GameId AS ROMGameId, Game.Id, Game.AgeRatings, Game.AggregatedRating, Game.AggregatedRatingCount, Game.AlternativeNames, Game.Artworks, Game.Bundles, Game.Category, Game.Collection, Game.Cover, Game.Dlcs, Game.Expansions, Game.ExternalGames, Game.FirstReleaseDate, Game.`Follows`, Game.Franchise, Game.Franchises, Game.GameEngines, Game.GameModes, Game.Genres, Game.Hypes, Game.InvolvedCompanies, Game.Keywords, Game.MultiplayerModes, Game.`Name`, Game.ParentGame, Game.Platforms, Game.PlayerPerspectives, Game.Rating, Game.RatingCount, Game.ReleaseDates, Game.Screenshots, Game.SimilarGames, Game.Slug, Game.StandaloneExpansions, Game.`Status`, Game.StoryLine, Game.Summary, Game.Tags, Game.Themes, Game.TotalRating, Game.TotalRatingCount, Game.VersionParent, Game.VersionTitle, Game.Videos, Game.Websites FROM gaseous.Games_Roms LEFT JOIN Game ON Game.Id = Games_Roms.GameId " + whereClause + " " + havingClause + " " + orderByClause; List RetVal = new List(); diff --git a/gaseous-server/Controllers/PlatformsController.cs b/gaseous-server/Controllers/PlatformsController.cs index 650ea7d..7b5fb0c 100644 --- a/gaseous-server/Controllers/PlatformsController.cs +++ b/gaseous-server/Controllers/PlatformsController.cs @@ -24,7 +24,7 @@ namespace gaseous_server.Controllers { Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); - string sql = "SELECT * FROM gaseous.platform WHERE id IN (SELECT DISTINCT platformid FROM games_roms) ORDER BY `name` ASC;"; + string sql = "SELECT * FROM gaseous.Platform WHERE Id IN (SELECT DISTINCT PlatformId FROM Games_Roms) ORDER BY `Name` ASC;"; List RetVal = new List(); diff --git a/gaseous-server/Controllers/SignaturesController.cs b/gaseous-server/Controllers/SignaturesController.cs index 4d521dc..5aa2672 100644 --- a/gaseous-server/Controllers/SignaturesController.cs +++ b/gaseous-server/Controllers/SignaturesController.cs @@ -32,10 +32,10 @@ namespace gaseous_server.Controllers { if (md5.Length > 0) { - return _GetSignature("signatures_roms.md5 = @searchstring", md5); + return _GetSignature("Signatures_Roms.md5 = @searchstring", md5); } else { - return _GetSignature("signatures_roms.sha1 = @searchstring", sha1); + return _GetSignature("Signatures_Roms.sha1 = @searchstring", sha1); } } @@ -45,7 +45,7 @@ namespace gaseous_server.Controllers { if (TosecName.Length > 0) { - return _GetSignature("signatures_roms.name = @searchstring", TosecName); + return _GetSignature("Signatures_Roms.name = @searchstring", TosecName); } else { return null; @@ -55,7 +55,7 @@ namespace gaseous_server.Controllers private List _GetSignature(string sqlWhere, string searchString) { Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); - string sql = "SELECT \n view_signatures_games.*,\n signatures_roms.id AS romid,\n signatures_roms.name AS romname,\n signatures_roms.size,\n signatures_roms.crc,\n signatures_roms.md5,\n signatures_roms.sha1,\n signatures_roms.developmentstatus,\n signatures_roms.flags,\n signatures_roms.romtype,\n signatures_roms.romtypemedia,\n signatures_roms.medialabel,\n signatures_roms.metadatasource\nFROM\n signatures_roms\n INNER JOIN\n view_signatures_games ON signatures_roms.gameid = view_signatures_games.id WHERE " + sqlWhere; + string sql = "SELECT view_Signatures_Games.*, Signatures_Roms.Id AS romid, Signatures_Roms.Name AS romname, Signatures_Roms.Size, Signatures_Roms.CRC, Signatures_Roms.MD5, Signatures_Roms.SHA1, Signatures_Roms.DevelopmentStatus, Signatures_Roms.Flags, Signatures_Roms.RomType, Signatures_Roms.RomTypeMedia, Signatures_Roms.MediaLabel, Signatures_Roms.MetadataSource FROM Signatures_Roms INNER JOIN view_Signatures_Games ON Signatures_Roms.GameId = view_Signatures_Games.Id WHERE " + sqlWhere; Dictionary dbDict = new Dictionary(); dbDict.Add("searchString", searchString); @@ -69,33 +69,33 @@ namespace gaseous_server.Controllers { Game = new Models.Signatures_Games.GameItem { - Id = (Int32)sigDbRow["id"], - Name = (string)sigDbRow["name"], - Description = (string)sigDbRow["description"], - Year = (string)sigDbRow["year"], - Publisher = (string)sigDbRow["publisher"], - Demo = (Models.Signatures_Games.GameItem.DemoTypes)(int)sigDbRow["demo"], - System = (string)sigDbRow["platform"], - SystemVariant = (string)sigDbRow["systemvariant"], - Video = (string)sigDbRow["video"], - Country = (string)sigDbRow["country"], - Language = (string)sigDbRow["language"], - Copyright = (string)sigDbRow["copyright"] + Id = (Int32)sigDbRow["Id"], + Name = (string)sigDbRow["Name"], + Description = (string)sigDbRow["Description"], + Year = (string)sigDbRow["Year"], + Publisher = (string)sigDbRow["Publisher"], + Demo = (Models.Signatures_Games.GameItem.DemoTypes)(int)sigDbRow["Demo"], + System = (string)sigDbRow["Platform"], + SystemVariant = (string)sigDbRow["SystemVariant"], + Video = (string)sigDbRow["Video"], + Country = (string)sigDbRow["Country"], + Language = (string)sigDbRow["Language"], + Copyright = (string)sigDbRow["Copyright"] }, Rom = new Models.Signatures_Games.RomItem { Id = (Int32)sigDbRow["romid"], Name = (string)sigDbRow["romname"], - Size = (Int64)sigDbRow["size"], - Crc = (string)sigDbRow["crc"], - Md5 = (string)sigDbRow["md5"], - Sha1 = (string)sigDbRow["sha1"], - DevelopmentStatus = (string)sigDbRow["developmentstatus"], - flags = Newtonsoft.Json.JsonConvert.DeserializeObject>((string)sigDbRow["flags"]), - RomType = (Models.Signatures_Games.RomItem.RomTypes)(int)sigDbRow["romtype"], - RomTypeMedia = (string)sigDbRow["romtypemedia"], - MediaLabel = (string)sigDbRow["medialabel"], - SignatureSource = (Models.Signatures_Games.RomItem.SignatureSourceType)(Int32)sigDbRow["metadatasource"] + Size = (Int64)sigDbRow["Size"], + Crc = (string)sigDbRow["CRC"], + Md5 = (string)sigDbRow["MD5"], + Sha1 = (string)sigDbRow["SHA1"], + DevelopmentStatus = (string)sigDbRow["SevelopmentStatus"], + flags = Newtonsoft.Json.JsonConvert.DeserializeObject>((string)sigDbRow["Flags"]), + RomType = (Models.Signatures_Games.RomItem.RomTypes)(int)sigDbRow["RomType"], + RomTypeMedia = (string)sigDbRow["RomTypeMedia"], + MediaLabel = (string)sigDbRow["MediaLabel"], + SignatureSource = (Models.Signatures_Games.RomItem.SignatureSourceType)(Int32)sigDbRow["MetadataSource"] } }; GamesList.Add(gameItem); diff --git a/gaseous-server/Models/Signatures_Status.cs b/gaseous-server/Models/Signatures_Status.cs index 8d2c904..44f9cac 100644 --- a/gaseous-server/Models/Signatures_Status.cs +++ b/gaseous-server/Models/Signatures_Status.cs @@ -15,7 +15,7 @@ namespace gaseous_server.Models public Signatures_Status() { Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); - string sql = "select (select count(*) from signatures_sources) as SourceCount, (select count(*) from signatures_platforms) as PlatformCount, (select count(*) from signatures_games) as GameCount, (select count(*) from signatures_roms) as RomCount;"; + string sql = "select (select count(*) from Signatures_Sources) as SourceCount, (select count(*) from Signatures_Platforms) as PlatformCount, (select count(*) from Signatures_Games) as GameCount, (select count(*) from Signatures_Roms) as RomCount;"; DataTable sigDb = db.ExecuteCMD(sql); if (sigDb.Rows.Count > 0) diff --git a/gaseous-server/Program.cs b/gaseous-server/Program.cs index 7ae0da9..28ed3cd 100644 --- a/gaseous-server/Program.cs +++ b/gaseous-server/Program.cs @@ -63,13 +63,13 @@ builder.Services.AddHostedService(); var app = builder.Build(); // Configure the HTTP request pipeline. -if (app.Environment.IsDevelopment()) -{ +//if (app.Environment.IsDevelopment()) +//{ app.UseSwagger(); app.UseSwaggerUI(); -} +//} -app.UseHttpsRedirection(); +//app.UseHttpsRedirection(); app.UseResponseCaching(); diff --git a/gaseous-server/gaseous-server.csproj b/gaseous-server/gaseous-server.csproj index 547584f..8cbfa7d 100644 --- a/gaseous-server/gaseous-server.csproj +++ b/gaseous-server/gaseous-server.csproj @@ -119,14 +119,6 @@ - - - - - - - - @@ -173,7 +165,4 @@ - - - diff --git a/gaseous-signature-ingestor/Program.cs b/gaseous-signature-ingestor/Program.cs index 5108736..3a0b65b 100644 --- a/gaseous-signature-ingestor/Program.cs +++ b/gaseous-signature-ingestor/Program.cs @@ -86,7 +86,7 @@ if (Directory.Exists(tosecXML)) // check tosec file md5 Console.WriteLine(" ==> Checking input file "); Common.hashObject hashObject = new Common.hashObject(tosecXMLFile); - sql = "SELECT * FROM signatures_sources WHERE sourcemd5=@sourcemd5"; + sql = "SELECT * FROM Signatures_Sources WHERE SourceMD5=@sourcemd5"; dbDict = new Dictionary(); dbDict.Add("sourcemd5", hashObject.md5hash); sigDB = db.ExecuteCMD(sql, dbDict); @@ -108,7 +108,7 @@ if (Directory.Exists(tosecXML)) Console.SetCursorPosition(0, Console.CursorTop - 1); Console.WriteLine(" ==> Storing file in database "); - sql = "SELECT * FROM signatures_sources WHERE sourcemd5=@sourcemd5"; + sql = "SELECT * FROM Signatures_Sources WHERE SourceMD5=@sourcemd5"; dbDict = new Dictionary(); dbDict.Add("name", Common.ReturnValueIfNull(tosecObject.Name, "")); dbDict.Add("description", Common.ReturnValueIfNull(tosecObject.Description, "")); @@ -126,7 +126,7 @@ if (Directory.Exists(tosecXML)) if (sigDB.Rows.Count == 0) { // entry not present, insert it - sql = "INSERT INTO signatures_sources (name, description, category, version, author, email, homepage, url, sourcetype, sourcemd5, sourcesha1) VALUES (@name, @description, @category, @version, @author, @email, @homepage, @uri, @sourcetype, @sourcemd5, @sourcesha1)"; + sql = "INSERT INTO Signatures_Sources (Name, Description, Category, Version, Author, Email, Homepage, Url, SourceType, SourceMD5, sourceSHA1) VALUES (@name, @description, @category, @version, @author, @email, @homepage, @uri, @sourcetype, @sourcemd5, @sourcesha1)"; db.ExecuteCMD(sql, dbDict); @@ -167,13 +167,13 @@ if (Directory.Exists(tosecXML)) int gameSystem = 0; if (gameObject.System != null) { - sql = "SELECT id FROM signatures_platforms WHERE platform=@platform"; + sql = "SELECT Id FROM Signatures_Platforms WHERE Platform=@platform"; sigDB = db.ExecuteCMD(sql, dbDict); if (sigDB.Rows.Count == 0) { // entry not present, insert it - sql = "INSERT INTO signatures_platforms (platform) VALUES (@platform); SELECT CAST(LAST_INSERT_ID() AS SIGNED);"; + sql = "INSERT INTO Signatures_Platforms (Platform) VALUES (@platform); SELECT CAST(LAST_INSERT_ID() AS SIGNED);"; sigDB = db.ExecuteCMD(sql, dbDict); gameSystem = Convert.ToInt32(sigDB.Rows[0][0]); @@ -189,13 +189,13 @@ if (Directory.Exists(tosecXML)) int gamePublisher = 0; if (gameObject.Publisher != null) { - sql = "SELECT * FROM signatures_publishers WHERE publisher=@publisher"; + sql = "SELECT * FROM Signatures_Publishers WHERE Publisher=@publisher"; sigDB = db.ExecuteCMD(sql, dbDict); if (sigDB.Rows.Count == 0) { // entry not present, insert it - sql = "INSERT INTO signatures_publishers (publisher) VALUES (@publisher); SELECT CAST(LAST_INSERT_ID() AS SIGNED);"; + sql = "INSERT INTO Signatures_Publishers (Publisher) VALUES (@publisher); SELECT CAST(LAST_INSERT_ID() AS SIGNED);"; sigDB = db.ExecuteCMD(sql, dbDict); gamePublisher = Convert.ToInt32(sigDB.Rows[0][0]); } @@ -208,14 +208,14 @@ if (Directory.Exists(tosecXML)) // store game int gameId = 0; - sql = "SELECT * FROM signatures_games WHERE name=@name AND year=@year AND publisherid=@publisher AND systemid=@systemid AND country=@country AND language=@language"; + sql = "SELECT * FROM Signatures_Games WHERE Name=@name AND Year=@year AND PublisherId=@publisher AND SystemId=@systemid AND Country=@country AND Language=@language"; sigDB = db.ExecuteCMD(sql, dbDict); if (sigDB.Rows.Count == 0) { // entry not present, insert it - sql = "INSERT INTO signatures_games " + - "(name, description, year, publisherid, demo, systemid, systemvariant, video, country, language, copyright) VALUES " + + sql = "INSERT INTO Signatures_Games " + + "(Name, Description, Year, PublisherId, Demo, SystemId, SystemVariant, Video, Country, Language, Copyright) VALUES " + "(@name, @description, @year, @publisherid, @demo, @systemid, @systemvariant, @video, @country, @language, @copyright); SELECT CAST(LAST_INSERT_ID() AS SIGNED);"; sigDB = db.ExecuteCMD(sql, dbDict); @@ -232,7 +232,7 @@ if (Directory.Exists(tosecXML)) if (romObject.Md5 != null) { int romId = 0; - sql = "SELECT * FROM signatures_roms WHERE gameid=@gameid AND md5=@md5"; + sql = "SELECT * FROM Signatures_Roms WHERE GameId=@gameid AND MD5=@md5"; dbDict = new Dictionary(); dbDict.Add("gameid", gameId); dbDict.Add("name", Common.ReturnValueIfNull(romObject.Name, "")); @@ -265,7 +265,7 @@ if (Directory.Exists(tosecXML)) if (sigDB.Rows.Count == 0) { // entry not present, insert it - sql = "INSERT INTO signatures_roms (gameid, name, size, crc, md5, sha1, developmentstatus, flags, romtype, romtypemedia, medialabel) VALUES (@gameid, @name, @size, @crc, @md5, @sha1, @developmentstatus, @flags, @romtype, @romtypemedia, @medialabel); SELECT CAST(LAST_INSERT_ID() AS SIGNED);"; + sql = "INSERT INTO Signatures_Roms (GameId, Name, Size, CRC, MD5, SHA1, DevelopmentStatus, Flags, RomType, RomTypeMedia, MediaLabel) VALUES (@gameid, @name, @size, @crc, @md5, @sha1, @developmentstatus, @flags, @romtype, @romtypemedia, @medialabel); SELECT CAST(LAST_INSERT_ID() AS SIGNED);"; sigDB = db.ExecuteCMD(sql, dbDict); diff --git a/gaseous-tools/Config.cs b/gaseous-tools/Config.cs index a2292dd..241916d 100644 --- a/gaseous-tools/Config.cs +++ b/gaseous-tools/Config.cs @@ -127,6 +127,11 @@ namespace gaseous_tools serializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter()); string configRaw = Newtonsoft.Json.JsonConvert.SerializeObject(_config, serializerSettings); + if (!Directory.Exists(ConfigurationPath)) + { + Directory.CreateDirectory(ConfigurationPath); + } + if (File.Exists(ConfigurationFilePath_Backup)) { File.Delete(ConfigurationFilePath_Backup); @@ -143,18 +148,18 @@ namespace gaseous_tools public static void InitSettings() { Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); - string sql = "SELECT * FROM settings"; + string sql = "SELECT * FROM Settings"; DataTable dbResponse = db.ExecuteCMD(sql); foreach (DataRow dataRow in dbResponse.Rows) { - if (AppSettings.ContainsKey((string)dataRow["setting"])) + if (AppSettings.ContainsKey((string)dataRow["Setting"])) { - AppSettings[(string)dataRow["setting"]] = (string)dataRow["value"]; + AppSettings[(string)dataRow["Setting"]] = (string)dataRow["Value"]; } else { - AppSettings.Add((string)dataRow["setting"], (string)dataRow["value"]); + AppSettings.Add((string)dataRow["Setting"], (string)dataRow["Value"]); } } } @@ -168,10 +173,10 @@ namespace gaseous_tools else { Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); - string sql = "SELECT * FROM settings WHERE setting = @settingname"; + string sql = "SELECT * FROM Settings WHERE Setting = @SettingName"; Dictionary dbDict = new Dictionary(); - dbDict.Add("settingname", SettingName); - dbDict.Add("value", DefaultValue); + dbDict.Add("SettingName", SettingName); + dbDict.Add("Value", DefaultValue); try { @@ -200,10 +205,10 @@ namespace gaseous_tools public static void SetSetting(string SettingName, string Value) { Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); - string sql = "REPLACE INTO settings (setting, value) VALUES (@settingname, @value)"; + string sql = "REPLACE INTO Settings (Setting, Value) VALUES (@SettingName, @Value)"; Dictionary dbDict = new Dictionary(); - dbDict.Add("settingname", SettingName); - dbDict.Add("value", Value); + dbDict.Add("SettingName", SettingName); + dbDict.Add("Value", Value); Logging.Log(Logging.LogType.Debug, "Database", "Storing setting '" + SettingName + "' to value: '" + Value + "'"); try diff --git a/gaseous-tools/Database/MySQL/gaseous-1000.sql b/gaseous-tools/Database/MySQL/gaseous-1000.sql index ee50687..d81d13f 100644 --- a/gaseous-tools/Database/MySQL/gaseous-1000.sql +++ b/gaseous-tools/Database/MySQL/gaseous-1000.sql @@ -7,7 +7,7 @@ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!50503 SET NAMES utf8 */; +/*!50503 SET NameS utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -16,659 +16,660 @@ /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- --- Table structure for table `agerating` +-- Table structure for table `AgeRating` -- -DROP TABLE IF EXISTS `agerating`; +DROP TABLE IF EXISTS `AgeRating`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `agerating` ( - `id` bigint NOT NULL, - `category` int DEFAULT NULL, - `checksum` varchar(45) DEFAULT NULL, - `contentdescriptions` json DEFAULT NULL, - `rating` int DEFAULT NULL, - `ratingcoverurl` varchar(255) DEFAULT NULL, - `synopsis` longtext, +CREATE TABLE `AgeRating` ( + `Id` bigint NOT NULL, + `Category` int DEFAULT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `ContentDescriptions` json DEFAULT NULL, + `Rating` int DEFAULT NULL, + `RatingCoverUrl` varchar(255) DEFAULT NULL, + `Synopsis` longtext, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `ageratingcontentdescription` +-- Table structure for table `AgeRatingContentDescription` -- -DROP TABLE IF EXISTS `ageratingcontentdescription`; +DROP TABLE IF EXISTS `AgeRatingContentDescription`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `ageratingcontentdescription` ( - `id` bigint NOT NULL, - `category` int DEFAULT NULL, - `checksum` varchar(45) DEFAULT NULL, - `description` varchar(255) DEFAULT NULL, +CREATE TABLE `AgeRatingContentDescription` ( + `Id` bigint NOT NULL, + `Category` int DEFAULT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `Description` varchar(255) DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `alternativename` +-- Table structure for table `AlternativeName` -- -DROP TABLE IF EXISTS `alternativename`; +DROP TABLE IF EXISTS `AlternativeName`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `alternativename` ( - `id` bigint NOT NULL, - `checksum` varchar(45) DEFAULT NULL, - `comment` longtext, - `game` bigint DEFAULT NULL, - `name` varchar(255) DEFAULT NULL, +CREATE TABLE `AlternativeName` ( + `Id` bigint NOT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `Comment` longtext, + `Game` bigint DEFAULT NULL, + `Name` varchar(255) DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `artwork` +-- Table structure for table `Artwork` -- -DROP TABLE IF EXISTS `artwork`; +DROP TABLE IF EXISTS `Artwork`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `artwork` ( - `id` bigint NOT NULL, - `alphachannel` tinyint(1) DEFAULT NULL, - `animated` tinyint(1) DEFAULT NULL, - `checksum` varchar(45) DEFAULT NULL, - `game` bigint DEFAULT NULL, - `height` int DEFAULT NULL, - `imageid` varchar(45) DEFAULT NULL, - `url` varchar(255) DEFAULT NULL, - `width` int DEFAULT NULL, +CREATE TABLE `Artwork` ( + `Id` bigint NOT NULL, + `AlphaChannel` tinyint(1) DEFAULT NULL, + `Animated` tinyint(1) DEFAULT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `Game` bigint DEFAULT NULL, + `Height` int DEFAULT NULL, + `ImageId` varchar(45) DEFAULT NULL, + `Url` varchar(255) DEFAULT NULL, + `Width` int DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `collection` +-- Table structure for table `Collection` -- -DROP TABLE IF EXISTS `collection`; +DROP TABLE IF EXISTS `Collection`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `collection` ( - `id` bigint NOT NULL, - `checksum` varchar(45) DEFAULT NULL, - `games` json DEFAULT NULL, - `name` varchar(255) DEFAULT NULL, - `slug` varchar(100) DEFAULT NULL, - `createdAt` datetime DEFAULT NULL, - `updatedAt` datetime DEFAULT NULL, - `url` varchar(255) DEFAULT NULL, +CREATE TABLE `Collection` ( + `Id` bigint NOT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `Games` json DEFAULT NULL, + `Name` varchar(255) DEFAULT NULL, + `Slug` varchar(100) DEFAULT NULL, + `CreatedAt` datetime DEFAULT NULL, + `UpdatedAt` datetime DEFAULT NULL, + `Url` varchar(255) DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `company` +-- Table structure for table `Company` -- -DROP TABLE IF EXISTS `company`; +DROP TABLE IF EXISTS `Company`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `company` ( - `id` bigint NOT NULL, - `changedate` datetime DEFAULT NULL, - `changedatecategory` int DEFAULT NULL, - `changedcompanyid` bigint DEFAULT NULL, - `checksum` varchar(45) DEFAULT NULL, - `country` int DEFAULT NULL, - `createdat` datetime DEFAULT NULL, - `description` longtext, - `developed` json DEFAULT NULL, - `logo` bigint DEFAULT NULL, - `name` varchar(255) DEFAULT NULL, - `parent` bigint DEFAULT NULL, - `published` json DEFAULT NULL, - `slug` varchar(100) DEFAULT NULL, - `startdate` datetime DEFAULT NULL, - `startdatecategory` int DEFAULT NULL, - `updatedat` datetime DEFAULT NULL, - `url` varchar(255) DEFAULT NULL, - `websites` json DEFAULT NULL, +CREATE TABLE `Company` ( + `Id` bigint NOT NULL, + `ChangeDate` datetime DEFAULT NULL, + `ChangeDateCategory` int DEFAULT NULL, + `ChangedCompanyId` bigint DEFAULT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `Country` int DEFAULT NULL, + `CreatedAt` datetime DEFAULT NULL, + `Description` longtext, + `Developed` json DEFAULT NULL, + `Logo` bigint DEFAULT NULL, + `Name` varchar(255) DEFAULT NULL, + `Parent` bigint DEFAULT NULL, + `Published` json DEFAULT NULL, + `Slug` varchar(100) DEFAULT NULL, + `StartDate` datetime DEFAULT NULL, + `StartDateCategory` int DEFAULT NULL, + `UpdatedAt` datetime DEFAULT NULL, + `Url` varchar(255) DEFAULT NULL, + `Websites` json DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `companylogo` +-- Table structure for table `CompanyLogo` -- -DROP TABLE IF EXISTS `companylogo`; +DROP TABLE IF EXISTS `CompanyLogo`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `companylogo` ( - `id` bigint NOT NULL, - `alphachannel` tinyint(1) DEFAULT NULL, - `animated` tinyint(1) DEFAULT NULL, - `checksum` varchar(45) DEFAULT NULL, - `height` int DEFAULT NULL, - `imageid` varchar(45) DEFAULT NULL, - `url` varchar(255) DEFAULT NULL, - `width` int DEFAULT NULL, +CREATE TABLE `CompanyLogo` ( + `Id` bigint NOT NULL, + `AlphaChannel` tinyint(1) DEFAULT NULL, + `Animated` tinyint(1) DEFAULT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `Height` int DEFAULT NULL, + `ImageId` varchar(45) DEFAULT NULL, + `Url` varchar(255) DEFAULT NULL, + `Width` int DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `cover` +-- Table structure for table `Cover` -- -DROP TABLE IF EXISTS `cover`; +DROP TABLE IF EXISTS `Cover`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `cover` ( - `id` bigint NOT NULL, - `alphachannel` tinyint(1) DEFAULT NULL, - `animated` tinyint(1) DEFAULT NULL, - `checksum` varchar(45) DEFAULT NULL, - `game` bigint DEFAULT NULL, - `height` int DEFAULT NULL, - `imageid` varchar(45) DEFAULT NULL, - `url` varchar(255) DEFAULT NULL, - `width` int DEFAULT NULL, +CREATE TABLE `Cover` ( + `Id` bigint NOT NULL, + `AlphaChannel` tinyint(1) DEFAULT NULL, + `Animated` tinyint(1) DEFAULT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `Game` bigint DEFAULT NULL, + `Height` int DEFAULT NULL, + `ImageId` varchar(45) DEFAULT NULL, + `Url` varchar(255) DEFAULT NULL, + `Width` int DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `externalgame` +-- Table structure for table `ExternalGame` -- -DROP TABLE IF EXISTS `externalgame`; +DROP TABLE IF EXISTS `ExternalGame`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `externalgame` ( - `id` bigint NOT NULL, - `category` int DEFAULT NULL, - `checksum` varchar(45) DEFAULT NULL, - `createdat` datetime DEFAULT NULL, - `countries` json DEFAULT NULL, - `game` bigint DEFAULT NULL, - `media` int DEFAULT NULL, - `name` varchar(255) DEFAULT NULL, - `platform` bigint DEFAULT NULL, - `uid` varchar(255) DEFAULT NULL, - `updatedat` datetime DEFAULT NULL, - `url` varchar(255) DEFAULT NULL, - `year` int DEFAULT NULL, +CREATE TABLE `ExternalGame` ( + `Id` bigint NOT NULL, + `Category` int DEFAULT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `CreatedAt` datetime DEFAULT NULL, + `Countries` json DEFAULT NULL, + `Game` bigint DEFAULT NULL, + `Media` int DEFAULT NULL, + `Name` varchar(255) DEFAULT NULL, + `Platform` bigint DEFAULT NULL, + `Uid` varchar(255) DEFAULT NULL, + `UpdatedAt` datetime DEFAULT NULL, + `Url` varchar(255) DEFAULT NULL, + `Year` int DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `franchise` +-- Table structure for table `Franchise` -- -DROP TABLE IF EXISTS `franchise`; +DROP TABLE IF EXISTS `Franchise`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `franchise` ( - `id` bigint NOT NULL, - `checksum` varchar(45) DEFAULT NULL, - `createdat` datetime DEFAULT NULL, - `updatedat` datetime DEFAULT NULL, - `games` json DEFAULT NULL, - `name` varchar(255) DEFAULT NULL, - `slug` varchar(255) DEFAULT NULL, - `url` varchar(255) DEFAULT NULL, +CREATE TABLE `Franchise` ( + `Id` bigint NOT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `CreatedAt` datetime DEFAULT NULL, + `UpdatedAt` datetime DEFAULT NULL, + `Games` json DEFAULT NULL, + `Name` varchar(255) DEFAULT NULL, + `Slug` varchar(255) DEFAULT NULL, + `Url` varchar(255) DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `game` +-- Table structure for table `Game` -- -DROP TABLE IF EXISTS `game`; +DROP TABLE IF EXISTS `Game`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `game` ( - `id` bigint NOT NULL, - `ageratings` json DEFAULT NULL, - `aggregatedrating` double DEFAULT NULL, - `aggregatedratingcount` int DEFAULT NULL, - `alternativenames` json DEFAULT NULL, - `artworks` json DEFAULT NULL, - `bundles` json DEFAULT NULL, - `category` int DEFAULT NULL, - `checksum` varchar(45) DEFAULT NULL, - `collection` bigint DEFAULT NULL, - `cover` bigint DEFAULT NULL, - `createdat` datetime DEFAULT NULL, - `dlcs` json DEFAULT NULL, - `expansions` json DEFAULT NULL, - `externalgames` json DEFAULT NULL, - `firstreleasedate` datetime DEFAULT NULL, - `follows` int DEFAULT NULL, - `franchise` bigint DEFAULT NULL, - `franchises` json DEFAULT NULL, - `gameengines` json DEFAULT NULL, - `gamemodes` json DEFAULT NULL, - `genres` json DEFAULT NULL, - `hypes` int DEFAULT NULL, - `involvedcompanies` json DEFAULT NULL, - `keywords` json DEFAULT NULL, - `multiplayermodes` json DEFAULT NULL, - `name` varchar(255) DEFAULT NULL, - `parentgame` bigint DEFAULT NULL, - `platforms` json DEFAULT NULL, - `playerperspectives` json DEFAULT NULL, - `rating` double DEFAULT NULL, - `ratingcount` int DEFAULT NULL, - `releasedates` json DEFAULT NULL, - `screenshots` json DEFAULT NULL, - `similargames` json DEFAULT NULL, - `slug` varchar(100) DEFAULT NULL, - `standaloneexpansions` json DEFAULT NULL, - `status` int DEFAULT NULL, - `storyline` longtext, - `summary` longtext, - `tags` json DEFAULT NULL, - `themes` json DEFAULT NULL, - `totalrating` double DEFAULT NULL, - `totalratingcount` int DEFAULT NULL, - `updatedat` datetime DEFAULT NULL, - `url` varchar(255) DEFAULT NULL, - `versionparent` bigint DEFAULT NULL, - `versiontitle` varchar(100) DEFAULT NULL, - `videos` json DEFAULT NULL, - `websites` json DEFAULT NULL, +CREATE TABLE `Game` ( + `Id` bigint NOT NULL, + `AgeRatings` json DEFAULT NULL, + `AggregatedRating` double DEFAULT NULL, + `AggregatedRatingCount` int DEFAULT NULL, + `AlternativeNames` json DEFAULT NULL, + `Artworks` json DEFAULT NULL, + `Bundles` json DEFAULT NULL, + `Category` int DEFAULT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `Collection` bigint DEFAULT NULL, + `Cover` bigint DEFAULT NULL, + `CreatedAt` datetime DEFAULT NULL, + `Dlcs` json DEFAULT NULL, + `Expansions` json DEFAULT NULL, + `ExternalGames` json DEFAULT NULL, + `FirstReleaseDate` datetime DEFAULT NULL, + `Follows` int DEFAULT NULL, + `Franchise` bigint DEFAULT NULL, + `Franchises` json DEFAULT NULL, + `GameEngines` json DEFAULT NULL, + `GameModes` json DEFAULT NULL, + `Genres` json DEFAULT NULL, + `Hypes` int DEFAULT NULL, + `InvolvedCompanies` json DEFAULT NULL, + `Keywords` json DEFAULT NULL, + `MultiplayerModes` json DEFAULT NULL, + `Name` varchar(255) DEFAULT NULL, + `ParentGame` bigint DEFAULT NULL, + `Platforms` json DEFAULT NULL, + `PlayerPerspectives` json DEFAULT NULL, + `Rating` double DEFAULT NULL, + `RatingCount` int DEFAULT NULL, + `ReleaseDates` json DEFAULT NULL, + `Screenshots` json DEFAULT NULL, + `SimilarGames` json DEFAULT NULL, + `Slug` varchar(100) DEFAULT NULL, + `StandaloneExpansions` json DEFAULT NULL, + `Status` int DEFAULT NULL, + `StoryLine` longtext, + `Summary` longtext, + `Tags` json DEFAULT NULL, + `Themes` json DEFAULT NULL, + `TotalRating` double DEFAULT NULL, + `TotalRatingCount` int DEFAULT NULL, + `UpdatedAt` datetime DEFAULT NULL, + `Url` varchar(255) DEFAULT NULL, + `VersionParent` bigint DEFAULT NULL, + `VersionTitle` varchar(100) DEFAULT NULL, + `Videos` json DEFAULT NULL, + `Websites` json DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `id_UNIQUE` (`id`), - KEY `idx_genres` ((cast(`genres` as unsigned array))), - KEY `idx_alternativenames` ((cast(`alternativenames` as unsigned array))), - KEY `idx_artworks` ((cast(`artworks` as unsigned array))), - KEY `idx_bundles` ((cast(`bundles` as unsigned array))), - KEY `idx_dlcs` ((cast(`dlcs` as unsigned array))), - KEY `idx_expansions` ((cast(`expansions` as unsigned array))), - KEY `idx_externalgames` ((cast(`externalgames` as unsigned array))), - KEY `idx_franchises` ((cast(`franchises` as unsigned array))), - KEY `idx_gameengines` ((cast(`gameengines` as unsigned array))), - KEY `idx_gamemodes` ((cast(`gamemodes` as unsigned array))), - KEY `idx_involvedcompanies` ((cast(`involvedcompanies` as unsigned array))), - KEY `idx_keywords` ((cast(`keywords` as unsigned array))), - KEY `idx_multiplayermodes` ((cast(`multiplayermodes` as unsigned array))), - KEY `idx_platforms` ((cast(`platforms` as unsigned array))), - KEY `idx_playerperspectives` ((cast(`playerperspectives` as unsigned array))), - KEY `idx_releasedates` ((cast(`releasedates` as unsigned array))), - KEY `idx_screenshots` ((cast(`screenshots` as unsigned array))), - KEY `idx_similargames` ((cast(`similargames` as unsigned array))), - KEY `idx_standaloneexpansions` ((cast(`standaloneexpansions` as unsigned array))), - KEY `idx_tags` ((cast(`tags` as unsigned array))), - KEY `idx_themes` ((cast(`themes` as unsigned array))), - KEY `idx_videos` ((cast(`videos` as unsigned array))), - KEY `idx_websites` ((cast(`websites` as unsigned array))) + PRIMARY KEY (`Id`), + UNIQUE KEY `Id_UNIQUE` (`Id`), + KEY `Idx_AgeRatings` ((cast(`AgeRatings` as unsigned array))), + KEY `Idx_Genres` ((cast(`Genres` as unsigned array))), + KEY `Idx_alternativeNames` ((cast(`AlternativeNames` as unsigned array))), + KEY `Idx_artworks` ((cast(`Artworks` as unsigned array))), + KEY `Idx_bundles` ((cast(`Bundles` as unsigned array))), + KEY `Idx_dlcs` ((cast(`Dlcs` as unsigned array))), + KEY `Idx_expansions` ((cast(`Expansions` as unsigned array))), + KEY `Idx_ExternalGames` ((cast(`ExternalGames` as unsigned array))), + KEY `Idx_franchises` ((cast(`Franchises` as unsigned array))), + KEY `Idx_Gameengines` ((cast(`GameEngines` as unsigned array))), + KEY `Idx_Gamemodes` ((cast(`GameModes` as unsigned array))), + KEY `Idx_involvedcompanies` ((cast(`InvolvedCompanies` as unsigned array))), + KEY `Idx_keywords` ((cast(`Keywords` as unsigned array))), + KEY `Idx_multiplayermodes` ((cast(`MultiplayerModes` as unsigned array))), + KEY `Idx_Platforms` ((cast(`Platforms` as unsigned array))), + KEY `Idx_playerperspectives` ((cast(`PlayerPerspectives` as unsigned array))), + KEY `Idx_releasedates` ((cast(`ReleaseDates` as unsigned array))), + KEY `Idx_Screenshots` ((cast(`Screenshots` as unsigned array))), + KEY `Idx_similarGames` ((cast(`SimilarGames` as unsigned array))), + KEY `Idx_standaloneexpansions` ((cast(`StandaloneExpansions` as unsigned array))), + KEY `Idx_tags` ((cast(`Tags` as unsigned array))), + KEY `Idx_themes` ((cast(`Themes` as unsigned array))), + KEY `Idx_vIdeos` ((cast(`Videos` as unsigned array))), + KEY `Idx_websites` ((cast(`Websites` as unsigned array))) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `games_roms` +-- Table structure for table `Games_Roms` -- -DROP TABLE IF EXISTS `games_roms`; +DROP TABLE IF EXISTS `Games_Roms`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `games_roms` ( - `id` bigint NOT NULL AUTO_INCREMENT, - `platformid` bigint DEFAULT NULL, - `gameid` bigint DEFAULT NULL, - `name` varchar(255) DEFAULT NULL, - `size` bigint DEFAULT NULL, - `crc` varchar(20) DEFAULT NULL, - `md5` varchar(100) DEFAULT NULL, - `sha1` varchar(100) DEFAULT NULL, - `developmentstatus` varchar(100) DEFAULT NULL, - `flags` json DEFAULT NULL, - `romtype` int DEFAULT NULL, - `romtypemedia` varchar(100) DEFAULT NULL, - `medialabel` varchar(100) DEFAULT NULL, - `path` longtext, - `metadatasource` int DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `id_UNIQUE` (`id`), - INDEX `gameid` (`gameid` ASC) VISIBLE, - INDEX `id_gameid` (`gameid` ASC, `id` ASC) VISIBLE +CREATE TABLE `Games_Roms` ( + `Id` bigint NOT NULL AUTO_INCREMENT, + `PlatformId` bigint DEFAULT NULL, + `GameId` bigint DEFAULT NULL, + `Name` varchar(255) DEFAULT NULL, + `Size` bigint DEFAULT NULL, + `CRC` varchar(20) DEFAULT NULL, + `MD5` varchar(100) DEFAULT NULL, + `SHA1` varchar(100) DEFAULT NULL, + `DevelopmentStatus` varchar(100) DEFAULT NULL, + `Flags` json DEFAULT NULL, + `RomType` int DEFAULT NULL, + `RomTypeMedia` varchar(100) DEFAULT NULL, + `MediaLabel` varchar(100) DEFAULT NULL, + `Path` longtext, + `MetadataSource` int DEFAULT NULL, + PRIMARY KEY (`Id`), + UNIQUE KEY `Id_UNIQUE` (`Id`), + INDEX `GameId` (`GameId` ASC) VISIBLE, + INDEX `Id_GameId` (`GameId` ASC, `Id` ASC) VISIBLE ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `gamevideo` +-- Table structure for table `GameVideo` -- -DROP TABLE IF EXISTS `gamevideo`; +DROP TABLE IF EXISTS `GameVideo`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `gamevideo` ( - `id` bigint NOT NULL, - `checksum` varchar(45) DEFAULT NULL, - `game` bigint DEFAULT NULL, - `name` varchar(100) DEFAULT NULL, - `videoid` varchar(45) DEFAULT NULL, +CREATE TABLE `GameVideo` ( + `Id` bigint NOT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `Game` bigint DEFAULT NULL, + `Name` varchar(100) DEFAULT NULL, + `VideoId` varchar(45) DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `genre` +-- Table structure for table `Genre` -- -DROP TABLE IF EXISTS `genre`; +DROP TABLE IF EXISTS `Genre`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `genre` ( - `id` bigint NOT NULL, - `checksum` varchar(45) DEFAULT NULL, - `createdat` datetime DEFAULT NULL, - `updatedat` datetime DEFAULT NULL, - `name` varchar(255) DEFAULT NULL, - `slug` varchar(100) DEFAULT NULL, - `url` varchar(255) DEFAULT NULL, +CREATE TABLE `Genre` ( + `Id` bigint NOT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `CreatedAt` datetime DEFAULT NULL, + `UpdatedAt` datetime DEFAULT NULL, + `Name` varchar(255) DEFAULT NULL, + `Slug` varchar(100) DEFAULT NULL, + `Url` varchar(255) DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `involvedcompany` +-- Table structure for table `InvolvedCompany` -- -DROP TABLE IF EXISTS `involvedcompany`; +DROP TABLE IF EXISTS `InvolvedCompany`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `involvedcompany` ( - `id` bigint NOT NULL, - `checksum` varchar(45) DEFAULT NULL, - `company` bigint DEFAULT NULL, - `createdat` datetime DEFAULT NULL, - `developer` tinyint(1) DEFAULT NULL, - `game` bigint DEFAULT NULL, - `porting` tinyint(1) DEFAULT NULL, - `publisher` tinyint(1) DEFAULT NULL, - `supporting` tinyint(1) DEFAULT NULL, - `updatedat` datetime DEFAULT NULL, +CREATE TABLE `InvolvedCompany` ( + `Id` bigint NOT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `Company` bigint DEFAULT NULL, + `CreatedAt` datetime DEFAULT NULL, + `Developer` tinyint(1) DEFAULT NULL, + `Game` bigint DEFAULT NULL, + `Porting` tinyint(1) DEFAULT NULL, + `Publisher` tinyint(1) DEFAULT NULL, + `Supporting` tinyint(1) DEFAULT NULL, + `UpdatedAt` datetime DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `platform` +-- Table structure for table `Platform` -- -DROP TABLE IF EXISTS `platform`; +DROP TABLE IF EXISTS `Platform`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `platform` ( - `id` bigint NOT NULL, - `abbreviation` varchar(45) DEFAULT NULL, - `alternativename` varchar(255) DEFAULT NULL, - `category` int DEFAULT NULL, - `checksum` varchar(45) DEFAULT NULL, - `createdat` datetime DEFAULT NULL, - `generation` int DEFAULT NULL, - `name` varchar(45) DEFAULT NULL, - `platformfamily` bigint DEFAULT NULL, - `platformlogo` bigint DEFAULT NULL, - `slug` varchar(45) DEFAULT NULL, - `summary` longtext, - `updatedat` datetime DEFAULT NULL, - `url` varchar(255) DEFAULT NULL, - `versions` json DEFAULT NULL, - `websites` json DEFAULT NULL, +CREATE TABLE `Platform` ( + `Id` bigint NOT NULL, + `Abbreviation` varchar(45) DEFAULT NULL, + `AlternativeName` varchar(255) DEFAULT NULL, + `Category` int DEFAULT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `CreatedAt` datetime DEFAULT NULL, + `Generation` int DEFAULT NULL, + `Name` varchar(45) DEFAULT NULL, + `PlatformFamily` bigint DEFAULT NULL, + `PlatformLogo` bigint DEFAULT NULL, + `Slug` varchar(45) DEFAULT NULL, + `Summary` longtext, + `UpdatedAt` datetime DEFAULT NULL, + `Url` varchar(255) DEFAULT NULL, + `Versions` json DEFAULT NULL, + `Websites` json DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `id_UNIQUE` (`id`) + PRIMARY KEY (`Id`), + UNIQUE KEY `Id_UNIQUE` (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `platformlogo` +-- Table structure for table `PlatformLogo` -- -DROP TABLE IF EXISTS `platformlogo`; +DROP TABLE IF EXISTS `PlatformLogo`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `platformlogo` ( - `id` bigint NOT NULL, - `alphachannel` tinyint(1) DEFAULT NULL, - `animated` tinyint(1) DEFAULT NULL, - `checksum` varchar(45) DEFAULT NULL, - `height` int DEFAULT NULL, - `imageid` varchar(45) DEFAULT NULL, - `url` varchar(255) DEFAULT NULL, - `width` int DEFAULT NULL, +CREATE TABLE `PlatformLogo` ( + `Id` bigint NOT NULL, + `AlphaChannel` tinyint(1) DEFAULT NULL, + `Animated` tinyint(1) DEFAULT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `Height` int DEFAULT NULL, + `ImageId` varchar(45) DEFAULT NULL, + `Url` varchar(255) DEFAULT NULL, + `Width` int DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `platformversion` +-- Table structure for table `Platformversion` -- -DROP TABLE IF EXISTS `platformversion`; +DROP TABLE IF EXISTS `PlatformVersion`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `platformversion` ( - `id` bigint NOT NULL, - `checksum` varchar(45) DEFAULT NULL, - `companies` json DEFAULT NULL, - `connectivity` longtext, - `cpu` longtext, - `graphics` longtext, - `mainmanufacturer` bigint DEFAULT NULL, - `media` longtext, - `memory` longtext, - `name` longtext, - `os` longtext, - `output` longtext, - `platformlogo` int DEFAULT NULL, - `platformversionreleasedates` json DEFAULT NULL, - `resolutions` longtext, - `slug` longtext, - `sound` longtext, - `storage` longtext, - `summary` longtext, - `url` varchar(255) DEFAULT NULL, +CREATE TABLE `PlatformVersion` ( + `Id` bigint NOT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `Companies` json DEFAULT NULL, + `Connectivity` longtext, + `CPU` longtext, + `Graphics` longtext, + `MainManufacturer` bigint DEFAULT NULL, + `Media` longtext, + `Memory` longtext, + `Name` longtext, + `OS` longtext, + `Output` longtext, + `PlatformLogo` int DEFAULT NULL, + `PlatformVersionReleaseDates` json DEFAULT NULL, + `Resolutions` longtext, + `Slug` longtext, + `Sound` longtext, + `Storage` longtext, + `Summary` longtext, + `Url` varchar(255) DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `screenshot` +-- Table structure for table `Screenshot` -- -DROP TABLE IF EXISTS `screenshot`; +DROP TABLE IF EXISTS `Screenshot`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `screenshot` ( - `id` bigint NOT NULL, - `alphachannel` tinyint(1) DEFAULT NULL, - `animated` tinyint(1) DEFAULT NULL, - `checksum` varchar(45) DEFAULT NULL, - `game` bigint DEFAULT NULL, - `height` int DEFAULT NULL, - `imageid` varchar(45) DEFAULT NULL, - `url` varchar(255) DEFAULT NULL, - `width` int DEFAULT NULL, +CREATE TABLE `Screenshot` ( + `Id` bigint NOT NULL, + `AlphaChannel` tinyint(1) DEFAULT NULL, + `Animated` tinyint(1) DEFAULT NULL, + `Checksum` varchar(45) DEFAULT NULL, + `Game` bigint DEFAULT NULL, + `Height` int DEFAULT NULL, + `ImageId` varchar(45) DEFAULT NULL, + `Url` varchar(255) DEFAULT NULL, + `Width` int DEFAULT NULL, `dateAdded` datetime DEFAULT NULL, `lastUpdated` datetime DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `settings` +-- Table structure for table `Settings` -- -DROP TABLE IF EXISTS `settings`; +DROP TABLE IF EXISTS `Settings`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `settings` ( - `setting` varchar(45) NOT NULL, - `value` longtext, - PRIMARY KEY (`setting`), - UNIQUE KEY `setting_UNIQUE` (`setting`) +CREATE TABLE `Settings` ( + `Setting` varchar(45) NOT NULL, + `Value` longtext, + PRIMARY KEY (`Setting`), + UNIQUE KEY `Setting_UNIQUE` (`Setting`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `signatures_games` +-- Table structure for table `Signatures_Games` -- -DROP TABLE IF EXISTS `signatures_games`; +DROP TABLE IF EXISTS `Signatures_Games`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `signatures_games` ( - `id` int NOT NULL AUTO_INCREMENT, - `name` varchar(255) DEFAULT NULL, - `description` varchar(255) DEFAULT NULL, - `year` varchar(15) DEFAULT NULL, - `publisherid` int DEFAULT NULL, - `demo` int DEFAULT NULL, - `systemid` int DEFAULT NULL, - `systemvariant` varchar(100) DEFAULT NULL, - `video` varchar(10) DEFAULT NULL, - `country` varchar(5) DEFAULT NULL, - `language` varchar(5) DEFAULT NULL, - `copyright` varchar(15) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `id_UNIQUE` (`id`), - KEY `publisher_idx` (`publisherid`), - KEY `system_idx` (`systemid`), - KEY `ingest_idx` (`name`,`year`,`publisherid`,`systemid`,`country`,`language`) USING BTREE, - CONSTRAINT `publisher` FOREIGN KEY (`publisherid`) REFERENCES `signatures_publishers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `system` FOREIGN KEY (`systemid`) REFERENCES `signatures_platforms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +CREATE TABLE `Signatures_Games` ( + `Id` int NOT NULL AUTO_INCREMENT, + `Name` varchar(255) DEFAULT NULL, + `Description` varchar(255) DEFAULT NULL, + `Year` varchar(15) DEFAULT NULL, + `PublisherId` int DEFAULT NULL, + `Demo` int DEFAULT NULL, + `SystemId` int DEFAULT NULL, + `SystemVariant` varchar(100) DEFAULT NULL, + `Video` varchar(10) DEFAULT NULL, + `Country` varchar(5) DEFAULT NULL, + `Language` varchar(5) DEFAULT NULL, + `Copyright` varchar(15) DEFAULT NULL, + PRIMARY KEY (`Id`), + UNIQUE KEY `Id_UNIQUE` (`Id`), + KEY `publisher_Idx` (`PublisherId`), + KEY `system_Idx` (`SystemId`), + KEY `ingest_Idx` (`Name`,`Year`,`PublisherId`,`SystemId`,`Country`,`Language`) USING BTREE, + CONSTRAINT `Publisher` FOREIGN KEY (`PublisherId`) REFERENCES `Signatures_Publishers` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `System` FOREIGN KEY (`SystemId`) REFERENCES `Signatures_Platforms` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `signatures_platforms` +-- Table structure for table `Signatures_Platforms` -- -DROP TABLE IF EXISTS `signatures_platforms`; +DROP TABLE IF EXISTS `Signatures_Platforms`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `signatures_platforms` ( - `id` int NOT NULL AUTO_INCREMENT, - `platform` varchar(100) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `idsignatures_platforms_UNIQUE` (`id`), - KEY `platforms_idx` (`platform`,`id`) USING BTREE +CREATE TABLE `Signatures_Platforms` ( + `Id` int NOT NULL AUTO_INCREMENT, + `Platform` varchar(100) DEFAULT NULL, + PRIMARY KEY (`Id`), + UNIQUE KEY `IdSignatures_Platforms_UNIQUE` (`Id`), + KEY `Platforms_Idx` (`Platform`,`Id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `signatures_publishers` +-- Table structure for table `Signatures_Publishers` -- -DROP TABLE IF EXISTS `signatures_publishers`; +DROP TABLE IF EXISTS `Signatures_Publishers`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `signatures_publishers` ( - `id` int NOT NULL AUTO_INCREMENT, - `publisher` varchar(100) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `id_UNIQUE` (`id`), - KEY `publisher_idx` (`publisher`,`id`) +CREATE TABLE `Signatures_Publishers` ( + `Id` int NOT NULL AUTO_INCREMENT, + `Publisher` varchar(100) DEFAULT NULL, + PRIMARY KEY (`Id`), + UNIQUE KEY `Id_UNIQUE` (`Id`), + KEY `publisher_Idx` (`Publisher`,`Id`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `signatures_roms` +-- Table structure for table `Signatures_Roms` -- -DROP TABLE IF EXISTS `signatures_roms`; +DROP TABLE IF EXISTS `Signatures_Roms`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `signatures_roms` ( - `id` int NOT NULL AUTO_INCREMENT, - `gameid` int DEFAULT NULL, - `name` varchar(255) DEFAULT NULL, - `size` bigint DEFAULT NULL, - `crc` varchar(20) DEFAULT NULL, - `md5` varchar(100) DEFAULT NULL, - `sha1` varchar(100) DEFAULT NULL, - `developmentstatus` varchar(100) DEFAULT NULL, - `flags` json DEFAULT NULL, - `romtype` int DEFAULT NULL, - `romtypemedia` varchar(100) DEFAULT NULL, - `medialabel` varchar(100) DEFAULT NULL, - `metadatasource` int DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `id_UNIQUE` (`id`,`gameid`) USING BTREE, - KEY `gameid_idx` (`gameid`), - KEY `md5_idx` (`md5`) USING BTREE, - KEY `sha1_idx` (`sha1`) USING BTREE, - KEY `flags_idx` ((cast(`flags` as char(255) array))), - CONSTRAINT `gameid` FOREIGN KEY (`gameid`) REFERENCES `signatures_games` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +CREATE TABLE `Signatures_Roms` ( + `Id` int NOT NULL AUTO_INCREMENT, + `GameId` int DEFAULT NULL, + `Name` varchar(255) DEFAULT NULL, + `Size` bigint DEFAULT NULL, + `CRC` varchar(20) DEFAULT NULL, + `MD5` varchar(100) DEFAULT NULL, + `SHA1` varchar(100) DEFAULT NULL, + `DevelopmentStatus` varchar(100) DEFAULT NULL, + `Flags` json DEFAULT NULL, + `RomType` int DEFAULT NULL, + `RomTypeMedia` varchar(100) DEFAULT NULL, + `MediaLabel` varchar(100) DEFAULT NULL, + `MetadataSource` int DEFAULT NULL, + PRIMARY KEY (`Id`), + UNIQUE KEY `Id_UNIQUE` (`Id`,`GameId`) USING BTREE, + KEY `GameId_Idx` (`GameId`), + KEY `md5_Idx` (`MD5`) USING BTREE, + KEY `sha1_Idx` (`SHA1`) USING BTREE, + KEY `flags_Idx` ((cast(`Flags` as char(255) array))), + CONSTRAINT `GameId` FOREIGN KEY (`GameId`) REFERENCES `Signatures_Games` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `signatures_sources` +-- Table structure for table `Signatures_Sources` -- -DROP TABLE IF EXISTS `signatures_sources`; +DROP TABLE IF EXISTS `Signatures_Sources`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `signatures_sources` ( - `id` int NOT NULL AUTO_INCREMENT, - `name` varchar(255) DEFAULT NULL, - `description` varchar(255) DEFAULT NULL, - `category` varchar(45) DEFAULT NULL, - `version` varchar(45) DEFAULT NULL, - `author` varchar(255) DEFAULT NULL, - `email` varchar(45) DEFAULT NULL, - `homepage` varchar(45) DEFAULT NULL, - `url` varchar(45) DEFAULT NULL, - `sourcetype` varchar(45) DEFAULT NULL, - `sourcemd5` varchar(45) DEFAULT NULL, - `sourcesha1` varchar(45) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `id_UNIQUE` (`id`), - KEY `sourcemd5_idx` (`sourcemd5`,`id`) USING BTREE, - KEY `sourcesha1_idx` (`sourcesha1`,`id`) USING BTREE +CREATE TABLE `Signatures_Sources` ( + `Id` int NOT NULL AUTO_INCREMENT, + `Name` varchar(255) DEFAULT NULL, + `Description` varchar(255) DEFAULT NULL, + `Category` varchar(45) DEFAULT NULL, + `Version` varchar(45) DEFAULT NULL, + `Author` varchar(255) DEFAULT NULL, + `Email` varchar(45) DEFAULT NULL, + `Homepage` varchar(45) DEFAULT NULL, + `Url` varchar(45) DEFAULT NULL, + `SourceType` varchar(45) DEFAULT NULL, + `SourceMD5` varchar(45) DEFAULT NULL, + `SourceSHA1` varchar(45) DEFAULT NULL, + PRIMARY KEY (`Id`), + UNIQUE KEY `Id_UNIQUE` (`Id`), + KEY `sourcemd5_Idx` (`SourceMD5`,`Id`) USING BTREE, + KEY `sourcesha1_Idx` (`SourceSHA1`,`Id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -681,27 +682,27 @@ CREATE TABLE `signatures_sources` ( -- -- --- Final view structure for view `view_signatures_games` +-- Final view structure for view `view_Signatures_Games` -- -DROP VIEW IF EXISTS `view_signatures_games`; -CREATE VIEW `view_signatures_games` AS +DROP VIEW IF EXISTS `view_Signatures_Games`; +CREATE VIEW `view_Signatures_Games` AS SELECT - `signatures_games`.`id` AS `id`, - `signatures_games`.`name` AS `name`, - `signatures_games`.`description` AS `description`, - `signatures_games`.`year` AS `year`, - `signatures_games`.`publisherid` AS `publisherid`, - `signatures_publishers`.`publisher` AS `publisher`, - `signatures_games`.`demo` AS `demo`, - `signatures_games`.`systemid` AS `platformid`, - `signatures_platforms`.`platform` AS `platform`, - `signatures_games`.`systemvariant` AS `systemvariant`, - `signatures_games`.`video` AS `video`, - `signatures_games`.`country` AS `country`, - `signatures_games`.`language` AS `language`, - `signatures_games`.`copyright` AS `copyright` + `Signatures_Games`.`Id` AS `Id`, + `Signatures_Games`.`Name` AS `Name`, + `Signatures_Games`.`Description` AS `Description`, + `Signatures_Games`.`Year` AS `Year`, + `Signatures_Games`.`PublisherId` AS `PublisherId`, + `Signatures_Publishers`.`Publisher` AS `Publisher`, + `Signatures_Games`.`Demo` AS `Demo`, + `Signatures_Games`.`SystemId` AS `PlatformId`, + `Signatures_Platforms`.`Platform` AS `Platform`, + `Signatures_Games`.`SystemVariant` AS `SystemVariant`, + `Signatures_Games`.`VIdeo` AS `Video`, + `Signatures_Games`.`Country` AS `Country`, + `Signatures_Games`.`Language` AS `Language`, + `Signatures_Games`.`Copyright` AS `Copyright` FROM - ((`signatures_games` - JOIN `signatures_publishers` ON ((`signatures_games`.`publisherid` = `signatures_publishers`.`id`))) - JOIN `signatures_platforms` ON ((`signatures_games`.`systemid` = `signatures_platforms`.`id`))); \ No newline at end of file + ((`Signatures_Games` + JOIN `Signatures_Publishers` ON ((`Signatures_Games`.`PublisherId` = `Signatures_Publishers`.`Id`))) + JOIN `Signatures_Platforms` ON ((`Signatures_Games`.`SystemId` = `Signatures_Platforms`.`Id`))); \ No newline at end of file