1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-23 08:47:42 -05:00
forgejo/models/migrations/v24.go

51 lines
1.4 KiB
Go
Raw Normal View History

2017-03-17 10:24:51 -04:00
// Copyright 2017 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 migrations
import (
"time"
2019-10-17 05:26:49 -04:00
"xorm.io/xorm"
2017-03-17 10:24:51 -04:00
)
func changeGPGKeysColumns(x *xorm.Engine) error {
// EmailAddress is the list of all email addresses of a user. Can contain the
// primary email address, but is not obligatory.
type EmailAddress struct {
ID int64 `xorm:"pk autoincr"`
UID int64 `xorm:"INDEX NOT NULL"`
Email string `xorm:"UNIQUE NOT NULL"`
IsActivated bool
IsPrimary bool `xorm:"-"`
}
// GPGKey represents a GPG key.
type GPGKey struct {
ID int64 `xorm:"pk autoincr"`
OwnerID int64 `xorm:"INDEX NOT NULL"`
KeyID string `xorm:"INDEX CHAR(16) NOT NULL"`
PrimaryKeyID string `xorm:"CHAR(16)"`
Content string `xorm:"TEXT NOT NULL"`
Created time.Time `xorm:"-"`
CreatedUnix int64
Expired time.Time `xorm:"-"`
ExpiredUnix int64
Added time.Time `xorm:"-"`
AddedUnix int64
SubsKey []*GPGKey `xorm:"-"`
Emails []*EmailAddress
CanSign bool
CanEncryptComms bool
CanEncryptStorage bool
CanCertify bool
}
if err := x.DropTables(new(GPGKey)); err != nil {
return err
}
return x.Sync(new(GPGKey))
}