SQLite model refactoring, part 2 (#3839)

* Treat empty image input as null
* Add validation to models.Date
* Allow zero dates in database
* Make scene_markers.scene_id non-nullable
* Drop scraped_items table
* Remove movie/studio checksum
* Add migration notes
---------
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
DingDongSoLong4
2023-07-13 04:15:02 +02:00
committed by GitHub
parent 67d4f9729a
commit 5580525c2d
74 changed files with 520 additions and 807 deletions

View File

@@ -57,7 +57,7 @@ func Test_imageQueryBuilder_Create(t *testing.T) {
rating = 60
ocounter = 5
url = "url"
date = models.NewDate("2003-02-01")
date, _ = models.ParseDate("2003-02-01")
createdAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
updatedAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
@@ -216,7 +216,7 @@ func Test_imageQueryBuilder_Update(t *testing.T) {
title = "title"
rating = 60
url = "url"
date = models.NewDate("2003-02-01")
date, _ = models.ParseDate("2003-02-01")
ocounter = 5
createdAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
updatedAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
@@ -396,7 +396,7 @@ func Test_imageQueryBuilder_UpdatePartial(t *testing.T) {
title = "title"
rating = 60
url = "url"
date = models.NewDate("2003-02-01")
date, _ = models.ParseDate("2003-02-01")
ocounter = 5
createdAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
updatedAt = time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)
@@ -965,10 +965,6 @@ func makeImageWithID(index int) *models.Image {
ret := makeImage(index)
ret.ID = imageIDs[index]
if ret.Date != nil && ret.Date.IsZero() {
ret.Date = nil
}
ret.Files = models.NewRelatedFiles([]file.File{makeImageFile(index)})
return ret
@@ -2877,7 +2873,7 @@ func TestImageQuerySorting(t *testing.T) {
"date",
models.SortDirectionEnumDesc,
imageIdxWithTwoGalleries,
imageIdxWithPerformerParentTag,
imageIdxWithGrandChildStudio,
},
}