Skip to content

Commit

Permalink
fix: roles should have unique name
Browse files Browse the repository at this point in the history
  • Loading branch information
ivarconr committed Jan 11, 2022
1 parent 876abe4 commit 7a71f01
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/migrations/20220111120346-roles-unique-name.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
exports.up = function (db, cb) {
db.runSql(
`
ALTER TABLE roles ADD CONSTRAINT unique_name UNIQUE (name);
`,
cb,
);
};

exports.down = function (db, cb) {
db.runSql(
`
ALTER TABLE roles DROP CONSTRAINT unique_name;
`,
cb,
);
};

0 comments on commit 7a71f01

Please sign in to comment.