mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) upgrade typeorm so we can support newer postgres
Summary: upgrade typeorm version, so Grist can run against newer versions of postgres. Dusted off some old benchmarking code to verify that important queries don't get slower. They don't appear to, unlike for some intermediate versions of typeorm I tried in the past. Most of the changes are because `findOne` changed how it interprets its arguments, and the value it returns when nothing is found. For the return value, I stuck with limiting its impact by emulating old behavior (returning undefined rather than null) rather than propagating the change out to parts of the code unrelated to the database. Test Plan: existing tests pass; manual testing with postgres 10 and 14 Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D3613
This commit is contained in:
@@ -170,7 +170,6 @@ export async function dbCheck(connection: Connection) {
|
||||
const options = await getConnectionOptions();
|
||||
log("database url:", getDatabaseUrl(options, false));
|
||||
log("migration files:", options.migrations);
|
||||
log("migration directory:", (options.cli && options.cli.migrationsDir) || 'unspecified');
|
||||
log("migrations applied to db:", migrations.migrationsInDb);
|
||||
log("migrations listed in code:", migrations.migrationsInCode);
|
||||
let exitCode: number = 0;
|
||||
|
||||
@@ -101,7 +101,7 @@ export class Hosts {
|
||||
} else {
|
||||
// Otherwise check for a custom host.
|
||||
const org = await mapGetOrSet(this._host2org, hostname, async () => {
|
||||
const o = await this._dbManager.connection.manager.findOne(Organization, {host: hostname});
|
||||
const o = await this._dbManager.connection.manager.findOne(Organization, {where: {host: hostname}});
|
||||
return o && o.domain || undefined;
|
||||
});
|
||||
if (!org) { throw new ApiError(`Domain not recognized: ${hostname}`, 404); }
|
||||
@@ -152,7 +152,7 @@ export class Hosts {
|
||||
if (org && this._getHostType(req.headers.host!) === 'native' && !this._dbManager.isMergedOrg(org)) {
|
||||
// Check if the org has a preferred host.
|
||||
const orgHost = await mapGetOrSet(this._org2host, org, async () => {
|
||||
const o = await this._dbManager.connection.manager.findOne(Organization, {domain: org});
|
||||
const o = await this._dbManager.connection.manager.findOne(Organization, {where: {domain: org}});
|
||||
return o && o.host || undefined;
|
||||
});
|
||||
if (orgHost && orgHost !== req.hostname) {
|
||||
|
||||
Reference in New Issue
Block a user