mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
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:
@@ -15,7 +15,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/stashapp/stash/pkg/file"
|
||||
"github.com/stashapp/stash/pkg/hash/md5"
|
||||
"github.com/stashapp/stash/pkg/models"
|
||||
"github.com/stashapp/stash/pkg/sliceutil/intslice"
|
||||
"github.com/stashapp/stash/pkg/sqlite"
|
||||
@@ -956,14 +955,14 @@ func getWidth(index int) int {
|
||||
}
|
||||
|
||||
func getObjectDate(index int) *models.Date {
|
||||
dates := []string{"null", "", "0001-01-01", "2001-02-03"}
|
||||
dates := []string{"null", "2000-01-01", "0001-01-01", "2001-02-03"}
|
||||
date := dates[index%len(dates)]
|
||||
|
||||
if date == "null" {
|
||||
return nil
|
||||
}
|
||||
|
||||
ret := models.NewDate(date)
|
||||
ret, _ := models.ParseDate(date)
|
||||
return &ret
|
||||
}
|
||||
|
||||
@@ -1313,7 +1312,6 @@ func createMovies(ctx context.Context, mqb models.MovieReaderWriter, n int, o in
|
||||
movie := models.Movie{
|
||||
Name: name,
|
||||
URL: getMovieNullStringValue(index, urlField),
|
||||
Checksum: md5.FromString(name),
|
||||
}
|
||||
|
||||
err := mqb.Create(ctx, &movie)
|
||||
@@ -1578,7 +1576,6 @@ func getStudioNullStringValue(index int, field string) string {
|
||||
func createStudio(ctx context.Context, sqb models.StudioReaderWriter, name string, parentID *int) (*models.Studio, error) {
|
||||
studio := models.Studio{
|
||||
Name: name,
|
||||
Checksum: md5.FromString(name),
|
||||
}
|
||||
|
||||
if parentID != nil {
|
||||
@@ -1621,7 +1618,6 @@ func createStudios(ctx context.Context, sqb models.StudioReaderWriter, n int, o
|
||||
name = getStudioStringValue(index, name)
|
||||
studio := models.Studio{
|
||||
Name: name,
|
||||
Checksum: md5.FromString(name),
|
||||
URL: getStudioNullStringValue(index, urlField),
|
||||
IgnoreAutoTag: getIgnoreAutoTag(i),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user