File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+ // Licensed under the GNU Affero General Public License (AGPL).
3+ // See License-AGPL.txt in the project root for license information.
4+
5+ package common_db
6+
7+ import (
8+ "github.com/google/uuid"
9+ "time"
10+ )
11+
12+ type PersonalAccessToken struct {
13+ ID uuid.UUID `gorm:"primary_key;column:id;type:varchar;size:255;" json:"id"`
14+ UserID uuid.UUID `gorm:"column:userId;type:varchar;size:255;" json:"userId"`
15+ Hash string `gorm:"column:hash;type:varchar;size:255;" json:"hash"`
16+ Name string `gorm:"column:name;type:varchar;size:255;" json:"name"`
17+ Description string `gorm:"column:description;type:varchar;size:255;" json:"description"`
18+ Scopes []string `gorm:"column:scopes;type:text;size:65535;" json:"scopes"`
19+ ExpirationTime time.Time `gorm:"column:expirationTime;type:timestamp;" json:"expirationTime"`
20+ CreatedAt time.Time `gorm:"column:createdAt;type:timestamp;default:CURRENT_TIMESTAMP(6);" json:"createdAt"`
21+ LastModified time.Time `gorm:"column:_lastModified;type:timestamp;default:CURRENT_TIMESTAMP(6);" json:"_lastModified"`
22+
23+ // deleted is reserved for use by db-sync.
24+ _ bool `gorm:"column:deleted;type:tinyint;default:0;" json:"deleted"`
25+ }
26+
27+ // TableName sets the insert table name for this struct type
28+ func (d * PersonalAccessToken ) TableName () string {
29+ return "d_b_personal_access_token"
30+ }
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ require (
3636
3737require (
3838 github.com/go-sql-driver/mysql v1.6.0
39+ github.com/google/uuid v1.1.2
3940 github.com/relvacode/iso8601 v1.1.0
4041 gorm.io/driver/mysql v1.4.4
4142 gorm.io/gorm v1.24.1
You can’t perform that action at this time.
0 commit comments