mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Add updated_at field to stash_id's (#5259)
* Add updated_at field to stash_id's * Only set updated at on stash ids when actually updating in identify --------- Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
@@ -275,19 +275,21 @@ type stashIDTable struct {
|
||||
}
|
||||
|
||||
type stashIDRow struct {
|
||||
StashID null.String `db:"stash_id"`
|
||||
Endpoint null.String `db:"endpoint"`
|
||||
StashID null.String `db:"stash_id"`
|
||||
Endpoint null.String `db:"endpoint"`
|
||||
UpdatedAt Timestamp `db:"updated_at"`
|
||||
}
|
||||
|
||||
func (r *stashIDRow) resolve() models.StashID {
|
||||
return models.StashID{
|
||||
StashID: r.StashID.String,
|
||||
Endpoint: r.Endpoint.String,
|
||||
StashID: r.StashID.String,
|
||||
Endpoint: r.Endpoint.String,
|
||||
UpdatedAt: r.UpdatedAt.Timestamp,
|
||||
}
|
||||
}
|
||||
|
||||
func (t *stashIDTable) get(ctx context.Context, id int) ([]models.StashID, error) {
|
||||
q := dialect.Select("endpoint", "stash_id").From(t.table.table).Where(t.idColumn.Eq(id))
|
||||
q := dialect.Select("endpoint", "stash_id", "updated_at").From(t.table.table).Where(t.idColumn.Eq(id))
|
||||
|
||||
const single = false
|
||||
var ret []models.StashID
|
||||
@@ -308,8 +310,8 @@ func (t *stashIDTable) get(ctx context.Context, id int) ([]models.StashID, error
|
||||
}
|
||||
|
||||
func (t *stashIDTable) insertJoin(ctx context.Context, id int, v models.StashID) (sql.Result, error) {
|
||||
q := dialect.Insert(t.table.table).Cols(t.idColumn.GetCol(), "endpoint", "stash_id").Vals(
|
||||
goqu.Vals{id, v.Endpoint, v.StashID},
|
||||
var q = dialect.Insert(t.table.table).Cols(t.idColumn.GetCol(), "endpoint", "stash_id", "updated_at").Vals(
|
||||
goqu.Vals{id, v.Endpoint, v.StashID, v.UpdatedAt},
|
||||
)
|
||||
ret, err := exec(ctx, q)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user