-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TECH] Refacto des badges des certifications complémentaires (PIX-9862)
- Loading branch information
Showing
54 changed files
with
1,452 additions
and
1,181 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
29 changes: 29 additions & 0 deletions
29
api/db/migrations/20231106161726_add-cc-course-results-to-cc-badges-reference.js
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const TABLE_NAME = 'complementary-certification-course-results'; | ||
const REF_TABLE_NAME = 'complementary-certification-badges'; | ||
const COLUMN_NAME = 'complementaryCertificationBadgeId'; | ||
|
||
const up = async function (knex) { | ||
await knex.schema.table(TABLE_NAME, function (table) { | ||
table | ||
.integer(COLUMN_NAME) | ||
.defaultTo(null) | ||
.references(`${REF_TABLE_NAME}.id`) | ||
.withKeyName('cccresults-ccbadgeId_foreignkey'); | ||
}); | ||
|
||
await knex(TABLE_NAME).update({ | ||
[COLUMN_NAME]: knex(`${REF_TABLE_NAME}`) | ||
.select(`${REF_TABLE_NAME}.id`) | ||
.innerJoin('badges', 'badges.id', `${REF_TABLE_NAME}.badgeId`) | ||
// eslint-disable-next-line knex/avoid-injections | ||
.where('badges.key', '=', knex.raw(`"${TABLE_NAME}"."partnerKey"`)), | ||
}); | ||
}; | ||
|
||
const down = async function (knex) { | ||
await knex.schema.table(TABLE_NAME, function (table) { | ||
table.dropColumn(COLUMN_NAME); | ||
}); | ||
}; | ||
|
||
export { up, down }; |
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
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
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
Oops, something went wrong.