Skip to content

Commit 68437b1

Browse files
hrntknralxleoabarisain
authored
fix: widen OAuth signature columns from VARCHAR(255) to VARCHAR(512) (#117)
OAuth token signatures regularly exceed 255 characters (~420 chars observed with Google OAuth + PostgreSQL), causing INSERT failures: ERROR: value too long for type character varying(255) (SQLSTATE 22001) Widen all 7 affected GORM model fields from size:255 to size:512. Fixes #111 Co-authored-by: Alex Leonov <[email protected]> Co-authored-by: Arnaud Barisain-Monrose <[email protected]>
1 parent 36eb35b commit 68437b1

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

pkg/repository/sql.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,43 +22,43 @@ type sqlRepository struct {
2222
}
2323

2424
type authorizeCodeSession struct {
25-
Code string `gorm:"primaryKey;size:255"`
25+
Code string `gorm:"primaryKey;size:512"`
2626
Request []byte `gorm:"not null"`
2727
CreatedAt time.Time
2828
UpdatedAt time.Time
2929
}
3030

3131
type accessTokenSession struct {
32-
Signature string `gorm:"primaryKey;size:255"`
32+
Signature string `gorm:"primaryKey;size:512"`
3333
Request []byte `gorm:"not null"`
3434
CreatedAt time.Time
3535
UpdatedAt time.Time
3636
}
3737

3838
type refreshTokenSession struct {
39-
Signature string `gorm:"primaryKey;size:255"`
40-
AccessSignature string `gorm:"size:255"`
39+
Signature string `gorm:"primaryKey;size:512"`
40+
AccessSignature string `gorm:"size:512"`
4141
Request []byte `gorm:"not null"`
4242
CreatedAt time.Time
4343
UpdatedAt time.Time
4444
}
4545

4646
type clientRecord struct {
47-
ID string `gorm:"primaryKey;size:255"`
47+
ID string `gorm:"primaryKey;size:512"`
4848
Client []byte `gorm:"not null"`
4949
CreatedAt time.Time
5050
UpdatedAt time.Time
5151
}
5252

5353
type pkceRequestSession struct {
54-
Signature string `gorm:"primaryKey;size:255"`
54+
Signature string `gorm:"primaryKey;size:512"`
5555
Request []byte `gorm:"not null"`
5656
CreatedAt time.Time
5757
UpdatedAt time.Time
5858
}
5959

6060
type authorizeRequestRecord struct {
61-
RequestID string `gorm:"primaryKey;size:255"`
61+
RequestID string `gorm:"primaryKey;size:512"`
6262
Request []byte `gorm:"not null"`
6363
CreatedAt time.Time
6464
UpdatedAt time.Time

0 commit comments

Comments
 (0)