Skip to content

Commit

Permalink
feat(api): add new columns in challenges for pix-junior
Browse files Browse the repository at this point in the history
  • Loading branch information
aurelie-crouillebois committed Jan 29, 2025
1 parent 7e02f1c commit aa88f91
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
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 };
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 };

0 comments on commit aa88f91

Please sign in to comment.