Skip to content

Commit

Permalink
Alter primary column from string to integer
Browse files Browse the repository at this point in the history
Co-authored-by: Nicolas Lepage <[email protected]>
  • Loading branch information
laura-bergoens and nlepage committed Nov 27, 2024
1 parent 04a614e commit 8810a1d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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' },
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const TABLE_NAME = 'missions';
const SCHEMA_NAME = 'learningcontent';
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
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').references('id').inTable(`${SCHEMA_NAME}.competences`);
});
}

/**
* @returns { Promise<void> }
*/
export async function down() {
// non
}

0 comments on commit 8810a1d

Please sign in to comment.