From 94874d1a9e08489a6c58f0790d207728d6518508 Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Tue, 11 Jan 2022 12:14:32 -0800 Subject: [PATCH] adding more tables through automigration --- net/server/internal/store/db_schema.go | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/net/server/internal/store/db_schema.go b/net/server/internal/store/db_schema.go index b5c4ba92..6e731943 100644 --- a/net/server/internal/store/db_schema.go +++ b/net/server/internal/store/db_schema.go @@ -3,7 +3,9 @@ package store import "gorm.io/gorm" func AutoMigrate(db *gorm.DB) { + db.AutoMigrate(&App{}); db.AutoMigrate(&Account{}); + db.AutoMigrate(&AccountApp{}); } type Account struct { @@ -16,7 +18,6 @@ type Account struct { Description string Location string Image string - Created int64 `gorm:"autoCreateTime"` profileRevision uint64 contentRevision uint64 viewRevision uint64 @@ -25,5 +26,25 @@ type Account struct { cardRevision uint64 dialogueRevision uint64 insightRevision uint64 + Created int64 `gorm:"autoCreateTime"` + AccountApps []AccountApp +} + +type App struct { + ID uint `gorm:"primaryKey;not null;unique;autoIncrement"` + Name string + Description string + Image string + Url string + Created int64 `gorm:"autoCreateTime"` +} + +type AccountApp struct { + ID uint `gorm:"primaryKey;not null;unique;autoIncrement"` + AccountID uint + AppID uint + Token string `gorm:"not null"` + Created int64 `gorm:"autoCreateTime"` + App App }