This commit is contained in:
Charlotte 🦝 Delenk 2022-11-24 14:28:23 +01:00
parent 3cf22e0913
commit 2578678365
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122

View file

@ -1,3 +1,43 @@
diff --git a/database/portal.go b/database/portal.go
index d8ce90d..7c2d431 100644
--- a/database/portal.go
+++ b/database/portal.go
@@ -150,13 +150,13 @@ func (p *Portal) Scan(row dbutil.Scannable) *Portal {
func (p *Portal) Insert() {
query := `
- INSERT INTO portal (dcid, receiver, type, other_user_id, dc_guild_id, dc_parent_id, mxid,
+ INSERT INTO portal (dcid, receiver, type, other_user_id, dc_guild_id, mxid,
plain_name, name, name_set, topic, topic_set, avatar, avatar_url, avatar_set,
encrypted, in_space, first_event_id)
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18)
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)
`
_, err := p.db.Exec(query, p.Key.ChannelID, p.Key.Receiver, p.Type,
- strPtr(p.OtherUserID), strPtr(p.GuildID), strPtr(p.ParentID), strPtr(string(p.MXID)),
+ strPtr(p.OtherUserID), strPtr(p.GuildID), strPtr(string(p.MXID)),
p.PlainName, p.Name, p.NameSet, p.Topic, p.TopicSet, p.Avatar, p.AvatarURL.String(), p.AvatarSet,
p.Encrypted, p.InSpace, p.FirstEventID.String())
@@ -169,13 +169,13 @@ func (p *Portal) Insert() {
func (p *Portal) Update() {
query := `
UPDATE portal
- SET type=$1, other_user_id=$2, dc_guild_id=$3, dc_parent_id=$4, mxid=$5,
- plain_name=$6, name=$7, name_set=$8, topic=$9, topic_set=$10, avatar=$11, avatar_url=$12, avatar_set=$13,
- encrypted=$14, in_space=$15, first_event_id=$16
- WHERE dcid=$17 AND receiver=$18
+ SET type=$1, other_user_id=$2, dc_guild_id=$3, mxid=$4,
+ plain_name=$5, name=$6, name_set=$7, topic=$8, topic_set=$9, avatar=$10, avatar_url=$11, avatar_set=$12,
+ encrypted=$13, in_space=$14, first_event_id=$15
+ WHERE dcid=$16 AND receiver=$17
`
_, err := p.db.Exec(query,
- p.Type, strPtr(p.OtherUserID), strPtr(p.GuildID), strPtr(p.ParentID), strPtr(string(p.MXID)),
+ p.Type, strPtr(p.OtherUserID), strPtr(p.GuildID), strPtr(string(p.MXID)),
p.PlainName, p.Name, p.NameSet, p.Topic, p.TopicSet, p.Avatar, p.AvatarURL.String(), p.AvatarSet,
p.Encrypted, p.InSpace, p.FirstEventID.String(),
p.Key.ChannelID, p.Key.Receiver)
diff --git a/portal.go b/portal.go
index 25e0dc2..e305942 100644
--- a/portal.go