Skip to content

Commit

Permalink
Delete Tag Filters when upgrading. It'll recreate them
Browse files Browse the repository at this point in the history
  • Loading branch information
da3dsoul committed Sep 29, 2023
1 parent b5dc0a0 commit 1d08c85
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Shoko.Server/Databases/MySQL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ public class MySQL : BaseDatabase<MySqlConnection>
"CREATE TABLE FilterPreset( FilterPresetID INT NOT NULL AUTO_INCREMENT, ParentFilterPresetID int, Name text NOT NULL, FilterType int NOT NULL, Locked bit NOT NULL, Hidden bit NOT NULL, ApplyAtSeriesLevel bit NOT NULL, Expression longtext, SortingExpression longtext, PRIMARY KEY (`FilterPresetID`) ); "),
new DatabaseCommand(119, 2,
"ALTER TABLE FilterPreset ADD INDEX IX_FilterPreset_ParentFilterPresetID (ParentFilterPresetID); ALTER TABLE FilterPreset ADD INDEX IX_FilterPreset_Name (Name); ALTER TABLE FilterPreset ADD INDEX IX_FilterPreset_FilterType (FilterType); ALTER TABLE FilterPreset ADD INDEX IX_FilterPreset_LockedHidden (Locked, Hidden);"),
new DatabaseCommand(119, 3, "DELETE FROM GroupFilter WHERE FilterType = 2"),
new DatabaseCommand(119, 3, "DELETE FROM GroupFilter WHERE FilterType = 2; DELETE FROM GroupFilter WHERE FilterType = 16;"),
new DatabaseCommand(119, 4, DatabaseFixes.MigrateGroupFilterToFilterPreset),
new DatabaseCommand(119, 5, DatabaseFixes.DropGroupFilter),
};
Expand Down
2 changes: 1 addition & 1 deletion Shoko.Server/Databases/SQLServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ public override bool HasVersionsTable()
"CREATE TABLE FilterPreset( FilterPresetID INT IDENTITY(1,1), ParentFilterPresetID int, Name nvarchar(250) NOT NULL, FilterType int NOT NULL, Locked bit NOT NULL, Hidden bit NOT NULL, ApplyAtSeriesLevel bit NOT NULL, Expression nvarchar(max), SortingExpression nvarchar(max) ); "),
new DatabaseCommand(112, 2,
"CREATE INDEX IX_FilterPreset_ParentFilterPresetID ON FilterPreset(ParentFilterPresetID); CREATE INDEX IX_FilterPreset_Name ON FilterPreset(Name); CREATE INDEX IX_FilterPreset_FilterType ON FilterPreset(FilterType); CREATE INDEX IX_FilterPreset_LockedHidden ON FilterPreset(Locked, Hidden);"),
new DatabaseCommand(112, 3, "DELETE FROM GroupFilter WHERE FilterType = 2"),
new DatabaseCommand(112, 3, "DELETE FROM GroupFilter WHERE FilterType = 2; DELETE FROM GroupFilter WHERE FilterType = 16;"),
new DatabaseCommand(112, 4, DatabaseFixes.MigrateGroupFilterToFilterPreset),
new DatabaseCommand(112, 5, DatabaseFixes.DropGroupFilter),
};
Expand Down
2 changes: 1 addition & 1 deletion Shoko.Server/Databases/SQLite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ public override void CreateDatabase()
"CREATE TABLE FilterPreset( FilterPresetID INTEGER PRIMARY KEY AUTOINCREMENT, ParentFilterPresetID int, Name text NOT NULL, FilterType int NOT NULL, Locked int NOT NULL, Hidden int NOT NULL, ApplyAtSeriesLevel int NOT NULL, Expression text, SortingExpression text ); "),
new DatabaseCommand(105, 2,
"CREATE INDEX IX_FilterPreset_ParentFilterPresetID ON FilterPreset(ParentFilterPresetID); CREATE INDEX IX_FilterPreset_Name ON FilterPreset(Name); CREATE INDEX IX_FilterPreset_FilterType ON FilterPreset(FilterType); CREATE INDEX IX_FilterPreset_LockedHidden ON FilterPreset(Locked, Hidden);"),
new DatabaseCommand(105, 3, "DELETE FROM GroupFilter WHERE FilterType = 2"),
new DatabaseCommand(105, 3, "DELETE FROM GroupFilter WHERE FilterType = 2; DELETE FROM GroupFilter WHERE FilterType = 16;"),
new DatabaseCommand(105, 4, DatabaseFixes.MigrateGroupFilterToFilterPreset),
new DatabaseCommand(105, 5, DatabaseFixes.DropGroupFilter),
};
Expand Down

0 comments on commit 1d08c85

Please sign in to comment.