Skip to content

Commit

Permalink
Fix SQL Server Migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
da3dsoul committed Nov 12, 2023
1 parent 3e240fa commit 30cce37
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Shoko.Server/Databases/SQLServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,8 @@ public override bool HasVersionsTable()
new DatabaseCommand(112, 4, DatabaseFixes.MigrateGroupFilterToFilterPreset),
new DatabaseCommand(112, 5, DatabaseFixes.DropGroupFilter),
new DatabaseCommand(113, 1, "ALTER TABLE AnimeGroup DROP COLUMN SortName;"),
new DatabaseCommand(114, 1, "ALTER TABLE AnimeEpisode DROP COLUMN PlexContractVersion;ALTER TABLE AnimeEpisode DROP COLUMN PlexContractBlob;ALTER TABLE AnimeEpisode DROP COLUMN PlexContractSize;ALTER TABLE AnimeGroup_User DROP COLUMN PlexContractVersion;ALTER TABLE AnimeGroup_User DROP COLUMN PlexContractBlob;ALTER TABLE AnimeGroup_User DROP COLUMN PlexContractSize;ALTER TABLE AnimeSeries_User DROP COLUMN PlexContractVersion;ALTER TABLE AnimeSeries_User DROP COLUMN PlexContractBlob;ALTER TABLE AnimeSeries_User DROP COLUMN PlexContractSize;"),
new DatabaseCommand(114, 1, "ALTER TABLE AnimeEpisode DROP COLUMN PlexContractBlob;ALTER TABLE AnimeGroup_User DROP COLUMN PlexContractBlob;ALTER TABLE AnimeSeries_User DROP COLUMN PlexContractBlob;"),
new DatabaseCommand(114, 2, DropPlexContractColumns),
};

private static Tuple<bool, string> DropDefaultsOnAnimeEpisode_User(object connection)
Expand All @@ -715,6 +716,20 @@ private static Tuple<bool, string> DropDefaultOnChaptered(object connection)
"CREATE INDEX IX_Versions_VersionType ON Versions(VersionType,VersionValue,VersionRevision);"),
};

private static void DropPlexContractColumns()
{
var tables = new[]
{
"AnimeEpisode", "AnimeSeries_User",
"AnimeGroup_User"
};
var columns = new[]
{
"PlexContractSize", "PlexContractVersion"
};
tables.ForEach(t => columns.ForEach(a => DropColumnWithDefaultConstraint(t, a)));
}

private static void DropVideoLocalMediaColumns()
{
string[] columns =
Expand Down

0 comments on commit 30cce37

Please sign in to comment.