aboutsummaryrefslogtreecommitdiff
path: root/db.go
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-02-26 20:21:32 +0100
committerAlex Auvolat <alex@adnab.me>2020-02-26 20:21:32 +0100
commitf675ba57e400d378088d29c08bd5d0bd9126c74b (patch)
treec5d54b55b9f8a1bbb5e12cafb3da846124a2f821 /db.go
parentd1b66d30883c9e5fda0c4cace494dec74d7df024 (diff)
downloadeasybridge-f675ba57e400d378088d29c08bd5d0bd9126c74b.tar.gz
easybridge-f675ba57e400d378088d29c08bd5d0bd9126c74b.zip
Implement account configuration save/load from db
Diffstat (limited to 'db.go')
-rw-r--r--db.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/db.go b/db.go
index 602bd1f..c5f74ef 100644
--- a/db.go
+++ b/db.go
@@ -25,6 +25,8 @@ func InitDb() error {
return err
}
+ db.AutoMigrate(&DbAccountConfig{})
+
db.AutoMigrate(&DbCache{})
db.AutoMigrate(&DbUserMap{})
@@ -42,6 +44,16 @@ func InitDb() error {
return nil
}
+// Account configuration
+type DbAccountConfig struct {
+ gorm.Model
+
+ MxUserID string `gorm:"index:account_mxuserid"`
+ Name string
+ Protocol string
+ Config string
+}
+
// Long-term cache entries
type DbCache struct {
gorm.Model
@@ -56,7 +68,7 @@ type DbUserMap struct {
Protocol string
UserID connector.UserID
- MxUserID string `gorm:"index:mxuserid"`
+ MxUserID string `gorm:"index:usermap_mxuserid"`
}
// Room mapping between Matrix rooms and outside rooms