mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
workaround for issue where sqlite not autonicrmenting after delted record
This commit is contained in:
parent
b86aa94d25
commit
33c6599d05
@ -97,7 +97,7 @@ func RemoveChannel(w http.ResponseWriter, r *http.Request) {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
slot.Channel = nil
|
slot.Channel = nil
|
||||||
if res := tx.Model(&slot).Update("channel_id", 0).Error; res != nil {
|
if res := tx.Model(&slot).Update("channel_id", -1).Error; res != nil {
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
if res := tx.Model(&slot).Update("revision", account.ChannelRevision+1).Error; res != nil {
|
if res := tx.Model(&slot).Update("revision", account.ChannelRevision+1).Error; res != nil {
|
||||||
|
@ -67,6 +67,9 @@ func SetCloseMessage(w http.ResponseWriter, r *http.Request) {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if res := tx.Model(&slot).Update("card_id", -1).Error; res != nil {
|
||||||
|
return res
|
||||||
|
}
|
||||||
if res := tx.Model(&slot).Update("revision", account.CardRevision+1).Error; res != nil {
|
if res := tx.Model(&slot).Update("revision", account.CardRevision+1).Error; res != nil {
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
@ -173,13 +173,13 @@ type CardSlot struct {
|
|||||||
CardSlotID string `gorm:"not null;index:cardslot,unique"`
|
CardSlotID string `gorm:"not null;index:cardslot,unique"`
|
||||||
AccountID uint `gorm:"not null;index:cardslot,unique"`
|
AccountID uint `gorm:"not null;index:cardslot,unique"`
|
||||||
Revision int64 `gorm:"not null"`
|
Revision int64 `gorm:"not null"`
|
||||||
CardID uint `gorm:"not null;default:0"`
|
CardID int `gorm:"not null;default:0"`
|
||||||
Card *Card
|
Card *Card
|
||||||
Account Account
|
Account Account
|
||||||
}
|
}
|
||||||
|
|
||||||
type Card struct {
|
type Card struct {
|
||||||
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
ID int `gorm:"primaryKey;not null;unique;autoIncrement"`
|
||||||
AccountID string `gorm:"not null;index:cardguid,unique"`
|
AccountID string `gorm:"not null;index:cardguid,unique"`
|
||||||
GUID string `gorm:"not null;index:cardguid,unique"`
|
GUID string `gorm:"not null;index:cardguid,unique"`
|
||||||
Username string
|
Username string
|
||||||
@ -236,13 +236,13 @@ type ChannelSlot struct {
|
|||||||
ChannelSlotID string `gorm:"not null;index:channelslot,unique"`
|
ChannelSlotID string `gorm:"not null;index:channelslot,unique"`
|
||||||
AccountID uint `gorm:"not null;index:channelslot,unique"`
|
AccountID uint `gorm:"not null;index:channelslot,unique"`
|
||||||
Revision int64 `gorm:"not null"`
|
Revision int64 `gorm:"not null"`
|
||||||
ChannelID uint `gorm:"not null;default:0"`
|
ChannelID int `gorm:"not null;default:0"`
|
||||||
Channel *Channel
|
Channel *Channel
|
||||||
Account Account
|
Account Account
|
||||||
}
|
}
|
||||||
|
|
||||||
type Channel struct {
|
type Channel struct {
|
||||||
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
ID int `gorm:"primaryKey;not null;unique;autoIncrement"`
|
||||||
AccountID uint
|
AccountID uint
|
||||||
TopicRevision int64 `gorm:"not null"`
|
TopicRevision int64 `gorm:"not null"`
|
||||||
DetailRevision int64 `gorm:"not null"`
|
DetailRevision int64 `gorm:"not null"`
|
||||||
@ -259,8 +259,8 @@ type Channel struct {
|
|||||||
|
|
||||||
type Member struct {
|
type Member struct {
|
||||||
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
||||||
ChannelID uint
|
ChannelID int
|
||||||
CardID uint
|
CardID int
|
||||||
PushEnabled bool
|
PushEnabled bool
|
||||||
Card Card
|
Card Card
|
||||||
Channel *Channel
|
Channel *Channel
|
||||||
@ -270,7 +270,7 @@ type TopicSlot struct {
|
|||||||
ID uint
|
ID uint
|
||||||
TopicSlotID string `gorm:"not null;index:topicaccount,unique;index:topicchannel,unique"`
|
TopicSlotID string `gorm:"not null;index:topicaccount,unique;index:topicchannel,unique"`
|
||||||
AccountID uint `gorm:"not null;index:topicaccount,unique"`
|
AccountID uint `gorm:"not null;index:topicaccount,unique"`
|
||||||
ChannelID uint `gorm:"not null;index:topicchannel,unique"`
|
ChannelID int `gorm:"not null;index:topicchannel,unique"`
|
||||||
Revision int64 `gorm:"not null"`
|
Revision int64 `gorm:"not null"`
|
||||||
Topic *Topic
|
Topic *Topic
|
||||||
Channel *Channel
|
Channel *Channel
|
||||||
@ -281,7 +281,7 @@ type Topic struct {
|
|||||||
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
||||||
DetailRevision int64 `gorm:"not null"`
|
DetailRevision int64 `gorm:"not null"`
|
||||||
AccountID uint
|
AccountID uint
|
||||||
ChannelID uint
|
ChannelID int
|
||||||
TopicSlotID uint `gorm:"not null;index:topictopicslot,unique"`
|
TopicSlotID uint `gorm:"not null;index:topictopicslot,unique"`
|
||||||
GUID string
|
GUID string
|
||||||
DataType string `gorm:"index"`
|
DataType string `gorm:"index"`
|
||||||
@ -301,7 +301,7 @@ type Asset struct {
|
|||||||
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
||||||
AssetID string `gorm:"not null;index:asset,unique"`
|
AssetID string `gorm:"not null;index:asset,unique"`
|
||||||
AccountID uint `gorm:"not null;index:asset,unique"`
|
AccountID uint `gorm:"not null;index:asset,unique"`
|
||||||
ChannelID uint
|
ChannelID int
|
||||||
TopicID uint
|
TopicID uint
|
||||||
Status string `gorm:"not null;index"`
|
Status string `gorm:"not null;index"`
|
||||||
Size int64
|
Size int64
|
||||||
@ -321,7 +321,7 @@ type TagSlot struct {
|
|||||||
ID uint
|
ID uint
|
||||||
TagSlotID string `gorm:"not null;index:tagslot,unique"`
|
TagSlotID string `gorm:"not null;index:tagslot,unique"`
|
||||||
AccountID uint `gorm:"not null;index:tagslot,unique"`
|
AccountID uint `gorm:"not null;index:tagslot,unique"`
|
||||||
ChannelID uint `gorm:"not null"`
|
ChannelID int `gorm:"not null"`
|
||||||
TopicID uint `gorm:"not null;index:tagtopic"`
|
TopicID uint `gorm:"not null;index:tagtopic"`
|
||||||
Revision int64 `gorm:"not null"`
|
Revision int64 `gorm:"not null"`
|
||||||
Tag *Tag
|
Tag *Tag
|
||||||
@ -334,7 +334,7 @@ type Tag struct {
|
|||||||
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
|
||||||
TagSlotID uint `gorm:"not null;index:tagtagslot,unique"`
|
TagSlotID uint `gorm:"not null;index:tagtagslot,unique"`
|
||||||
AccountID uint
|
AccountID uint
|
||||||
ChannelID uint `gorm:"not null;index:channeltag"`
|
ChannelID int `gorm:"not null;index:channeltag"`
|
||||||
TopicID uint `gorm:"not null;index:topictag"`
|
TopicID uint `gorm:"not null;index:topictag"`
|
||||||
GUID string `gorm:"not null"`
|
GUID string `gorm:"not null"`
|
||||||
DataType string `gorm:"index"`
|
DataType string `gorm:"index"`
|
||||||
|
Loading…
Reference in New Issue
Block a user