Minor fixes to complete the upgrade from 1.6.1 to 1.7.0

* Update README

* Perform upgrade testing from most recent full release version (1.6.1)
Fixes #278
This commit is contained in:
Michael Green
2024-02-04 22:17:11 +11:00
committed by GitHub
parent 5e45fc1aa9
commit 7754fd5dda
5 changed files with 122 additions and 19 deletions

View File

@@ -15,11 +15,9 @@ Version 1.7.0 and later contain user authentication, and can be exposed to the i
While we do our best to stay on top of server security, if you expose the server to the internet **you do so at your own risk**.
## Screenshots
| | |
| ------- | --------------------------------------- |
| Game Library | ![Library](./screenshots/Library.png) |
| Game metadata and ROM display | ![Game](./screenshots/Game.png) |
| Emulator | ![Emulator](./screenshots/Emulator.png) |
![Library](./screenshots/Library.png)
![Game](./screenshots/Game.png)
![Emulator](./screenshots/Emulator.png)
## Requirements
@@ -31,13 +29,17 @@ While we do our best to stay on top of server security, if you expose the server
If using the provided docker-compose.yml, MariaDB will be installed for you.
## Friends of Gaseous
* [EmulatorJS](https://github.com/EmulatorJS/EmulatorJS): A fantastic (and fast) Javascript based implementation of RetroArch, supporting a wide variety of platforms. Discord: https://discord.gg/6akryGkETU
* [RomM](https://github.com/zurdi15/romm): Another self hosted ROM manager. Discord: https://discord.gg/P5HtHnhUDH
## Third Party Projects
The following projects are used by Gaseous
* https://dotnet.microsoft.com/en-us/apps/aspnet
* https://github.com/JamesNK/Newtonsoft.Json
* https://www.nuget.org/packages/MySql.Data/8.0.32.1
* https://github.com/kamranayub/igdb-dotnet
* https://github.com/EmulatorJS/EmulatorJS
* [ASP.NET](https://dotnet.microsoft.com/en-us/apps/aspnet)
* [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json)
* [MySQLConnector](https://mysqlconnector.net)
* [IGDB-DOTNET](https://github.com/kamranayub/igdb-dotnet)
* [EmulatorJS](https://github.com/EmulatorJS/EmulatorJS)
## Discord Server
[![Join our Discord server!](https://invite.casperiv.dev/?inviteCode=Nhu7wpT3k4&format=svg)](https://discord.gg/Nhu7wpT3k4)

View File

@@ -1,5 +1,6 @@
using System;
using System.Data;
using System.Reflection;
namespace gaseous_server.Classes
{
@@ -9,7 +10,56 @@ namespace gaseous_server.Classes
public static void PreUpgradeScript(int TargetSchemaVersion, Database.databaseType? DatabaseType)
{
// load resources
var assembly = Assembly.GetExecutingAssembly();
Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
string sql = "";
Dictionary<string, object> dbDict = new Dictionary<string, object>();
DataTable data;
Logging.Log(Logging.LogType.Information, "Database", "Checking for pre-upgrade for schema version " + TargetSchemaVersion);
switch(DatabaseType)
{
case Database.databaseType.MySql:
switch (TargetSchemaVersion)
{
case 1005:
Logging.Log(Logging.LogType.Information, "Database", "Running pre-upgrade for schema version " + TargetSchemaVersion);
// there was a mistake at dbschema version 1004-1005
// the first preview release of v1.7 reused dbschema version 1004
// if table "Relation_Game_AgeRatings" exists - then we need to apply the gaseous-fix-1005.sql script before applying the standard 1005 script
sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = @dbname AND table_name = @tablename;";
dbDict.Add("dbname", Config.DatabaseConfiguration.DatabaseName);
dbDict.Add("tablename", "Relation_Game_AgeRatings");
data = db.ExecuteCMD(sql, dbDict);
if (data.Rows.Count == 0)
{
Logging.Log(Logging.LogType.Information, "Database", "Schema version " + TargetSchemaVersion + " requires a table which is missing.");
string resourceName = "gaseous_server.Support.Database.MySQL.gaseous-fix-1005.sql";
string dbScript = "";
string[] resources = Assembly.GetExecutingAssembly().GetManifestResourceNames();
if (resources.Contains(resourceName))
{
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
using (StreamReader reader = new StreamReader(stream))
{
dbScript = reader.ReadToEnd();
// apply schema!
Logging.Log(Logging.LogType.Information, "Database", "Applying schema version fix prior to version 1005");
db.ExecuteCMD(dbScript, dbDict, 180);
}
}
}
break;
}
break;
}
}
public static void PostUpgradeScript(int TargetSchemaVersion, Database.databaseType? DatabaseType)
@@ -17,6 +67,7 @@ namespace gaseous_server.Classes
Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
string sql = "";
Dictionary<string, object> dbDict = new Dictionary<string, object>();
DataTable data;
switch(DatabaseType)
{
@@ -38,7 +89,7 @@ namespace gaseous_server.Classes
dbDict.Add("path", oldRoot);
dbDict.Add("defaultlibrary", 1);
dbDict.Add("defaultplatform", 0);
DataTable data = db.ExecuteCMD(sql, dbDict);
data = db.ExecuteCMD(sql, dbDict);
// apply the new library id to the existing roms
sql = "UPDATE Games_Roms SET LibraryId=@libraryid;";

View File

@@ -26,18 +26,17 @@ SELECT
*
FROM
(SELECT DISTINCT
row_number() over (partition by Id order by AgeGroupId desc) as seqnum, view_GamesWithRoms.*,
(SELECT
AgeGroupId
FROM
ClassificationMap
WHERE
RatingId = AgeRating.Rating
ORDER BY AgeGroupId DESC) AgeGroupId
row_number() over (partition by Id order by AgeGroup.AgeGroupId desc) as seqnum, view_GamesWithRoms.*,
AgeGroup.AgeGroupId AS AgeGroupId
FROM
view_GamesWithRoms
LEFT JOIN Relation_Game_AgeRatings ON view_GamesWithRoms.Id = Relation_Game_AgeRatings.GameId
LEFT JOIN AgeRating ON Relation_Game_AgeRatings.AgeRatingsId = AgeRating.Id
LEFT JOIN (SELECT
AgeGroupId, RatingId
FROM
ClassificationMap
ORDER BY AgeGroupId DESC) AgeGroup ON AgeRating.Rating = AgeGroup.RatingId
) g
WHERE g.seqnum = 1;

View File

@@ -0,0 +1,49 @@
CREATE TABLE `Relation_Game_AgeRatings` (
`GameId` BIGINT NOT NULL,
`AgeRatingsId` BIGINT NOT NULL,
PRIMARY KEY (`GameId`, `AgeRatingsId`),
INDEX `idx_PrimaryColumn` (`GameId` ASC) VISIBLE
);
CREATE TABLE `Relation_Game_Genres` (
`GameId` BIGINT NOT NULL,
`GenresId` BIGINT NOT NULL,
PRIMARY KEY (`GameId`, `GenresId`),
INDEX `idx_PrimaryColumn` (`GameId` ASC) VISIBLE
);
CREATE TABLE `Relation_Game_GameModes` (
`GameId` BIGINT NOT NULL,
`GameModesId` BIGINT NOT NULL,
PRIMARY KEY (`GameId`, `GameModesId`),
INDEX `idx_PrimaryColumn` (`GameId` ASC) VISIBLE
);
CREATE TABLE `Relation_Game_PlayerPerspectives` (
`GameId` BIGINT NOT NULL,
`PlayerPerspectivesId` BIGINT NOT NULL,
PRIMARY KEY (`GameId`, `PlayerPerspectivesId`),
INDEX `idx_PrimaryColumn` (`GameId` ASC) VISIBLE
);
CREATE TABLE `Relation_Game_Themes` (
`GameId` BIGINT NOT NULL,
`ThemesId` BIGINT NOT NULL,
PRIMARY KEY (`GameId`, `ThemesId`),
INDEX `idx_PrimaryColumn` (`GameId` ASC) VISIBLE
);
ALTER TABLE `Games_Roms`
ADD COLUMN `LastMatchAttemptDate` DATETIME NULL AFTER `LibraryId`;
CREATE TABLE `RomMediaGroup` (
`Id` BIGINT NOT NULL AUTO_INCREMENT,
`Status` INT NULL,
`PlatformId` BIGINT NULL,
`GameId` BIGINT NULL,
PRIMARY KEY (`Id`));
CREATE TABLE `RomMediaGroup_Members` (
`GroupId` BIGINT NOT NULL,
`RomId` BIGINT NOT NULL,
PRIMARY KEY (`GroupId`, `RomId`));

View File

@@ -46,6 +46,7 @@
<None Remove="Support\Database\MySQL\gaseous-1002.sql" />
<None Remove="Support\Database\MySQL\gaseous-1003.sql" />
<None Remove="Support\Database\MySQL\gaseous-1004.sql" />
<None Remove="Support\Database\MySQL\gaseous-fix-1005.sql" />
<None Remove="Support\Database\MySQL\gaseous-1005.sql" />
<None Remove="Support\Database\MySQL\gaseous-1006.sql" />
<None Remove="Support\Database\MySQL\gaseous-1007.sql" />
@@ -86,6 +87,7 @@
<EmbeddedResource Include="Support\Database\MySQL\gaseous-1002.sql" />
<EmbeddedResource Include="Support\Database\MySQL\gaseous-1003.sql" />
<EmbeddedResource Include="Support\Database\MySQL\gaseous-1004.sql" />
<EmbeddedResource Include="Support\Database\MySQL\gaseous-fix-1005.sql" />
<EmbeddedResource Include="Support\Database\MySQL\gaseous-1005.sql" />
<EmbeddedResource Include="Support\Database\MySQL\gaseous-1006.sql" />
<EmbeddedResource Include="Support\Database\MySQL\gaseous-1007.sql" />