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:
22
README.MD
22
README.MD
@@ -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**.
|
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
|
## Screenshots
|
||||||
| | |
|

|
||||||
| ------- | --------------------------------------- |
|

|
||||||
| Game Library |  |
|

|
||||||
| Game metadata and ROM display |  |
|
|
||||||
| Emulator |  |
|
|
||||||
|
|
||||||
|
|
||||||
## Requirements
|
## 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.
|
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
|
## Third Party Projects
|
||||||
The following projects are used by Gaseous
|
The following projects are used by Gaseous
|
||||||
* https://dotnet.microsoft.com/en-us/apps/aspnet
|
* [ASP.NET](https://dotnet.microsoft.com/en-us/apps/aspnet)
|
||||||
* https://github.com/JamesNK/Newtonsoft.Json
|
* [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json)
|
||||||
* https://www.nuget.org/packages/MySql.Data/8.0.32.1
|
* [MySQLConnector](https://mysqlconnector.net)
|
||||||
* https://github.com/kamranayub/igdb-dotnet
|
* [IGDB-DOTNET](https://github.com/kamranayub/igdb-dotnet)
|
||||||
* https://github.com/EmulatorJS/EmulatorJS
|
* [EmulatorJS](https://github.com/EmulatorJS/EmulatorJS)
|
||||||
|
|
||||||
## Discord Server
|
## Discord Server
|
||||||
[](https://discord.gg/Nhu7wpT3k4)
|
[](https://discord.gg/Nhu7wpT3k4)
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
namespace gaseous_server.Classes
|
namespace gaseous_server.Classes
|
||||||
{
|
{
|
||||||
@@ -9,7 +10,56 @@ namespace gaseous_server.Classes
|
|||||||
|
|
||||||
public static void PreUpgradeScript(int TargetSchemaVersion, Database.databaseType? DatabaseType)
|
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)
|
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);
|
Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
|
||||||
string sql = "";
|
string sql = "";
|
||||||
Dictionary<string, object> dbDict = new Dictionary<string, object>();
|
Dictionary<string, object> dbDict = new Dictionary<string, object>();
|
||||||
|
DataTable data;
|
||||||
|
|
||||||
switch(DatabaseType)
|
switch(DatabaseType)
|
||||||
{
|
{
|
||||||
@@ -38,7 +89,7 @@ namespace gaseous_server.Classes
|
|||||||
dbDict.Add("path", oldRoot);
|
dbDict.Add("path", oldRoot);
|
||||||
dbDict.Add("defaultlibrary", 1);
|
dbDict.Add("defaultlibrary", 1);
|
||||||
dbDict.Add("defaultplatform", 0);
|
dbDict.Add("defaultplatform", 0);
|
||||||
DataTable data = db.ExecuteCMD(sql, dbDict);
|
data = db.ExecuteCMD(sql, dbDict);
|
||||||
|
|
||||||
// apply the new library id to the existing roms
|
// apply the new library id to the existing roms
|
||||||
sql = "UPDATE Games_Roms SET LibraryId=@libraryid;";
|
sql = "UPDATE Games_Roms SET LibraryId=@libraryid;";
|
||||||
|
@@ -26,18 +26,17 @@ SELECT
|
|||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
(SELECT DISTINCT
|
(SELECT DISTINCT
|
||||||
row_number() over (partition by Id order by AgeGroupId desc) as seqnum, view_GamesWithRoms.*,
|
row_number() over (partition by Id order by AgeGroup.AgeGroupId desc) as seqnum, view_GamesWithRoms.*,
|
||||||
(SELECT
|
AgeGroup.AgeGroupId AS AgeGroupId
|
||||||
AgeGroupId
|
|
||||||
FROM
|
|
||||||
ClassificationMap
|
|
||||||
WHERE
|
|
||||||
RatingId = AgeRating.Rating
|
|
||||||
ORDER BY AgeGroupId DESC) AgeGroupId
|
|
||||||
FROM
|
FROM
|
||||||
view_GamesWithRoms
|
view_GamesWithRoms
|
||||||
LEFT JOIN Relation_Game_AgeRatings ON view_GamesWithRoms.Id = Relation_Game_AgeRatings.GameId
|
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 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
|
) g
|
||||||
WHERE g.seqnum = 1;
|
WHERE g.seqnum = 1;
|
||||||
|
|
||||||
|
49
gaseous-server/Support/Database/MySQL/gaseous-fix-1005.sql
Normal file
49
gaseous-server/Support/Database/MySQL/gaseous-fix-1005.sql
Normal 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`));
|
@@ -46,6 +46,7 @@
|
|||||||
<None Remove="Support\Database\MySQL\gaseous-1002.sql" />
|
<None Remove="Support\Database\MySQL\gaseous-1002.sql" />
|
||||||
<None Remove="Support\Database\MySQL\gaseous-1003.sql" />
|
<None Remove="Support\Database\MySQL\gaseous-1003.sql" />
|
||||||
<None Remove="Support\Database\MySQL\gaseous-1004.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-1005.sql" />
|
||||||
<None Remove="Support\Database\MySQL\gaseous-1006.sql" />
|
<None Remove="Support\Database\MySQL\gaseous-1006.sql" />
|
||||||
<None Remove="Support\Database\MySQL\gaseous-1007.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-1002.sql" />
|
||||||
<EmbeddedResource Include="Support\Database\MySQL\gaseous-1003.sql" />
|
<EmbeddedResource Include="Support\Database\MySQL\gaseous-1003.sql" />
|
||||||
<EmbeddedResource Include="Support\Database\MySQL\gaseous-1004.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-1005.sql" />
|
||||||
<EmbeddedResource Include="Support\Database\MySQL\gaseous-1006.sql" />
|
<EmbeddedResource Include="Support\Database\MySQL\gaseous-1006.sql" />
|
||||||
<EmbeddedResource Include="Support\Database\MySQL\gaseous-1007.sql" />
|
<EmbeddedResource Include="Support\Database\MySQL\gaseous-1007.sql" />
|
||||||
|
Reference in New Issue
Block a user