sqlite bug fixes

This commit is contained in:
Kegan Dougal 2020-03-05 16:25:56 +00:00
parent 086b9164f5
commit 370816c21c
4 changed files with 7 additions and 5 deletions

View file

@ -206,8 +206,10 @@ func (s *publicRoomsStatements) selectPublicRooms(
return rooms, err return rooms, err
} }
if err := json.Unmarshal([]byte(aliasesJSON), &r.Aliases); err != nil { if len(aliasesJSON) > 0 {
return rooms, err if err := json.Unmarshal([]byte(aliasesJSON), &r.Aliases); err != nil {
return rooms, err
}
} }
rooms = append(rooms, r) rooms = append(rooms, r)

View file

@ -38,7 +38,7 @@ const eventsSchema = `
depth INTEGER NOT NULL, depth INTEGER NOT NULL,
event_id TEXT NOT NULL UNIQUE, event_id TEXT NOT NULL UNIQUE,
reference_sha256 BLOB NOT NULL, reference_sha256 BLOB NOT NULL,
auth_event_nids TEXT NOT NULL DEFAULT '{}' auth_event_nids TEXT NOT NULL DEFAULT '[]'
); );
` `

View file

@ -28,7 +28,7 @@ const roomsSchema = `
CREATE TABLE IF NOT EXISTS roomserver_rooms ( CREATE TABLE IF NOT EXISTS roomserver_rooms (
room_nid INTEGER PRIMARY KEY AUTOINCREMENT, room_nid INTEGER PRIMARY KEY AUTOINCREMENT,
room_id TEXT NOT NULL UNIQUE, room_id TEXT NOT NULL UNIQUE,
latest_event_nids TEXT NOT NULL DEFAULT '{}', latest_event_nids TEXT NOT NULL DEFAULT '[]',
last_event_sent_nid INTEGER NOT NULL DEFAULT 0, last_event_sent_nid INTEGER NOT NULL DEFAULT 0,
state_snapshot_nid INTEGER NOT NULL DEFAULT 0, state_snapshot_nid INTEGER NOT NULL DEFAULT 0,
room_version INTEGER NOT NULL DEFAULT 1 room_version INTEGER NOT NULL DEFAULT 1

View file

@ -30,7 +30,7 @@ const stateSnapshotSchema = `
CREATE TABLE IF NOT EXISTS roomserver_state_snapshots ( CREATE TABLE IF NOT EXISTS roomserver_state_snapshots (
state_snapshot_nid INTEGER PRIMARY KEY AUTOINCREMENT, state_snapshot_nid INTEGER PRIMARY KEY AUTOINCREMENT,
room_nid INTEGER NOT NULL, room_nid INTEGER NOT NULL,
state_block_nids TEXT NOT NULL DEFAULT '{}' state_block_nids TEXT NOT NULL DEFAULT '[]'
); );
` `