ging / fiware-idm

OAuth 2.0-based authentication of users and devices, user profile management, Single Sign-On (SSO) and Identity Federation across multiple administration domains.
https://keyrock-fiware.github.io
MIT License
36 stars 81 forks source link

migrate db fails when using dialect postgres #325

Open MarkusPfundstein opened 1 year ago

MarkusPfundstein commented 1 year ago

Hi, when running npm run-script migrate_db and dialect postgres, the script will fail on 20210603073911-hashed-access-tokens.

I fixed it by applying the following change:

diff --git a/migrations/20210603073911-hashed-access-tokens.js b/migrations/20210603073911-hashed-access-tokens.js
index 33fbbaef..3e862d3b 100644
--- a/migrations/20210603073911-hashed-access-tokens.js
+++ b/migrations/20210603073911-hashed-access-tokens.js
@@ -23,9 +23,7 @@ module.exports = {
       }));
     }).then(() => {
       // Remove access_token as primary key
-      return queryInterface.removeConstraint('oauth_access_token', 'access_token');
-    }).then(() => {
-      return queryInterface.removeConstraint('oauth_access_token', 'PRIMARY');
+      return queryInterface.removeConstraint('oauth_access_token', 'oauth_access_token_pkey')
     }).then(() => {
       // Now that the access_token column is not a primary key
       // use an unlimited text column so JWT can be store without any problem
apozohue10 commented 1 year ago

Hi Markus,

if you want, you can make a PR so we can take a deep look. Just to check if your fix do not generate conflicts with other database deployments.

BR

Alex