code.gitea.io/gitea@v1.21.7/models/migrations/v1_19/v238.go (about)

     1  // Copyright 2022 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package v1_19 //nolint
     5  
     6  import (
     7  	"code.gitea.io/gitea/modules/timeutil"
     8  
     9  	"xorm.io/xorm"
    10  )
    11  
    12  // AddUpdatedUnixToLFSMetaObject adds an updated column to the LFSMetaObject to allow for garbage collection
    13  func AddUpdatedUnixToLFSMetaObject(x *xorm.Engine) error {
    14  	// Drop the table introduced in `v211`, it's considered badly designed and doesn't look like to be used.
    15  	// See: https://github.com/go-gitea/gitea/issues/21086#issuecomment-1318217453
    16  	// LFSMetaObject stores metadata for LFS tracked files.
    17  	type LFSMetaObject struct {
    18  		ID           int64              `xorm:"pk autoincr"`
    19  		Oid          string             `json:"oid" xorm:"UNIQUE(s) INDEX NOT NULL"`
    20  		Size         int64              `json:"size" xorm:"NOT NULL"`
    21  		RepositoryID int64              `xorm:"UNIQUE(s) INDEX NOT NULL"`
    22  		CreatedUnix  timeutil.TimeStamp `xorm:"created"`
    23  		UpdatedUnix  timeutil.TimeStamp `xorm:"INDEX updated"`
    24  	}
    25  
    26  	return x.Sync(new(LFSMetaObject))
    27  }