Skip to content

Commit 155d2e6

Browse files
authored
fix: use char(36) with golang uuid instead of sql uuid type (#78)
resolves #77
1 parent 4d341e9 commit 155d2e6

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

server/db/roles.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
)
1010

1111
type Role struct {
12-
ID uuid.UUID `gorm:"type:uuid;"`
12+
ID uuid.UUID `gorm:"primaryKey;type:char(36)"`
1313
Role string `gorm:"unique"`
1414
}
1515

server/db/session.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
)
1010

1111
type Session struct {
12-
ID uuid.UUID `gorm:"type:uuid;"`
13-
UserID uuid.UUID `gorm:"type:uuid;"`
12+
ID uuid.UUID `gorm:"primaryKey;type:char(36)"`
13+
UserID uuid.UUID `gorm:"type:char(36)"`
1414
User User
1515
UserAgent string
1616
IP string

server/db/user.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ import (
1010
)
1111

1212
type User struct {
13-
ID uuid.UUID `gorm:"type:uuid;"`
13+
ID uuid.UUID `gorm:"primaryKey;type:char(36)"`
1414
FirstName string
1515
LastName string
1616
Email string `gorm:"unique"`
17-
Password string
17+
Password string `gorm:"type:text"`
1818
SignupMethod string
1919
EmailVerifiedAt int64
20-
CreatedAt int64 `gorm:"autoCreateTime"`
21-
UpdatedAt int64 `gorm:"autoUpdateTime"`
22-
Image string
20+
CreatedAt int64 `gorm:"autoCreateTime"`
21+
UpdatedAt int64 `gorm:"autoUpdateTime"`
22+
Image string `gorm:"type:text"`
2323
Roles string
2424
}
2525

server/db/verificationRequests.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
)
1010

1111
type VerificationRequest struct {
12-
ID uuid.UUID `gorm:"type:uuid;"`
13-
Token string `gorm:"index"`
12+
ID uuid.UUID `gorm:"primaryKey;type:char(36)"`
13+
Token string `gorm:"type:text"`
1414
Identifier string
1515
ExpiresAt int64
1616
CreatedAt int64 `gorm:"autoCreateTime"`

0 commit comments

Comments
 (0)