aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-02-28 17:00:53 +0100
committerAlex Auvolat <alex@adnab.me>2020-02-28 17:00:53 +0100
commit669c2c1c28b62ed8c5c91352102d521e22d8ad77 (patch)
treecd04a1146fd061a0562d98e422ea2e8bc7e5828e
parenteaf245e3eed04aec1b5aa3941ee7f54d62b6b149 (diff)
downloadeasybridge-669c2c1c28b62ed8c5c91352102d521e22d8ad77.tar.gz
easybridge-669c2c1c28b62ed8c5c91352102d521e22d8ad77.zip
Actually gorm:"type:text" was useless
With the Postgres backend, strings will use text by default. Using varchar(255) by default (which is stupid) is done only for sqlite, which doesn't care about the type anyways.
-rw-r--r--db.go42
1 files changed, 21 insertions, 21 deletions
diff --git a/db.go b/db.go
index e38a8eb..f9bed06 100644
--- a/db.go
+++ b/db.go
@@ -55,10 +55,10 @@ func InitDb() error {
type DbAccountConfig struct {
gorm.Model
- MxUserID string `gorm:"type:text;index"`
- Name string `gorm:"type:text"`
- Protocol string `gorm:"type:text"`
- Config string `gorm:"type:text"`
+ MxUserID string `gorm:"index"`
+ Name string
+ Protocol string
+ Config string
}
// List of joined channels to be re-joined on reconnect
@@ -66,21 +66,21 @@ type DbJoinedRoom struct {
ID uint `gorm:"primary_key"`
// User id and account name
- MxUserID string `gorm:"type:text"`
- Protocol string `gorm:"type:text"`
- AccountName string `gorm:"type:text"`
+ MxUserID string
+ Protocol string
+ AccountName string
// Room ID
- RoomID connector.RoomID `gorm:"type:text"`
+ RoomID connector.RoomID
}
// User mapping between protocol user IDs and puppeted matrix ids
type DbUserMap struct {
ID uint `gorm:"primary_key"`
- Protocol string `gorm:"type:text"`
- UserID connector.UserID `gorm:"type:text"`
- MxUserID string `gorm:"type:text;index"`
+ Protocol string
+ UserID connector.UserID
+ MxUserID string `gorm:"index"`
}
// Room mapping between Matrix rooms and outside rooms
@@ -88,13 +88,13 @@ type DbRoomMap struct {
ID uint `gorm:"primary_key"`
// Network protocol
- Protocol string `gorm:"type:text"`
+ Protocol string
// Room id on the bridged network
- RoomID connector.RoomID `gorm:"type:text"`
+ RoomID connector.RoomID
// Bridged room matrix id
- MxRoomID string `gorm:"type:text;index"`
+ MxRoomID string `gorm:"index"`
}
// Room mapping between Matrix rooms and private messages
@@ -102,21 +102,21 @@ type DbPmRoomMap struct {
ID uint `gorm:"primary_key"`
// User id and account name of the local end viewed on Matrix
- MxUserID string `gorm:"type:text"`
- Protocol string `gorm:"type:text"`
- AccountName string `gorm:"type:text"`
+ MxUserID string
+ Protocol string
+ AccountName string
// User id to reach them
- UserID connector.UserID `gorm:"type:text"`
+ UserID connector.UserID
// Bridged room for PMs
- MxRoomID string `gorm:"type:text;index"`
+ MxRoomID string `gorm:"index"`
}
// Key-value store for various things
type DbKv struct {
- Key string `gorm:"type:text;primary_key"`
- Value string `gorm:"type:text"`
+ Key string `gorm:"primary_key"`
+ Value string
}
// ---- Simple locking mechanism