mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
Split migrations folder (#21549)
There are too many files in `models/migrations` folder so that I split them into sub folders.
This commit is contained in:
parent
4827f42f56
commit
e72acd5e5b
190 changed files with 1711 additions and 1481 deletions
38
models/migrations/v1_14/v164.go
Normal file
38
models/migrations/v1_14/v164.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package v1_14 //nolint
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
// OAuth2Grant here is a snapshot of models.OAuth2Grant for this version
|
||||
// of the database, as it does not appear to have been added as a part
|
||||
// of a previous migration.
|
||||
type OAuth2Grant struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
UserID int64 `xorm:"INDEX unique(user_application)"`
|
||||
ApplicationID int64 `xorm:"INDEX unique(user_application)"`
|
||||
Counter int64 `xorm:"NOT NULL DEFAULT 1"`
|
||||
Scope string `xorm:"TEXT"`
|
||||
Nonce string `xorm:"TEXT"`
|
||||
CreatedUnix int64 `xorm:"created"`
|
||||
UpdatedUnix int64 `xorm:"updated"`
|
||||
}
|
||||
|
||||
// TableName sets the database table name to be the correct one, as the
|
||||
// autogenerated table name for this struct is "o_auth2_grant".
|
||||
func (grant *OAuth2Grant) TableName() string {
|
||||
return "oauth2_grant"
|
||||
}
|
||||
|
||||
func AddScopeAndNonceColumnsToOAuth2Grant(x *xorm.Engine) error {
|
||||
if err := x.Sync2(new(OAuth2Grant)); err != nil {
|
||||
return fmt.Errorf("Sync2: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue