Skip to content

Commit

Permalink
feat: add unique constraint on workspace_teams_users and workspace_users
Browse files Browse the repository at this point in the history
  • Loading branch information
jzunigax2 committed Nov 4, 2024
1 parent 39b29bc commit c0b1203
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

const tableName = 'workspace_users';
const constraintName = 'workspace_users_member_id_workspace_id_key';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface) {
await queryInterface.addConstraint(tableName, {
fields: ['member_id', 'workspace_id'],
type: 'unique',
name: constraintName,
});
},

async down(queryInterface) {
await queryInterface.removeConstraint(tableName, constraintName);
},
};
19 changes: 19 additions & 0 deletions migrations/20241104161535-add-unique-constraint-memberid-teamid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

const table_name = 'workspace_teams_users';
const constraintName = 'workspace_teams_users_member_id_team_id_key';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface) {
await queryInterface.addConstraint(table_name, {
fields: ['member_id', 'team_id'],
type: 'unique',
name: constraintName,
});
},

async down(queryInterface) {
await queryInterface.removeConstraint(table_name, constraintName);
},
};

0 comments on commit c0b1203

Please sign in to comment.