Skip to content

Commit 9fbe64a

Browse files
[TECH] Créer une migration pour supprimer la contrainte userId et snappedAt dans la table knowledge-element-snapshots et rendre ces 2 colones nullables (PIX-17211)
#11936
2 parents 98eb733 + 750b33c commit 9fbe64a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const TABLE_NAME = 'knowledge-element-snapshots';
2+
3+
/**
4+
* @param { import("knex").Knex } knex
5+
* @returns { Promise<void> }
6+
*/
7+
const up = async function (knex) {
8+
await knex.schema.alterTable(TABLE_NAME, function (table) {
9+
table.integer('userId').nullable().alter();
10+
table.dateTime('snappedAt').nullable().alter();
11+
table.dropUnique(['userId', 'snappedAt']);
12+
});
13+
};
14+
15+
/**
16+
* @param { import("knex").Knex } knex
17+
* @returns { Promise<void> }
18+
*/
19+
const down = async function (knex) {
20+
await knex.schema.alterTable(TABLE_NAME, function (table) {
21+
table.integer('userId').notNullable().alter();
22+
table.dateTime('snappedAt').notNullable().alter();
23+
table.unique(['userId', 'snappedAt']);
24+
});
25+
};
26+
27+
export { down, up };

0 commit comments

Comments
 (0)