mirror of
https://github.com/graphql-hive/console
synced 2026-05-23 17:18:23 +00:00
fix: avoid n+1 query (#4085)
This commit is contained in:
parent
600433dfde
commit
1ecdd4861c
2 changed files with 13 additions and 11 deletions
|
|
@ -290,7 +290,7 @@ export class SchemaVersionHelper {
|
|||
beforeVersionCreatedAt: schemaVersion.createdAt,
|
||||
});
|
||||
|
||||
return !!composableVersion;
|
||||
return !composableVersion;
|
||||
}
|
||||
|
||||
async getServiceSdlForPreviousVersionService(schemaVersion: SchemaVersion, serviceName: string) {
|
||||
|
|
|
|||
|
|
@ -2635,16 +2635,18 @@ export async function createStorage(connection: string, maximumPoolSize: number)
|
|||
conditionalBreakingChangeMetadata: input.conditionalBreakingChangeMetadata,
|
||||
});
|
||||
|
||||
await Promise.all(
|
||||
input.logIds.concat(log.id).map(async lid => {
|
||||
await trx.query(sql`
|
||||
INSERT INTO schema_version_to_log
|
||||
(version_id, action_id)
|
||||
VALUES
|
||||
(${version.id}, ${lid})
|
||||
`);
|
||||
}),
|
||||
);
|
||||
await trx.query(sql`
|
||||
INSERT INTO schema_version_to_log
|
||||
(version_id, action_id)
|
||||
SELECT * FROM
|
||||
${sql.unnest(
|
||||
input.logIds.concat(log.id).map(actionId =>
|
||||
// Note: change.criticality.level is actually a computed value from meta
|
||||
[version.id, actionId],
|
||||
),
|
||||
['uuid', 'uuid'],
|
||||
)}
|
||||
`);
|
||||
|
||||
await insertSchemaVersionChanges(trx, {
|
||||
versionId: version.id,
|
||||
|
|
|
|||
Loading…
Reference in a new issue