Skip to content

Commit f27a7d5

Browse files
committed
Merge remote-tracking branch 'origin/master' into feat/db-schema-migrator
2 parents d7ea2b4 + ebcc603 commit f27a7d5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

share/model.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type ShareID struct {
4545
type BaseModel struct {
4646
// Id has to be called Id and not ID, otherwise the foreign key will not work
4747
// ID is a special field in GORM, which it uses as the default Primary Key
48-
Id uint `gorm:"uniqueIndex;not null"`
48+
Id uint `gorm:"primaryKey;not null;autoIncrement:false"`
4949
ShareId ShareID `gorm:"foreignKey:Id;references:ID;constraint:OnDelete:CASCADE"` //;references:ID
5050
CreatedAt time.Time
5151
UpdatedAt time.Time
@@ -62,23 +62,24 @@ type ProtoShare struct {
6262
UIDInitiator string `gorm:"size:64;index"`
6363
ItemType ItemType `gorm:"size:16;index"` // file | folder | reference | symlink
6464
InitialPath string
65-
Inode string `gorm:"primaryKey;size:32;index"`
66-
Instance string `gorm:"primaryKey;size:32;index"`
65+
Inode string `gorm:"size:32;index"`
66+
Instance string `gorm:"size:32;index"`
6767
Permissions uint8
6868
Orphan bool
6969
Expiration datatypes.NullTime
7070
}
7171

7272
type Share struct {
7373
ProtoShare
74-
ShareWith string `gorm:"primaryKey;size:255;index:i_share_with"` // 255 because this can be a lw account, which are mapped from email addresses / ...
74+
ShareWith string `gorm:"size:255;index:i_share_with"` // 255 because this can be a lw account, which are mapped from email addresses / ...
7575
SharedWithIsGroup bool
7676
Description string `gorm:"size:1024"`
7777
}
7878

7979
type PublicLink struct {
8080
ProtoShare
81-
Token string `gorm:"primaryKey;index:i_token"`
81+
// Current tokens are only 16 chars long, but old tokens used to be 32 characters
82+
Token string `gorm:"uniqueIndex:i_token;size:32"`
8283
Quicklink bool
8384
NotifyUploads bool
8485
NotifyUploadsExtraRecipients string

0 commit comments

Comments
 (0)