How to use the matrix-appservice-bridge.EventBridgeStore function in matrix-appservice-bridge

To help you get started, we’ve selected a few matrix-appservice-bridge examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matrix-org / matrix-appservice-slack / src / scripts / migrateToPostgres.ts View on Github external
try {
        await promisify(teamStore.loadDatabase).bind(teamStore)();
        await promisify(roomStore.loadDatabase).bind(roomStore)();
        await promisify(userStore.loadDatabase).bind(userStore)();
        await promisify(eventStore.loadDatabase).bind(eventStore)();
    } catch (ex) {
        log.error("Couldn't load datastores");
        log.error("Ensure you have given the correct path to the database.");
        throw ex;
    }

    const nedb = new NedbDatastore(
        new UserBridgeStore(userStore),
        new RoomBridgeStore(roomStore),
        new EventBridgeStore(eventStore),
        teamStore,
    );
    try {
        const startedAt = Date.now();
        await migrateFromNedb(nedb, pgres);
        log.info(`Completed migration in ${Math.round(Date.now() - startedAt)}ms`);
    } catch (ex) {
        log.error("An error occured while migrating databases:");
        log.error(ex);
        log.error("Your existing databases have not been modified, but you may need to drop the postgres table and start over");
    }
}