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.
This commit is contained in:
parent
eaf245e3ee
commit
669c2c1c28
1 changed files with 21 additions and 21 deletions
42
db.go
42
db.go
|
@ -55,10 +55,10 @@ func InitDb() error {
|
||||||
type DbAccountConfig struct {
|
type DbAccountConfig struct {
|
||||||
gorm.Model
|
gorm.Model
|
||||||
|
|
||||||
MxUserID string `gorm:"type:text;index"`
|
MxUserID string `gorm:"index"`
|
||||||
Name string `gorm:"type:text"`
|
Name string
|
||||||
Protocol string `gorm:"type:text"`
|
Protocol string
|
||||||
Config string `gorm:"type:text"`
|
Config string
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of joined channels to be re-joined on reconnect
|
// List of joined channels to be re-joined on reconnect
|
||||||
|
@ -66,21 +66,21 @@ type DbJoinedRoom struct {
|
||||||
ID uint `gorm:"primary_key"`
|
ID uint `gorm:"primary_key"`
|
||||||
|
|
||||||
// User id and account name
|
// User id and account name
|
||||||
MxUserID string `gorm:"type:text"`
|
MxUserID string
|
||||||
Protocol string `gorm:"type:text"`
|
Protocol string
|
||||||
AccountName string `gorm:"type:text"`
|
AccountName string
|
||||||
|
|
||||||
// Room ID
|
// Room ID
|
||||||
RoomID connector.RoomID `gorm:"type:text"`
|
RoomID connector.RoomID
|
||||||
}
|
}
|
||||||
|
|
||||||
// User mapping between protocol user IDs and puppeted matrix ids
|
// User mapping between protocol user IDs and puppeted matrix ids
|
||||||
type DbUserMap struct {
|
type DbUserMap struct {
|
||||||
ID uint `gorm:"primary_key"`
|
ID uint `gorm:"primary_key"`
|
||||||
|
|
||||||
Protocol string `gorm:"type:text"`
|
Protocol string
|
||||||
UserID connector.UserID `gorm:"type:text"`
|
UserID connector.UserID
|
||||||
MxUserID string `gorm:"type:text;index"`
|
MxUserID string `gorm:"index"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Room mapping between Matrix rooms and outside rooms
|
// Room mapping between Matrix rooms and outside rooms
|
||||||
|
@ -88,13 +88,13 @@ type DbRoomMap struct {
|
||||||
ID uint `gorm:"primary_key"`
|
ID uint `gorm:"primary_key"`
|
||||||
|
|
||||||
// Network protocol
|
// Network protocol
|
||||||
Protocol string `gorm:"type:text"`
|
Protocol string
|
||||||
|
|
||||||
// Room id on the bridged network
|
// Room id on the bridged network
|
||||||
RoomID connector.RoomID `gorm:"type:text"`
|
RoomID connector.RoomID
|
||||||
|
|
||||||
// Bridged room matrix id
|
// Bridged room matrix id
|
||||||
MxRoomID string `gorm:"type:text;index"`
|
MxRoomID string `gorm:"index"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Room mapping between Matrix rooms and private messages
|
// Room mapping between Matrix rooms and private messages
|
||||||
|
@ -102,21 +102,21 @@ type DbPmRoomMap struct {
|
||||||
ID uint `gorm:"primary_key"`
|
ID uint `gorm:"primary_key"`
|
||||||
|
|
||||||
// User id and account name of the local end viewed on Matrix
|
// User id and account name of the local end viewed on Matrix
|
||||||
MxUserID string `gorm:"type:text"`
|
MxUserID string
|
||||||
Protocol string `gorm:"type:text"`
|
Protocol string
|
||||||
AccountName string `gorm:"type:text"`
|
AccountName string
|
||||||
|
|
||||||
// User id to reach them
|
// User id to reach them
|
||||||
UserID connector.UserID `gorm:"type:text"`
|
UserID connector.UserID
|
||||||
|
|
||||||
// Bridged room for PMs
|
// Bridged room for PMs
|
||||||
MxRoomID string `gorm:"type:text;index"`
|
MxRoomID string `gorm:"index"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key-value store for various things
|
// Key-value store for various things
|
||||||
type DbKv struct {
|
type DbKv struct {
|
||||||
Key string `gorm:"type:text;primary_key"`
|
Key string `gorm:"primary_key"`
|
||||||
Value string `gorm:"type:text"`
|
Value string
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Simple locking mechanism
|
// ---- Simple locking mechanism
|
||||||
|
|
Loading…
Reference in a new issue