-
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.
[FEATURE] Permettre d'avoir un
campaignParticipationId
NULL
dans …
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...omp-user-recommended-trainings-remove-nullable-constraint-on-campaign-participation-id.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,25 @@ | ||
// Make sure you properly test your migration, especially DDL (Data Definition Language) | ||
// ! If the target table is large, and the migration take more than 20 minutes, the deployment will fail ! | ||
|
||
// You can design and test your migration to avoid this by following this guide | ||
// https://1024pix.atlassian.net/wiki/spaces/EDTDT/pages/3849323922/Cr+er+une+migration | ||
|
||
// If your migrations target `answers` or `knowledge-elements` | ||
// contact @team-captains, because automatic migrations are not active on `pix-datawarehouse-production` | ||
// this may prevent data replication to succeed the day after your migration is deployed on `pix-api-production` | ||
const TABLE_NAME = 'user-recommended-trainings'; | ||
const COLUMN_NAME = 'campaignParticipationId'; | ||
|
||
const up = async (knex) => { | ||
await knex.schema.alterTable(TABLE_NAME, (table) => { | ||
table.integer(COLUMN_NAME).nullable().alter(); | ||
}); | ||
}; | ||
|
||
const down = async (knex) => { | ||
await knex.schema.table(TABLE_NAME, (table) => { | ||
table.integer(COLUMN_NAME).notNullable().alter(); | ||
}); | ||
}; | ||
|
||
export { down, up }; |