Skip to content

Commit

Permalink
ajout d'index sur les tables pg
Browse files Browse the repository at this point in the history
  • Loading branch information
Mefl committed Oct 30, 2024
1 parent b1127cd commit 79cca77
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions api/db/migrations/20241028125952_add-indexes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const indexesToAdd = [
{ tableName: 'certification-subscriptions', index: ['complementaryCertificationId', 'certificationCandidateId'] },
{ tableName: 'complementary-certifications', index: ['key'] },
{ tableName: 'features', index: ['key'] },
{ tableName: 'campaign-features', index: ['campaignId', 'featureId'] },
{ tableName: 'complementary-certification-habilitations', index: ['certificationCenterId'] },
{ tableName: 'complementary-certification-badges', index: ['complementaryCertificationId'] },
{ tableName: 'complementary-certification-courses', index: ['complementaryCertificationBadgeId'] },
{ tableName: 'organizations', index: ['kexternalIdey'] },
{ tableName: 'organization-learners', index: ['organizationId', 'division'] },
];

const up = async function (knex) {
for (const { tableName, index } of indexesToAdd) {
await knex.schema.table(tableName, function (table) {
table.index(index);
});
}
};

const down = async function (knex) {
for (const { tableName, index } of indexesToAdd) {
await knex.schema.table(tableName, function (table) {
table.dropIndex(index);
});
}
};
export { down, up };

0 comments on commit 79cca77

Please sign in to comment.