Skip to content

Commit

Permalink
Merge pull request #123 from synapsestudios/121/password-grant-migration
Browse files Browse the repository at this point in the history
add the password grant to enum
  • Loading branch information
spruce-bruce authored Sep 29, 2017
2 parents 68a826a + 40e1f58 commit f5602c9
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions api/migrations/20170929205124_password-grant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

exports.up = function(knex, Promise) {
if (process.env.OIDC_DB_ADAPTER === 'mysql') {
return knex.raw(`
ALTER TABLE SIP_client_grant
CHANGE grant_type grant_type ENUM('client_credentials', 'refresh_token', 'authorization_code', 'implicit', 'password')
`);
} else {
return knex.raw(`
ALTER TABLE "public"."SIP_client_grant"
DROP CONSTRAINT "SIP_client_grant_grant_type_check",
ADD CONSTRAINT "SIP_client_grant_grant_type_check" CHECK (
grant_type = ANY (ARRAY[
'client_credentials'::text,
'refresh_token'::text,
'authorization_code'::text,
'implicit'::text,
'password'::text
]));
`);
}
};

exports.down = function(knex, Promise) {
if (process.env.OIDC_DB_ADAPTER === 'mysql') {
return knex.raw(`
ALTER TABLE SIP_client_grant
CHANGE grant_type grant_type ENUM('client_credentials', 'refresh_token', 'authorization_code', 'implicit')
`);
} else {
return knex.raw(`
ALTER TABLE "public"."SIP_client_grant"
DROP CONSTRAINT "SIP_client_grant_grant_type_check",
ADD CONSTRAINT "SIP_client_grant_grant_type_check" CHECK (
grant_type = ANY (ARRAY[
'client_credentials'::text,
'refresh_token'::text,
'authorization_code'::text,
'implicit'::text
]));
`);
}
};
Binary file modified oidc-provider.paw
Binary file not shown.

0 comments on commit f5602c9

Please sign in to comment.