diff --git a/syncapi/storage/postgres/receipt_table.go b/syncapi/storage/postgres/receipt_table.go index 97b1585a0..c5ec6cbc6 100644 --- a/syncapi/storage/postgres/receipt_table.go +++ b/syncapi/storage/postgres/receipt_table.go @@ -30,6 +30,7 @@ import ( ) const receiptsSchema = ` +CREATE SEQUENCE IF NOT EXISTS syncapi_stream_id; -- Stores data about receipts CREATE TABLE IF NOT EXISTS syncapi_receipts ( -- The ID diff --git a/syncapi/storage/postgres/syncserver.go b/syncapi/storage/postgres/syncserver.go index a50f5a0ce..979e19a0b 100644 --- a/syncapi/storage/postgres/syncserver.go +++ b/syncapi/storage/postgres/syncserver.go @@ -35,8 +35,6 @@ type SyncServerDatasource struct { sqlutil.PartitionOffsetStatements } -const createSequence = "CREATE SEQUENCE IF NOT EXISTS syncapi_stream_id;" - // NewDatabase creates a new sync server database func NewDatabase(dbProperties *config.DatabaseOptions) (*SyncServerDatasource, error) { var d SyncServerDatasource diff --git a/syncapi/storage/shared/syncserver.go b/syncapi/storage/shared/syncserver.go index 3194ca597..2b82ee33c 100644 --- a/syncapi/storage/shared/syncserver.go +++ b/syncapi/storage/shared/syncserver.go @@ -621,7 +621,7 @@ func (d *Database) addEDUDeltaToResponse( if fromPos.EDUPosition() != toPos.EDUPosition() { // add typing deltas if err := d.addTypingDeltaToResponse(fromPos, joinedRoomIDs, res); err != nil { - return fmt.Errorf("unable to apply typing delta to response: %w") + return fmt.Errorf("unable to apply typing delta to response: %w", err) } } @@ -629,7 +629,7 @@ func (d *Database) addEDUDeltaToResponse( if (fromPos.EDUPosition() == 0 && toPos.EDUPosition() == 0) || fromPos.EDUPosition() != toPos.EDUPosition() { if err := d.addReceiptDeltaToResponse(fromPos, joinedRoomIDs, res); err != nil { - return fmt.Errorf("unable to apply receipts to response: %w") + return fmt.Errorf("unable to apply receipts to response: %w", err) } }