diff --git a/api/db/database-builder/factory/learning-content/build-mission.js b/api/db/database-builder/factory/learning-content/build-mission.js index d85eba5d280..b410c641bb6 100644 --- a/api/db/database-builder/factory/learning-content/build-mission.js +++ b/api/db/database-builder/factory/learning-content/build-mission.js @@ -1,7 +1,7 @@ import { databaseBuffer } from '../../database-buffer.js'; export function buildMission({ - id = 'missionIdA', + id = 1, status = 'status Mission A', name_i18n = { fr: 'name FR Mission A', en: 'name EN Mission A' }, content = { some: 'content' }, diff --git a/api/db/migrations/20241127142253_alter-table-column-id-missions-to-integer.js b/api/db/migrations/20241127142253_alter-table-column-id-missions-to-integer.js new file mode 100644 index 00000000000..9f1205771a7 --- /dev/null +++ b/api/db/migrations/20241127142253_alter-table-column-id-missions-to-integer.js @@ -0,0 +1,30 @@ +const TABLE_NAME = 'missions'; +const SCHEMA_NAME = 'learningcontent'; +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +export async function up(knex) { + await knex.schema.withSchema(SCHEMA_NAME).dropTable(TABLE_NAME); + await knex.schema.withSchema(SCHEMA_NAME).createTable('missions', function (table) { + table.integer('id').primary(); + table.string('status'); + table.jsonb('name_i18n'); + table.jsonb('content'); + table.jsonb('learningObjectives_i18n'); + table.jsonb('validatedObjectives_i18n'); + table.string('introductionMediaType'); + table.text('introductionMediaUrl'); + table.jsonb('introductionMediaAlt_i18n'); + table.text('documentationUrl'); + table.text('cardImageUrl'); + table.string('competenceId'); + }); +} + +/** + * @returns { Promise } + */ +export async function down() { + // non +}