ShokoAnime / ShokoServer

Repository for Shoko Server.
http://shokoanime.com/shoko-server/
MIT License
386 stars 75 forks source link

feature: add DateTimeImported to VideoLocal #1019

Closed revam closed 1 year ago

revam commented 1 year ago

We're currently not tracking when a file was imported. This makes ordering the "Recently Imported" panel on the dashboard difficult to do correctly, so this PR adds a nullable date that's set when a file is either automatically imported by the system or manually imported by the user. It also unsets the date if a manual link is removed by the user, since it is no longer considered as imported.

Changes in this PR

da3dsoul commented 1 year ago

I would name it LastUpdated

da3dsoul commented 1 year ago

SQL migration:

UPDATE VideoLocal SET LastUpdated = DateCreated WHERE DateCreated IS NOT NULL;
revam commented 1 year ago

I would name it LastUpdated

We already have an update field (DateTimeUpdate) that's exclusively used by the hash command. And I don't want the import date (and import order!) to shift when someone triggers a rehash.

SQL migration:

UPDATE VideoLocal SET LastUpdated = DateCreated WHERE DateCreated IS NOT NULL;

Will update replace the C# part of the migration with this.

revam commented 1 year ago

SQL migration:

UPDATE VideoLocal SET LastUpdated = DateCreated WHERE DateCreated IS NOT NULL;

Actually, small problem. The current migration only updates the import date for the files with existing cross-references. Not all the files.

da3dsoul commented 1 year ago

Fair enough on the naming

revam commented 1 year ago

Do you have a SQL that also check the cross-reference table if a match exists, or should we keep it as C# code? @da3dsoul

da3dsoul commented 1 year ago

I'd need to open it in a console to check

revam commented 1 year ago

Added the SQL statements provided by @da3dsoul. Any other changes that needs to be made, or is it ok to merge this now?

da3dsoul commented 1 year ago

Should be fine

revam commented 1 year ago

Removed the now unused database fix helper.