mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-06 19:26:47 +02:00
Some checks failed
/ release (push) Waiting to run
testing-integration / test-unit (push) Waiting to run
testing-integration / test-sqlite (push) Waiting to run
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (redis) (push) Blocked by required conditions
testing / test-remote-cacher (valkey) (push) Blocked by required conditions
testing / test-remote-cacher (garnet) (push) Blocked by required conditions
testing / test-remote-cacher (redict) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
Integration tests for the release process / release-simulation (push) Has been cancelled
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8422 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org> Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
37 lines
1.1 KiB
Go
37 lines
1.1 KiB
Go
// Copyright 2020 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package v1_14
|
|
|
|
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.Sync(new(OAuth2Grant)); err != nil {
|
|
return fmt.Errorf("Sync: %w", err)
|
|
}
|
|
return nil
|
|
}
|