-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve query to get all private compile software
- Loading branch information
Showing
7 changed files
with
168 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 23 additions & 15 deletions
38
api/src/core/adapters/dbApi/kysely/migrations/1720187269028_add-indexes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,54 @@ | ||
import type { Kysely } from "kysely"; | ||
|
||
const softwares_externalIdIdx = "softwares__externalId_idx"; | ||
const softwares_parentExternalIdIdx = "softwares__parentExternalId_idx"; | ||
const compiledSoftwares_SoftwareIdIdx = "compiled_softwares__softwareId_idx"; | ||
const compiledSoftwares_GroupByIdx = "compiled_softwares_group_by_idx"; | ||
const software_similarExternalIdIdx = "softwares_similarExternalId_idx"; | ||
const software_softwareIdIdx = "softwares_similarSoftwareId_idx"; | ||
const softwareReferents_softwareIdIdx = "softwareReferents_software_idx"; | ||
const softwareUsers_softwareIdIdx = "softwareUsers_software_idx"; | ||
const instances_mainSoftwareSillIdIdx = "instances_mainSoftwareSillId_idx"; | ||
|
||
export async function up(db: Kysely<any>): Promise<void> { | ||
await db.schema.createIndex(softwares_externalIdIdx).on("softwares").column("externalId").execute(); | ||
await db.schema | ||
.createIndex(softwares_parentExternalIdIdx) | ||
.on("softwares") | ||
.column("parentSoftwareWikidataId") | ||
.execute(); | ||
|
||
await db.schema | ||
.createIndex(software_similarExternalIdIdx) | ||
.on("softwares__similar_software_external_datas") | ||
.column("similarExternalId") | ||
.execute(); | ||
await db.schema | ||
.createIndex(software_softwareIdIdx) | ||
.on("softwares__similar_software_external_datas") | ||
.column("softwareId") | ||
.execute(); | ||
|
||
await db.schema | ||
.createIndex(compiledSoftwares_SoftwareIdIdx) | ||
.on("compiled_softwares") | ||
.column("softwareId") | ||
.execute(); | ||
|
||
await db.schema | ||
.createIndex(softwareReferents_softwareIdIdx) | ||
.on("software_referents") | ||
.column("softwareId") | ||
.execute(); | ||
|
||
await db.schema.createIndex(softwareUsers_softwareIdIdx).on("software_users").column("softwareId").execute(); | ||
await db.schema.createIndex(instances_mainSoftwareSillIdIdx).on("instances").column("mainSoftwareSillId").execute(); | ||
|
||
// CREATE INDEX idx_compiled_softwares_group_by ON compiled_softwares (softwareId, annuaireCnllServiceProviders, comptoirDuLibreSoftware, latestVersion, parentWikidataSoftware, serviceProviders, similarExternalSoftwares, softwareExternalData); | ||
await db.schema | ||
.createIndex(compiledSoftwares_GroupByIdx) | ||
.on("compiled_softwares") | ||
.column("softwareId") | ||
.column("annuaireCnllServiceProviders") | ||
.column("comptoirDuLibreSoftware") | ||
.column("latestVersion") | ||
.column("serviceProviders") | ||
.execute(); | ||
} | ||
|
||
export async function down(db: Kysely<any>): Promise<void> { | ||
await db.schema.dropIndex(softwares_parentExternalIdIdx).execute(); | ||
await db.schema.dropIndex(softwares_externalIdIdx).execute(); | ||
await db.schema.dropIndex(software_similarExternalIdIdx).execute(); | ||
await db.schema.dropIndex(software_softwareIdIdx).execute(); | ||
await db.schema.dropIndex(compiledSoftwares_SoftwareIdIdx).execute(); | ||
await db.schema.dropIndex(softwareReferents_softwareIdIdx).execute(); | ||
await db.schema.dropIndex(softwareUsers_softwareIdIdx).execute(); | ||
await db.schema.dropIndex(instances_mainSoftwareSillIdIdx).execute(); | ||
await db.schema.dropIndex(compiledSoftwares_GroupByIdx).execute(); | ||
} |
Oops, something went wrong.