-
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] Ajout de nouvelles colonnes pour les challenges pix-junior
- Loading branch information
Showing
7 changed files
with
146 additions
and
0 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
20 changes: 20 additions & 0 deletions
20
api/db/migrations/20250129071223_add-has-embed-internal-validation-to-challenges.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,20 @@ | ||
const SCHEMA_NAME = 'learningcontent'; | ||
const TABLE_NAME = 'challenges'; | ||
const COLUMN_NAME = 'hasEmbedInternalValidation'; | ||
|
||
const up = async function (knex) { | ||
await knex.schema.withSchema(SCHEMA_NAME).table(TABLE_NAME, function (table) { | ||
table | ||
.boolean(COLUMN_NAME) | ||
.defaultTo(false) | ||
.comment('Indicates that the embed has internal rules to handle the challenge validation'); | ||
}); | ||
}; | ||
|
||
const down = async function (knex) { | ||
await knex.schema.withSchema(SCHEMA_NAME).table(TABLE_NAME, function (table) { | ||
table.dropColumn(COLUMN_NAME); | ||
}); | ||
}; | ||
|
||
export { down, up }; |
22 changes: 22 additions & 0 deletions
22
api/db/migrations/20250129071224_add-no-validation-needed-to-challenges.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,22 @@ | ||
const SCHEMA_NAME = 'learningcontent'; | ||
const TABLE_NAME = 'challenges'; | ||
const COLUMN_NAME = 'noValidationNeeded'; | ||
|
||
const up = async function (knex) { | ||
await knex.schema.withSchema(SCHEMA_NAME).table(TABLE_NAME, function (table) { | ||
table | ||
.boolean(COLUMN_NAME) | ||
.defaultTo(false) | ||
.comment( | ||
'Indicates that the challenge does not need any validation, i.e. contains only a video to watch or a text to read', | ||
); | ||
}); | ||
}; | ||
|
||
const down = async function (knex) { | ||
await knex.schema.withSchema(SCHEMA_NAME).table(TABLE_NAME, function (table) { | ||
table.dropColumn(COLUMN_NAME); | ||
}); | ||
}; | ||
|
||
export { down, up }; |
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.