Skip to content

Commit

Permalink
feat: add primary keys to missing tables
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus committed Jan 18, 2024
1 parent 77985ec commit dca27a9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/migrations/20240118093611-missing-primary-keys.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';

exports.up = function (db, callback) {
db.runSql(
`
ALTER TABLE project_stats ADD PRIMARY KEY (project);
ALTER TABLE api_token_project ADD PRIMARY KEY (secret);
ALTER TABLE role_permission ADD COLUMN id SERIAL PRIMARY KEY;
`,
callback,
);
};

exports.down = function (db, callback) {
db.runSql(
`
ALTER TABLE project_stats DROP CONSTRAINT project_stats_pkey;
ALTER TABLE api_token_project DROP CONSTRAINT api_token_project_pkey;
ALTER TABLE role_permission DROP CONSTRAINT role_permission_pkey;
ALTER TABLE role_permission DROP COLUMN id;
`,
callback,
);
};

0 comments on commit dca27a9

Please sign in to comment.