mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-07-25 02:48:05 +00:00
Upgrade Forgejo to our forked [xorm v1.4.0](https://code.forgejo.org/xorm/xorm/compare/v1.3.9-forgejo.12...v1.4.0), which is now named `code.forgejo.org/xorm/xorm` to reflect the current expectation that it is a permanent fork. A small number of API changes were made recently in https://code.forgejo.org/xorm/xorm/issues/120 which are accounted for in this PR, in addition to the module rename. ## Checklist The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. All work and communication must conform to Forgejo's [AI Agreement](https://codeberg.org/forgejo/governance/src/branch/main/AIAgreement.md). There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org). ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change. - [x] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12639 Reviewed-by: Otto <otto@codeberg.org>
93 lines
3.2 KiB
Go
93 lines
3.2 KiB
Go
// Copyright 2022 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package v1_17
|
|
|
|
import (
|
|
"forgejo.org/modules/timeutil"
|
|
|
|
"code.forgejo.org/xorm/xorm"
|
|
)
|
|
|
|
func AddPackageTables(x *xorm.Engine) error {
|
|
type Package struct {
|
|
ID int64 `xorm:"pk autoincr"`
|
|
OwnerID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
|
RepoID int64 `xorm:"INDEX"`
|
|
Type string `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
|
Name string `xorm:"NOT NULL"`
|
|
LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
|
SemverCompatible bool `xorm:"NOT NULL DEFAULT false"`
|
|
}
|
|
|
|
if err := x.Sync(new(Package)); err != nil {
|
|
return err
|
|
}
|
|
|
|
type PackageVersion struct {
|
|
ID int64 `xorm:"pk autoincr"`
|
|
PackageID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
|
CreatorID int64 `xorm:"NOT NULL DEFAULT 0"`
|
|
Version string `xorm:"NOT NULL"`
|
|
LowerVersion string `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
|
CreatedUnix timeutil.TimeStamp `xorm:"created INDEX NOT NULL"`
|
|
IsInternal bool `xorm:"INDEX NOT NULL DEFAULT false"`
|
|
MetadataJSON string `xorm:"metadata_json TEXT"`
|
|
DownloadCount int64 `xorm:"NOT NULL DEFAULT 0"`
|
|
}
|
|
|
|
if err := x.Sync(new(PackageVersion)); err != nil {
|
|
return err
|
|
}
|
|
|
|
type PackageProperty struct {
|
|
ID int64 `xorm:"pk autoincr"`
|
|
RefType int64 `xorm:"INDEX NOT NULL"`
|
|
RefID int64 `xorm:"INDEX NOT NULL"`
|
|
Name string `xorm:"INDEX NOT NULL"`
|
|
Value string `xorm:"TEXT NOT NULL"`
|
|
}
|
|
|
|
if err := x.Sync(new(PackageProperty)); err != nil {
|
|
return err
|
|
}
|
|
|
|
type PackageFile struct {
|
|
ID int64 `xorm:"pk autoincr"`
|
|
VersionID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
|
BlobID int64 `xorm:"INDEX NOT NULL"`
|
|
Name string `xorm:"NOT NULL"`
|
|
LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
|
CompositeKey string `xorm:"UNIQUE(s) INDEX"`
|
|
IsLead bool `xorm:"NOT NULL DEFAULT false"`
|
|
CreatedUnix timeutil.TimeStamp `xorm:"created INDEX NOT NULL"`
|
|
}
|
|
|
|
if err := x.Sync(new(PackageFile)); err != nil {
|
|
return err
|
|
}
|
|
|
|
type PackageBlob struct {
|
|
ID int64 `xorm:"pk autoincr"`
|
|
Size int64 `xorm:"NOT NULL DEFAULT 0"`
|
|
HashMD5 string `xorm:"hash_md5 char(32) UNIQUE(md5) INDEX NOT NULL"`
|
|
HashSHA1 string `xorm:"hash_sha1 char(40) UNIQUE(sha1) INDEX NOT NULL"`
|
|
HashSHA256 string `xorm:"hash_sha256 char(64) UNIQUE(sha256) INDEX NOT NULL"`
|
|
HashSHA512 string `xorm:"hash_sha512 char(128) UNIQUE(sha512) INDEX NOT NULL"`
|
|
CreatedUnix timeutil.TimeStamp `xorm:"created INDEX NOT NULL"`
|
|
}
|
|
|
|
if err := x.Sync(new(PackageBlob)); err != nil {
|
|
return err
|
|
}
|
|
|
|
type PackageBlobUpload struct {
|
|
ID string `xorm:"pk"`
|
|
BytesReceived int64 `xorm:"NOT NULL DEFAULT 0"`
|
|
HashStateBytes []byte `xorm:"BLOB"`
|
|
CreatedUnix timeutil.TimeStamp `xorm:"created NOT NULL"`
|
|
UpdatedUnix timeutil.TimeStamp `xorm:"updated INDEX NOT NULL"`
|
|
}
|
|
|
|
return x.Sync(new(PackageBlobUpload))
|
|
}
|