1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/src/migrations/20221010114644-pat-auto-increment.js
sjaanus c105ca02f1
Change PAT primary key from string to number (#2163)
* Update primary key

* Fix tests
2022-10-10 13:35:12 +03:00

29 lines
682 B
JavaScript

'use strict';
exports.up = function (db, cb) {
db.runSql(
`
alter table personal_access_tokens
drop constraint personal_access_tokens_pkey;
ALTER TABLE personal_access_tokens
add column id serial primary key;
`,
cb,
);
};
exports.down = function (db, cb) {
db.runSql(
`
alter table personal_access_tokens
drop constraint personal_access_tokens_pkey;
alter table personal_access_tokens
drop column id;
alter table personal_access_tokens
add primary key (secret);
`,
cb,
);
};