Skip to content

Commit

Permalink
[FEATURE] Ajouter une contrainte d'unicite sur la table profile-rewar…
Browse files Browse the repository at this point in the history
  • Loading branch information
pix-service-auto-merge authored Dec 18, 2024
2 parents fdc7cf9 + d809e8f commit 39be451
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const TABLE_NAME = 'profile-rewards';
const UNIQUE_CONSTRAINT_COLUMNS = ['userId', 'rewardId'];

const up = async function (knex) {
return knex.schema.alterTable(TABLE_NAME, (table) => {
table.unique(UNIQUE_CONSTRAINT_COLUMNS);
});
};

const down = async function (knex) {
return knex.schema.alterTable(TABLE_NAME, (table) => {
table.dropUnique(UNIQUE_CONSTRAINT_COLUMNS);
});
};

export { down, up };

0 comments on commit 39be451

Please sign in to comment.