Skip to content

Commit

Permalink
Remove is_registered column from puppets
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jan 18, 2024
1 parent 28c501f commit bf45a8e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
11 changes: 4 additions & 7 deletions database/puppet.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
const (
puppetBaseSelect = `
SELECT id, name, username, avatar_id, avatar_url, name_set, avatar_set,
contact_info_set, is_registered, custom_mxid, access_token
contact_info_set, custom_mxid, access_token
FROM puppet
`
getPuppetByMetaIDQuery = puppetBaseSelect + `WHERE id=$1`
Expand All @@ -36,15 +36,15 @@ const (
updatePuppetQuery = `
UPDATE puppet SET
name=$2, username=$3, avatar_id=$4, avatar_url=$5, name_set=$6, avatar_set=$7,
contact_info_set=$8, is_registered=$9, custom_mxid=$10, access_token=$11
contact_info_set=$8, custom_mxid=$9, access_token=$10
WHERE id=$1
`
insertPuppetQuery = `
INSERT INTO puppet (
id, name, username, avatar_id, avatar_url, name_set, avatar_set,
contact_info_set, is_registered, custom_mxid, access_token
contact_info_set, custom_mxid, access_token
)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
`
)

Expand All @@ -64,7 +64,6 @@ type Puppet struct {
AvatarSet bool

ContactInfoSet bool
IsRegistered bool

CustomMXID id.UserID
AccessToken string
Expand Down Expand Up @@ -97,7 +96,6 @@ func (p *Puppet) Scan(row dbutil.Scannable) (*Puppet, error) {
&p.NameSet,
&p.AvatarSet,
&p.ContactInfoSet,
&p.IsRegistered,
&customMXID,
&p.AccessToken,
)
Expand All @@ -118,7 +116,6 @@ func (p *Puppet) sqlVariables() []any {
p.NameSet,
p.AvatarSet,
p.ContactInfoSet,
p.IsRegistered,
dbutil.StrPtr(p.CustomMXID),
p.AccessToken,
}
Expand Down
15 changes: 7 additions & 8 deletions database/upgrades/00-latest.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ CREATE TABLE portal (
);

CREATE TABLE puppet (
id BIGINT NOT NULL PRIMARY KEY,
name TEXT NOT NULL,
username TEXT NOT NULL,
avatar_id TEXT NOT NULL,
avatar_url TEXT NOT NULL,
name_set BOOLEAN NOT NULL DEFAULT false,
avatar_set BOOLEAN NOT NULL DEFAULT false,
id BIGINT NOT NULL PRIMARY KEY,
name TEXT NOT NULL,
username TEXT NOT NULL,
avatar_id TEXT NOT NULL,
avatar_url TEXT NOT NULL,
name_set BOOLEAN NOT NULL DEFAULT false,
avatar_set BOOLEAN NOT NULL DEFAULT false,

contact_info_set BOOLEAN NOT NULL DEFAULT false,
is_registered BOOLEAN NOT NULL DEFAULT false,

custom_mxid TEXT,
access_token TEXT NOT NULL,
Expand Down

0 comments on commit bf45a8e

Please sign in to comment.