From 14b6f2c88b727773ac6dc820d5280aaf30457b36 Mon Sep 17 00:00:00 2001 From: Laura Bergoens Date: Wed, 20 Nov 2024 14:55:55 +0100 Subject: [PATCH 01/11] Add learningcontent schema and frameworks table Co-authored-by: Nicolas Lepage --- ...49_create-learningcontent-schema-and-tables.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js diff --git a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js new file mode 100644 index 00000000000..7ea70d1a36e --- /dev/null +++ b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js @@ -0,0 +1,15 @@ +const SCHEMA_NAME = 'learningcontent'; + +const up = async function (knex) { + await knex.raw(`CREATE SCHEMA ??`, [SCHEMA_NAME]); + await knex.schema.withSchema(SCHEMA_NAME).createTable('frameworks', function (table) { + table.string('id').primary(); + table.text('name'); + }); +}; + +const down = function (knex) { + return knex.schema.dropSchema(SCHEMA_NAME, true); +}; + +export { down, up }; From 3be82ece2a2758a7da2e1681a2dacc51bf8114ba Mon Sep 17 00:00:00 2001 From: Laura Bergoens Date: Wed, 20 Nov 2024 14:56:20 +0100 Subject: [PATCH 02/11] add areas table Co-authored-by: Nicolas Lepage --- ...120132349_create-learningcontent-schema-and-tables.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js index 7ea70d1a36e..72bbbe68db6 100644 --- a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js +++ b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js @@ -6,6 +6,15 @@ const up = async function (knex) { table.string('id').primary(); table.text('name'); }); + await knex.schema.withSchema(SCHEMA_NAME).createTable('areas', function (table) { + table.string('id').primary(); + table.string('code'); + table.text('name'); + table.jsonb('title_i18n'); + table.string('color'); + table.string('frameworkId').references('id').inTable(`${SCHEMA_NAME}.frameworks`); + table.specificType('competenceIds', 'string[]'); + }); }; const down = function (knex) { From 7aa1a4f57d963a3d28a28ecdbb308476875c57c4 Mon Sep 17 00:00:00 2001 From: Laura Bergoens Date: Wed, 20 Nov 2024 14:56:31 +0100 Subject: [PATCH 03/11] add competences table Co-authored-by: Nicolas Lepage --- ...0132349_create-learningcontent-schema-and-tables.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js index 72bbbe68db6..6256e219bf7 100644 --- a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js +++ b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js @@ -15,6 +15,16 @@ const up = async function (knex) { table.string('frameworkId').references('id').inTable(`${SCHEMA_NAME}.frameworks`); table.specificType('competenceIds', 'string[]'); }); + await knex.schema.withSchema(SCHEMA_NAME).createTable('competences', function (table) { + table.string('id').primary(); + table.jsonb('name_i18n'); + table.jsonb('description_i18n'); + table.string('index'); + table.text('origin'); + table.string('areaId').references('id').inTable(`${SCHEMA_NAME}.areas`); + table.specificType('skillIds', 'string[]'); + table.specificType('thematicIds', 'string[]'); + }); }; const down = function (knex) { From fb3224759a3f87dc8bf932131e1225b410550462 Mon Sep 17 00:00:00 2001 From: Laura Bergoens Date: Wed, 20 Nov 2024 15:00:08 +0100 Subject: [PATCH 04/11] add thematics table Co-authored-by: Nicolas Lepage --- ...41120132349_create-learningcontent-schema-and-tables.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js index 6256e219bf7..9c82b86b816 100644 --- a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js +++ b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js @@ -25,6 +25,13 @@ const up = async function (knex) { table.specificType('skillIds', 'string[]'); table.specificType('thematicIds', 'string[]'); }); + await knex.schema.withSchema(SCHEMA_NAME).createTable('thematics', function (table) { + table.string('id').primary(); + table.jsonb('name_i18n'); + table.integer('index'); + table.string('competenceId').references('id').inTable(`${SCHEMA_NAME}.competences`); + table.specificType('tubeIds', 'string[]'); + }); }; const down = function (knex) { From 7705ae7418cece54a18da4bdd8a32738534012c5 Mon Sep 17 00:00:00 2001 From: Laura Bergoens Date: Wed, 20 Nov 2024 15:03:02 +0100 Subject: [PATCH 05/11] add tubes table Co-authored-by: Nicolas Lepage --- ...2349_create-learningcontent-schema-and-tables.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js index 9c82b86b816..fb99bceee91 100644 --- a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js +++ b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js @@ -32,6 +32,19 @@ const up = async function (knex) { table.string('competenceId').references('id').inTable(`${SCHEMA_NAME}.competences`); table.specificType('tubeIds', 'string[]'); }); + await knex.schema.withSchema(SCHEMA_NAME).createTable('tubes', function (table) { + table.string('id').primary(); + table.text('name'); + table.text('title'); + table.text('description'); + table.jsonb('practicalTitle_i18n'); + table.jsonb('practicalDescription_i18n'); + table.string('competenceId').references('id').inTable(`${SCHEMA_NAME}.competences`); + table.string('thematicId').references('id').inTable(`${SCHEMA_NAME}.thematics`); + table.specificType('skillIds', 'string[]'); + table.boolean('isMobileCompliant'); + table.boolean('isTabletCompliant'); + }); }; const down = function (knex) { From 0d9aaa4066784a0e3049d9203c5939d76272f62b Mon Sep 17 00:00:00 2001 From: Laura Bergoens Date: Wed, 20 Nov 2024 15:23:03 +0100 Subject: [PATCH 06/11] add table skills Co-authored-by: Nicolas Lepage --- ...349_create-learningcontent-schema-and-tables.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js index fb99bceee91..1bcabc456e2 100644 --- a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js +++ b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js @@ -45,6 +45,20 @@ const up = async function (knex) { table.boolean('isMobileCompliant'); table.boolean('isTabletCompliant'); }); + await knex.schema.withSchema(SCHEMA_NAME).createTable('skills', function (table) { + table.string('id').primary(); + table.text('name'); + table.string('status'); + table.float('pixValue'); + table.integer('version'); + table.integer('level'); + table.string('hintStatus'); + table.jsonb('hint_i18n'); + table.string('competenceId').references('id').inTable(`${SCHEMA_NAME}.competences`); + table.string('tubeId').references('id').inTable(`${SCHEMA_NAME}.tubes`); + table.specificType('tutorialIds', 'string[]'); + table.specificType('learningMoreTutorialIds', 'string[]'); + }); }; const down = function (knex) { From e07eb8b8388ac3bbcb8aeffa5ec026a10ac9479a Mon Sep 17 00:00:00 2001 From: Laura Bergoens Date: Wed, 20 Nov 2024 15:38:01 +0100 Subject: [PATCH 07/11] add challenges table Co-authored-by: Nicolas Lepage --- ...reate-learningcontent-schema-and-tables.js | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js index 1bcabc456e2..54f3324c7a0 100644 --- a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js +++ b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js @@ -59,6 +59,46 @@ const up = async function (knex) { table.specificType('tutorialIds', 'string[]'); table.specificType('learningMoreTutorialIds', 'string[]'); }); + + await knex.schema.withSchema(SCHEMA_NAME).createTable('challenges', function (table) { + table.string('id').primary(); + table.text('instruction'); + table.text('alternativeInstruction'); + table.text('proposals'); + table.string('type'); + table.text('solution'); + table.text('solutionToDisplay'); + table.boolean('t1Status'); + table.boolean('t2Status'); + table.boolean('t3Status'); + table.string('status'); + table.string('genealogy'); + table.string('accessibility1'); + table.string('accessibility2'); + table.boolean('requireGafamWebsiteAccess'); + table.boolean('isIncompatibleIpadCertif'); + table.string('deafAndHardOfHearing'); + table.boolean('isAwarenessChallenge'); + table.boolean('toRephrase'); + table.integer('alternativeVersion'); + table.boolean('shuffled'); + table.text('illustrationAlt'); + table.text('illustrationUrl'); + table.specificType('attachments', 'string[]'); + table.string('responsive'); + table.float('alpha'); + table.float('delta'); + table.boolean('autoReply'); + table.boolean('focusable'); + table.string('format'); + table.integer('timer'); + table.integer('embedHeight'); + table.text('embedUrl'); + table.text('embedTitle'); + table.specificType('locales', 'string[]'); + table.string('competenceId').references('id').inTable(`${SCHEMA_NAME}.competences`); + table.string('skillId').references('id').inTable(`${SCHEMA_NAME}.skills`); + }); }; const down = function (knex) { From ddbfef0d2420d42d88cefd8edcf4bd69359db571 Mon Sep 17 00:00:00 2001 From: Laura Bergoens Date: Wed, 20 Nov 2024 15:54:10 +0100 Subject: [PATCH 08/11] add courses table Co-authored-by: Nicolas Lepage --- ...120132349_create-learningcontent-schema-and-tables.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js index 54f3324c7a0..51ef9b1da8a 100644 --- a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js +++ b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js @@ -59,7 +59,6 @@ const up = async function (knex) { table.specificType('tutorialIds', 'string[]'); table.specificType('learningMoreTutorialIds', 'string[]'); }); - await knex.schema.withSchema(SCHEMA_NAME).createTable('challenges', function (table) { table.string('id').primary(); table.text('instruction'); @@ -99,6 +98,14 @@ const up = async function (knex) { table.string('competenceId').references('id').inTable(`${SCHEMA_NAME}.competences`); table.string('skillId').references('id').inTable(`${SCHEMA_NAME}.skills`); }); + await knex.schema.withSchema(SCHEMA_NAME).createTable('courses', function (table) { + table.string('id').primary(); + table.text('name'); + table.text('description'); + table.boolean('isActive'); + table.specificType('competences', 'string[]'); + table.specificType('challenges', 'string[]'); + }); }; const down = function (knex) { From 210972306b508594bd84b08dbc0f25a837f9ddb2 Mon Sep 17 00:00:00 2001 From: Laura Bergoens Date: Wed, 20 Nov 2024 15:58:03 +0100 Subject: [PATCH 09/11] add tutorials table Co-authored-by: Nicolas Lepage --- ...120132349_create-learningcontent-schema-and-tables.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js index 51ef9b1da8a..235b1a3c292 100644 --- a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js +++ b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js @@ -106,6 +106,15 @@ const up = async function (knex) { table.specificType('competences', 'string[]'); table.specificType('challenges', 'string[]'); }); + await knex.schema.withSchema(SCHEMA_NAME).createTable('tutorials', function (table) { + table.string('id').primary(); + table.string('duration'); + table.text('format'); + table.text('title'); + table.text('source'); + table.text('link'); + table.string('locale'); + }); }; const down = function (knex) { From 73f2e2e739a464efd2466565ef043330565309e0 Mon Sep 17 00:00:00 2001 From: Laura Bergoens Date: Wed, 20 Nov 2024 16:58:41 +0100 Subject: [PATCH 10/11] add missions table Co-authored-by: Nicolas Lepage --- ...349_create-learningcontent-schema-and-tables.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js index 235b1a3c292..a5b5bf6ff9b 100644 --- a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js +++ b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js @@ -115,6 +115,20 @@ const up = async function (knex) { table.text('link'); table.string('locale'); }); + await knex.schema.withSchema(SCHEMA_NAME).createTable('missions', function (table) { + table.string('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').references('id').inTable(`${SCHEMA_NAME}.competences`); + }); }; const down = function (knex) { From 76ae0352a97e52098eb087bb901afdcb462696c8 Mon Sep 17 00:00:00 2001 From: Laura Bergoens Date: Thu, 21 Nov 2024 14:13:51 +0100 Subject: [PATCH 11/11] my mistake, string type does not exist, its text --- ...reate-learningcontent-schema-and-tables.js | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js index a5b5bf6ff9b..fab926aba2e 100644 --- a/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js +++ b/api/db/migrations/20241120132349_create-learningcontent-schema-and-tables.js @@ -13,7 +13,7 @@ const up = async function (knex) { table.jsonb('title_i18n'); table.string('color'); table.string('frameworkId').references('id').inTable(`${SCHEMA_NAME}.frameworks`); - table.specificType('competenceIds', 'string[]'); + table.specificType('competenceIds', 'text[]'); }); await knex.schema.withSchema(SCHEMA_NAME).createTable('competences', function (table) { table.string('id').primary(); @@ -22,15 +22,15 @@ const up = async function (knex) { table.string('index'); table.text('origin'); table.string('areaId').references('id').inTable(`${SCHEMA_NAME}.areas`); - table.specificType('skillIds', 'string[]'); - table.specificType('thematicIds', 'string[]'); + table.specificType('skillIds', 'text[]'); + table.specificType('thematicIds', 'text[]'); }); await knex.schema.withSchema(SCHEMA_NAME).createTable('thematics', function (table) { table.string('id').primary(); table.jsonb('name_i18n'); table.integer('index'); table.string('competenceId').references('id').inTable(`${SCHEMA_NAME}.competences`); - table.specificType('tubeIds', 'string[]'); + table.specificType('tubeIds', 'text[]'); }); await knex.schema.withSchema(SCHEMA_NAME).createTable('tubes', function (table) { table.string('id').primary(); @@ -41,7 +41,7 @@ const up = async function (knex) { table.jsonb('practicalDescription_i18n'); table.string('competenceId').references('id').inTable(`${SCHEMA_NAME}.competences`); table.string('thematicId').references('id').inTable(`${SCHEMA_NAME}.thematics`); - table.specificType('skillIds', 'string[]'); + table.specificType('skillIds', 'text[]'); table.boolean('isMobileCompliant'); table.boolean('isTabletCompliant'); }); @@ -56,8 +56,8 @@ const up = async function (knex) { table.jsonb('hint_i18n'); table.string('competenceId').references('id').inTable(`${SCHEMA_NAME}.competences`); table.string('tubeId').references('id').inTable(`${SCHEMA_NAME}.tubes`); - table.specificType('tutorialIds', 'string[]'); - table.specificType('learningMoreTutorialIds', 'string[]'); + table.specificType('tutorialIds', 'text[]'); + table.specificType('learningMoreTutorialIds', 'text[]'); }); await knex.schema.withSchema(SCHEMA_NAME).createTable('challenges', function (table) { table.string('id').primary(); @@ -83,7 +83,7 @@ const up = async function (knex) { table.boolean('shuffled'); table.text('illustrationAlt'); table.text('illustrationUrl'); - table.specificType('attachments', 'string[]'); + table.specificType('attachments', 'text[]'); table.string('responsive'); table.float('alpha'); table.float('delta'); @@ -94,7 +94,7 @@ const up = async function (knex) { table.integer('embedHeight'); table.text('embedUrl'); table.text('embedTitle'); - table.specificType('locales', 'string[]'); + table.specificType('locales', 'text[]'); table.string('competenceId').references('id').inTable(`${SCHEMA_NAME}.competences`); table.string('skillId').references('id').inTable(`${SCHEMA_NAME}.skills`); }); @@ -103,8 +103,8 @@ const up = async function (knex) { table.text('name'); table.text('description'); table.boolean('isActive'); - table.specificType('competences', 'string[]'); - table.specificType('challenges', 'string[]'); + table.specificType('competences', 'text[]'); + table.specificType('challenges', 'text[]'); }); await knex.schema.withSchema(SCHEMA_NAME).createTable('tutorials', function (table) { table.string('id').primary();