Skip to content

Commit

Permalink
Merge pull request #992 from matrix-org/hs/postgres-entry-id
Browse files Browse the repository at this point in the history
Add entry.id to postgres rooms
  • Loading branch information
Half-Shot authored Feb 17, 2020
2 parents e00d447 + adc7037 commit 7d14b96
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/992.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ensure the room upgrades test passes with Postgres
2 changes: 1 addition & 1 deletion src/datastore/NedbDataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ export class NeDBDataStore implements DataStore {
return "ADMIN_" + userId; // clobber based on this.
}

private static createMappingId(roomId: string, ircDomain: string, ircChannel: string) {
public static createMappingId(roomId: string, ircDomain: string, ircChannel: string) {
// space as delimiter as none of these IDs allow spaces.
return roomId + " " + ircDomain + " " + ircChannel; // clobber based on this
}
Expand Down
3 changes: 2 additions & 1 deletion src/datastore/postgres/PgDataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { getLogger } from "../../logging";
import Bluebird from "bluebird";
import { StringCrypto } from "../StringCrypto";
import { toIrcLowerCase } from "../../irc/formatting";
import { NeDBDataStore } from "../NedbDataStore";

const log = getLogger("PgDatastore");

Expand Down Expand Up @@ -116,7 +117,7 @@ export class PgDataStore implements DataStore {

private static pgToRoomEntry(pgEntry: any): Entry {
return {
id: "",
id: NeDBDataStore.createMappingId(pgEntry.room_id, pgEntry.irc_domain, pgEntry.irc_channel),
matrix: new MatrixRoom(pgEntry.room_id, pgEntry.matrix_json),
remote: new RemoteRoom("",
{
Expand Down

0 comments on commit 7d14b96

Please sign in to comment.