-
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.
Alter primary column from string to integer
Co-authored-by: Nicolas Lepage <[email protected]>
- Loading branch information
1 parent
04a614e
commit 8810a1d
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
api/db/database-builder/factory/learning-content/build-mission.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
30 changes: 30 additions & 0 deletions
30
api/db/migrations/20241127142253_alter-table-column-id-missions-to-integer.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,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 | ||
} |