saving schema

This commit is contained in:
Roland Osborne 2022-02-08 13:25:44 -08:00
parent bdeebd0dde
commit db5f6c8bb6

View File

@ -11,21 +11,17 @@ func AutoMigrate(db *gorm.DB) {
db.AutoMigrate(&GroupSlot{}); db.AutoMigrate(&GroupSlot{});
db.AutoMigrate(&GroupData{}); db.AutoMigrate(&GroupData{});
db.AutoMigrate(&Group{}); db.AutoMigrate(&Group{});
db.AutoMigrate(&LabelSlot{}); db.AutoMigrate(&ChannelSlot{});
db.AutoMigrate(&LabelData{}); db.AutoMigrate(&Channel{});
db.AutoMigrate(&Label{});
db.AutoMigrate(&CardSlot{}); db.AutoMigrate(&CardSlot{});
db.AutoMigrate(&Card{}); db.AutoMigrate(&Card{});
db.AutoMigrate(&Asset{});
db.AutoMigrate(&ArticleSlot{}); db.AutoMigrate(&ArticleSlot{});
db.AutoMigrate(&Article{}); db.AutoMigrate(&Article{});
db.AutoMigrate(&ArticleAsset{}); db.AutoMigrate(&TopicSlot{});
db.AutoMigrate(&ArticleTag{});
db.AutoMigrate(&Dialogue{});
db.AutoMigrate(&Insight{});
db.AutoMigrate(&Topic{}); db.AutoMigrate(&Topic{});
db.AutoMigrate(&TopicAsset{}); db.AutoMigrate(&Asset{});
db.AutoMigrate(&TopicTag{}); db.AutoMigrate(&TagSlot{});
db.AutoMigrate(&Tag{});
} }
type Notification struct { type Notification struct {
@ -124,32 +120,6 @@ type GroupData struct {
Data string Data string
} }
type LabelSlot struct {
ID uint
LabelSlotId string `gorm:"not null;index:labelslot,unique"`
AccountID uint `gorm:"not null;index:labelslot,unique"`
Revision int64 `gorm:"not null"`
LabelID uint `gorm:"not null;default:0"`
Label *Label
Account Account
}
type Label struct {
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
LabelDataID uint `gorm:"not null;index:labeldata"`
DataType string `gorm:"index"`
Created int64 `gorm:"autoCreateTime"`
Updated int64 `gorm:"autoUpdateTime"`
Groups []Group `gorm:"many2many:label_groups;"`
LabelData LabelData
LabelSlot LabelSlot
}
type LabelData struct {
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
Data string
}
type CardSlot struct { type CardSlot struct {
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"` ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
CardSlotId string `gorm:"not null;index:cardslot,unique"` CardSlotId string `gorm:"not null;index:cardslot,unique"`
@ -189,21 +159,6 @@ type Card struct {
CardSlot CardSlot CardSlot CardSlot
} }
type Asset struct {
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
AssetId string `gorm:"not null;index:asset,unique"`
AccountID uint `gorm:"not null;index:asset,unique"`
Status string `gorm:"not null;index"`
Size uint64
Crc uint32
Transform string
TransformId string
TransformData string
Created int64 `gorm:"autoCreateTime"`
Updated int64 `gorm:"autoUpdateTime"`
Account Account
}
type ArticleSlot struct { type ArticleSlot struct {
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"` ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
ArticleSlotId string `gorm:"not null;index:articleslot,unique"` ArticleSlotId string `gorm:"not null;index:articleslot,unique"`
@ -219,103 +174,100 @@ type Article struct {
DataType string `gorm:"index"` DataType string `gorm:"index"`
Data string Data string
Status string `gorm:"not null;index"` Status string `gorm:"not null;index"`
Expires int64
Created int64 `gorm:"autoCreateTime"` Created int64 `gorm:"autoCreateTime"`
Updated int64 `gorm:"autoUpdateTime"` Updated int64 `gorm:"autoUpdateTime"`
TagUpdated int64 `gorm:"not null"`
TagCount int32 `gorm:"not null"`
TagRevision int64 `gorm:"not null"`
Groups []Group `gorm:"many2many:article_groups;"` Groups []Group `gorm:"many2many:article_groups;"`
Labels []Label `gorm:"many2many:article_labels;"`
ArticleSlot ArticleSlot ArticleSlot ArticleSlot
} }
type ArticleAsset struct { type ChannelSlot struct {
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"` ID uint
AssetID uint ChannelSlotId string `gorm:"not null;index:channelslot,unique"`
ArticleID uint AccountID uint `gorm:"not null;index:channelslot,unique"`
Article Article
Asset Asset
}
type ArticleTag struct {
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
TagId string `gorm:"not null;index:articletag,unique"`
ArticleID uint `gorm:"not null;index:articletag,unique"`
CardID uint
Revision int64 `gorm:"not null"` Revision int64 `gorm:"not null"`
DataType string `gorm:"index"` ChannelID uint `gorm:"not null;default:0"`
Data string Channel *Channel
Created int64 `gorm:"autoCreateTime"`
Updated int64 `gorm:"autoUpdateTime"`
Article Article
Card Card
}
type Dialogue struct {
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
DialogueId string `gorm:"not null;index:dialogue,unique"`
AccountID uint `gorm:"not null;index:dialogue,unique"`
Revision int64 `gorm:"not null"`
DataType string `gorm:"index"`
Data string
Created int64 `gorm:"autoCreateTime"`
Updated int64 `gorm:"autoUpdateTime"`
Active bool `gorm:"not null"`
MemberRevision uint64 `gorm:"not null"`
TopicUpdated int64
TopicRevision uint64 `gorm:"not null"`
Cards []Card `gorm:"many2many:dialog_cards;"`
Account Account Account Account
} }
type Insight struct { type Channel struct {
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"` ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
InsightId string `gorm:"not null;index:insight,unique"` DetailRevision int64 `gorm:"not null"`
CardID uint `gorm:"not null;index:insight,unique"` DataType string `gorm:"index"`
dialogueRevision uint64 `gorm:"not null"` Created int64 `gorm:"autoCreateTime"`
memberRevision uint64 `gorm:"not null"` Updated int64 `gorm:"autoUpdateTime"`
topicRevision uint64 `gorm:"not null"` SizeRevision int64 `gorm:"not null"`
Card Card TopicUpdated int64
TopicCount int64
Viewers []Group `gorm:"many2many:viewer_groups;"`
Members []Group `gorm:"many2many:member_groups;"`
ChannelSlot ChannelSlot
}
type TopicSlot struct {
ID uint
TopicSlotId string `gorm:"not null;index:topicslot,unique"`
AccountID uint `gorm:"not null;index:topicslot,unique"`
Revision int64 `gorm:"not null"`
TopicID uint `gorm:"not null;default:0"`
Topic *Topic
Account Account
} }
type Topic struct { type Topic struct {
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"` ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
TopicId string `gorm:"not null;index:topic,unique"` ChannelID uint
AccountID uint `gorm:"not null;index:topic,unique"` DetailRevision int64 `gorm:"not null"`
CardID uint Guid string
Revision int64 `gorm:"not null"`
DataType string `gorm:"index"` DataType string `gorm:"index"`
Data string Data string
Status string `gorm:"not null;index"` Status string `gorm:"not null;index"`
Created int64 `gorm:"autoCreateTime"` Created int64 `gorm:"autoCreateTime"`
Updated int64 `gorm:"autoUpdateTime"` Updated int64 `gorm:"autoUpdateTime"`
SizeRevision int64 `gorm:"not null"`
TagUpdated int64 `gorm:"not null"` TagUpdated int64 `gorm:"not null"`
TagRevision uint64 `gorm:"not null"` TagRevision uint64 `gorm:"not null"`
Account Account Channel *Channel
Card Card Assets []Asset
Tags []Tag
} }
type TopicAsset struct { type Asset struct {
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"` ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
AssetID uint AssetId string `gorm:"not null;index:asset,unique"`
AccountID uint `gorm:"not null;index:asset,unique"`
TopicID uint TopicID uint
Topic Topic Status string `gorm:"not null;index"`
Asset Asset Size uint64
Crc uint32
Transform string
TransformId string
TransformData string
Created int64 `gorm:"autoCreateTime"`
Updated int64 `gorm:"autoUpdateTime"`
Account Account
Topic *Topic
} }
type TopicTag struct { type TagSlot struct {
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"` ID uint
TagId string `gorm:"not null;index:topictag,unique"` TagSlotId string `gorm:"not null;index:topicslot,unique"`
TopicID uint `gorm:"not null;index:topictag,unique"` AccountID uint `gorm:"not null;index:topicslot,unique"`
CardID uint
Revision int64 `gorm:"not null"` Revision int64 `gorm:"not null"`
TagID uint `gorm:"not null;default:0"`
Tag *Tag
Account Account
}
type Tag struct {
ID uint `gorm:"primaryKey;not null;unique;autoIncrement"`
TopicID uint `gorm:"not null;index:tag,unique"`
Guid string
DataType string `gorm:"index"` DataType string `gorm:"index"`
Data string Data string
Created int64 `gorm:"autoCreateTime"` Created int64 `gorm:"autoCreateTime"`
Updated int64 `gorm:"autoUpdateTime"` Updated int64 `gorm:"autoUpdateTime"`
Topic Topic Topic *Topic
Card Card
} }