@@ -106,34 +106,33 @@ type BaseModel struct {
106106 ShareId ShareID `gorm:"foreignKey:Id;references:ID;constraint:OnDelete:CASCADE"` //;references:ID
107107 CreatedAt time.Time
108108 UpdatedAt time.Time
109- DeletedAt gorm.DeletedAt `gorm:"uniqueIndex:u_share;uniqueIndex:u_link;uniqueIndex: u_ocmshare"`
109+ DeletedAt gorm.DeletedAt `gorm:"uniqueIndex:u_share;uniqueIndex:u_ocmshare"`
110110}
111111
112112// ProtoShare contains fields that are common between PublicLinks and Shares.
113113type ProtoShare struct {
114114 BaseModel
115115 UIDOwner string `gorm:"size:64"`
116- UIDInitiator string `gorm:"size:64;uniqueIndex:u_link "`
116+ UIDInitiator string `gorm:"size:64;uniqueIndex:u_share "`
117117 ItemType ItemType `gorm:"size:16;index"` // file | folder | reference | symlink
118118 InitialPath string
119- Inode string `gorm:"size:32;uniqueIndex:u_share;uniqueIndex:u_link "`
120- Instance string `gorm:"size:32;uniqueIndex:u_share;uniqueIndex:u_link "`
121- Permissions uint8 `gorm:"uniqueIndex:u_share;uniqueIndex:u_link "`
119+ Inode string `gorm:"size:32;uniqueIndex:u_share"`
120+ Instance string `gorm:"size:32;uniqueIndex:u_share"`
121+ Permissions uint8 `gorm:"uniqueIndex:u_share"`
122122 Orphan bool
123123 Expiration datatypes.NullTime
124124}
125125
126126// Share is a regular share between users or groups. The unique index ensures that there
127- // can only be one share per (inode, instance, permissions, recipient) tuple, unless the share is deleted.
127+ // can only be one share per (initiator, inode, instance, permissions, recipient) tuple, unless the share is deleted.
128128type Share struct {
129129 ProtoShare
130130 ShareWith string `gorm:"size:255;uniqueIndex:u_share"` // 255 because this can be an external account, which has a long representation
131131 SharedWithIsGroup bool
132132 Description string `gorm:"size:1024"`
133133}
134134
135- // PublicLink is a public link share. The unique index ensures that there
136- // can only be one public link per (initiator, inode, instance, permissions) tuple, unless the link is deleted.
135+ // PublicLink is a public link share. No unique constraints are enforced beyond the token.
137136type PublicLink struct {
138137 ProtoShare
139138 // Current tokens are only 16 chars long, but old tokens used to be 32 characters
0 commit comments