language
stringlengths 0
24
| filename
stringlengths 9
214
| code
stringlengths 99
9.93M
|
---|---|---|
SQL | hydra/persistence/sql/migrations/20210928155900000000_support_amr_claim.postgres.up.sql | ALTER TABLE hydra_oauth2_consent_request ADD COLUMN amr TEXT NOT NULL DEFAULT '';
ALTER TABLE hydra_oauth2_authentication_request_handled ADD COLUMN amr TEXT NOT NULL DEFAULT ''; |
SQL | hydra/persistence/sql/migrations/20210928155900000000_support_amr_claim.sqlite.down.sql | ALTER TABLE hydra_oauth2_consent_request DROP COLUMN amr;
ALTER TABLE hydra_oauth2_authentication_request_handled DROP COLUMN amr; |
SQL | hydra/persistence/sql/migrations/20210928155900000000_support_amr_claim.sqlite.up.sql | ALTER TABLE hydra_oauth2_consent_request ADD COLUMN amr TEXT NOT NULL DEFAULT '';
ALTER TABLE hydra_oauth2_authentication_request_handled ADD COLUMN amr TEXT NOT NULL DEFAULT ''; |
SQL | hydra/persistence/sql/migrations/20210928175900000000_client_custom_token_ttl.down.sql | ALTER TABLE hydra_client DROP COLUMN authorization_code_grant_access_token_lifespan;
ALTER TABLE hydra_client DROP COLUMN authorization_code_grant_id_token_lifespan;
ALTER TABLE hydra_client DROP COLUMN authorization_code_grant_refresh_token_lifespan;
ALTER TABLE hydra_client DROP COLUMN client_credentials_grant_access_token_lifespan;
ALTER TABLE hydra_client DROP COLUMN implicit_grant_access_token_lifespan;
ALTER TABLE hydra_client DROP COLUMN implicit_grant_id_token_lifespan;
ALTER TABLE hydra_client DROP COLUMN jwt_bearer_grant_access_token_lifespan;
ALTER TABLE hydra_client DROP COLUMN password_grant_access_token_lifespan;
ALTER TABLE hydra_client DROP COLUMN password_grant_refresh_token_lifespan;
ALTER TABLE hydra_client DROP COLUMN refresh_token_grant_id_token_lifespan;
ALTER TABLE hydra_client DROP COLUMN refresh_token_grant_access_token_lifespan;
ALTER TABLE hydra_client DROP COLUMN refresh_token_grant_refresh_token_lifespan; |
SQL | hydra/persistence/sql/migrations/20210928175900000000_client_custom_token_ttl.up.sql | ALTER TABLE hydra_client ADD COLUMN authorization_code_grant_access_token_lifespan BIGINT NULL DEFAULT NULL;
ALTER TABLE hydra_client ADD COLUMN authorization_code_grant_id_token_lifespan BIGINT NULL DEFAULT NULL;
ALTER TABLE hydra_client ADD COLUMN authorization_code_grant_refresh_token_lifespan BIGINT NULL DEFAULT NULL;
ALTER TABLE hydra_client ADD COLUMN client_credentials_grant_access_token_lifespan BIGINT NULL DEFAULT NULL;
ALTER TABLE hydra_client ADD COLUMN implicit_grant_access_token_lifespan BIGINT NULL DEFAULT NULL;
ALTER TABLE hydra_client ADD COLUMN implicit_grant_id_token_lifespan BIGINT NULL DEFAULT NULL;
ALTER TABLE hydra_client ADD COLUMN jwt_bearer_grant_access_token_lifespan BIGINT NULL DEFAULT NULL;
ALTER TABLE hydra_client ADD COLUMN password_grant_access_token_lifespan BIGINT NULL DEFAULT NULL;
ALTER TABLE hydra_client ADD COLUMN password_grant_refresh_token_lifespan BIGINT NULL DEFAULT NULL;
ALTER TABLE hydra_client ADD COLUMN refresh_token_grant_id_token_lifespan BIGINT NULL DEFAULT NULL;
ALTER TABLE hydra_client ADD COLUMN refresh_token_grant_access_token_lifespan BIGINT NULL DEFAULT NULL;
ALTER TABLE hydra_client ADD COLUMN refresh_token_grant_refresh_token_lifespan BIGINT NULL DEFAULT NULL; |
SQL | hydra/persistence/sql/migrations/20211004110001000000_change_client_primary_key.cockroach.down.sql | ALTER TABLE hydra_client DROP CONSTRAINT "hydra_client_pkey", ADD CONSTRAINT "primary" PRIMARY KEY (pk_deprecated); |
SQL | hydra/persistence/sql/migrations/20211004110001000000_change_client_primary_key.cockroach.up.sql | ALTER TABLE hydra_client RENAME pk TO pk_deprecated;
ALTER TABLE hydra_client ADD pk UUID NOT NULL DEFAULT gen_random_uuid(); |
SQL | hydra/persistence/sql/migrations/20211004110001000000_change_client_primary_key.mysql.down.sql | ALTER TABLE hydra_client DROP PRIMARY KEY, ADD PRIMARY KEY (pk_deprecated);
ALTER TABLE hydra_client DROP KEY pk_deprecated;
ALTER TABLE hydra_client DROP pk;
ALTER TABLE hydra_client CHANGE COLUMN pk_deprecated pk INT UNSIGNED AUTO_INCREMENT; |
SQL | hydra/persistence/sql/migrations/20211004110001000000_change_client_primary_key.mysql.up.sql | ALTER TABLE hydra_client CHANGE COLUMN pk pk_deprecated INT UNSIGNED;
ALTER TABLE hydra_client ADD COLUMN pk CHAR(36);
-- UUIDv4 generation based on https://stackoverflow.com/a/66868340/12723442
UPDATE hydra_client SET pk = (SELECT LOWER(CONCAT(
HEX(RANDOM_BYTES(4)),
'-', HEX(RANDOM_BYTES(2)),
'-4', SUBSTR(HEX(RANDOM_BYTES(2)), 2, 3),
'-', CONCAT(HEX(FLOOR(ASCII(RANDOM_BYTES(1)) / 64)+8),SUBSTR(HEX(RANDOM_BYTES(2)), 2, 3)),
'-', HEX(RANDOM_BYTES(6))
)));
ALTER TABLE hydra_client DROP PRIMARY KEY, ADD PRIMARY KEY (pk);
ALTER TABLE hydra_client ADD KEY (pk_deprecated);
ALTER TABLE hydra_client CHANGE COLUMN pk_deprecated pk_deprecated INT UNSIGNED; |
SQL | hydra/persistence/sql/migrations/20211004110001000000_change_client_primary_key.postgres.down.sql | ALTER TABLE hydra_client RENAME pk TO pk_tmp;
ALTER TABLE hydra_client RENAME pk_deprecated TO pk;
ALTER TABLE hydra_client DROP CONSTRAINT hydra_client_pkey;
ALTER TABLE hydra_client ADD PRIMARY KEY (pk);
ALTER TABLE hydra_client DROP pk_tmp; |
SQL | hydra/persistence/sql/migrations/20211004110001000000_change_client_primary_key.postgres.up.sql | ALTER TABLE hydra_client RENAME pk TO pk_deprecated;
-- UUID generation based on https://stackoverflow.com/a/21327318/12723442
ALTER TABLE hydra_client ADD COLUMN pk UUID DEFAULT uuid_in(
overlay(
overlay(
md5(random()::text || ':' || clock_timestamp()::text)
placing '4'
from 13
)
placing to_hex(floor(random()*(11-8+1) + 8)::int)::text
from 17
)::cstring
);
ALTER TABLE hydra_client ALTER pk DROP DEFAULT;
ALTER TABLE hydra_client DROP CONSTRAINT hydra_client_pkey;
ALTER TABLE hydra_client ADD PRIMARY KEY (pk); |
SQL | hydra/persistence/sql/migrations/20211004110001000000_change_client_primary_key.sqlite.down.sql | CREATE TABLE "_hydra_client_tmp"
(
id VARCHAR(255) NOT NULL,
client_name TEXT NOT NULL,
client_secret TEXT NOT NULL,
redirect_uris TEXT NOT NULL,
grant_types TEXT NOT NULL,
response_types TEXT NOT NULL,
scope TEXT NOT NULL,
owner TEXT NOT NULL,
policy_uri TEXT NOT NULL,
tos_uri TEXT NOT NULL,
client_uri TEXT NOT NULL,
logo_uri TEXT NOT NULL,
contacts TEXT NOT NULL,
client_secret_expires_at INTEGER NOT NULL DEFAULT 0,
sector_identifier_uri TEXT NOT NULL,
jwks TEXT NOT NULL,
jwks_uri TEXT NOT NULL,
request_uris TEXT NOT NULL,
token_endpoint_auth_method VARCHAR(25) NOT NULL DEFAULT '',
request_object_signing_alg VARCHAR(10) NOT NULL DEFAULT '',
userinfo_signed_response_alg VARCHAR(10) NOT NULL DEFAULT '',
subject_type VARCHAR(15) NOT NULL DEFAULT '',
allowed_cors_origins TEXT NOT NULL,
pk INTEGER PRIMARY KEY,
audience TEXT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
frontchannel_logout_uri TEXT NOT NULL DEFAULT '',
frontchannel_logout_session_required INTEGER NOT NULL DEFAULT false,
post_logout_redirect_uris TEXT NOT NULL DEFAULT '',
backchannel_logout_uri TEXT NOT NULL DEFAULT '',
backchannel_logout_session_required INTEGER NOT NULL DEFAULT false,
metadata TEXT NOT NULL DEFAULT '{}',
token_endpoint_auth_signing_alg VARCHAR(10) NOT NULL DEFAULT '',
authorization_code_grant_access_token_lifespan BIGINT NULL DEFAULT NULL,
authorization_code_grant_id_token_lifespan BIGINT NULL DEFAULT NULL,
authorization_code_grant_refresh_token_lifespan BIGINT NULL DEFAULT NULL,
client_credentials_grant_access_token_lifespan BIGINT NULL DEFAULT NULL,
implicit_grant_access_token_lifespan BIGINT NULL DEFAULT NULL,
implicit_grant_id_token_lifespan BIGINT NULL DEFAULT NULL,
jwt_bearer_grant_access_token_lifespan BIGINT NULL DEFAULT NULL,
password_grant_access_token_lifespan BIGINT NULL DEFAULT NULL,
password_grant_refresh_token_lifespan BIGINT NULL DEFAULT NULL,
refresh_token_grant_id_token_lifespan BIGINT NULL DEFAULT NULL,
refresh_token_grant_access_token_lifespan BIGINT NULL DEFAULT NULL,
refresh_token_grant_refresh_token_lifespan BIGINT NULL DEFAULT NULL
);
INSERT INTO "_hydra_client_tmp" (
id,
client_name,
client_secret,
redirect_uris,
grant_types,
response_types,
scope,
owner,
policy_uri,
tos_uri,
client_uri,
logo_uri,
contacts,
client_secret_expires_at,
sector_identifier_uri,
jwks,
jwks_uri,
request_uris,
token_endpoint_auth_method,
request_object_signing_alg,
userinfo_signed_response_alg,
subject_type,
allowed_cors_origins,
pk,
audience,
created_at,
updated_at,
frontchannel_logout_uri,
frontchannel_logout_session_required,
post_logout_redirect_uris,
backchannel_logout_uri,
backchannel_logout_session_required,
metadata,
token_endpoint_auth_signing_alg,
authorization_code_grant_access_token_lifespan,
authorization_code_grant_id_token_lifespan,
authorization_code_grant_refresh_token_lifespan,
client_credentials_grant_access_token_lifespan,
implicit_grant_access_token_lifespan,
implicit_grant_id_token_lifespan,
jwt_bearer_grant_access_token_lifespan,
password_grant_access_token_lifespan,
password_grant_refresh_token_lifespan,
refresh_token_grant_id_token_lifespan,
refresh_token_grant_access_token_lifespan,
refresh_token_grant_refresh_token_lifespan
) SELECT
id,
client_name,
client_secret,
redirect_uris,
grant_types,
response_types,
scope,
owner,
policy_uri,
tos_uri,
client_uri,
logo_uri,
contacts,
client_secret_expires_at,
sector_identifier_uri,
jwks,
jwks_uri,
request_uris,
token_endpoint_auth_method,
request_object_signing_alg,
userinfo_signed_response_alg,
subject_type,
allowed_cors_origins,
pk_deprecated,
audience,
created_at,
updated_at,
frontchannel_logout_uri,
frontchannel_logout_session_required,
post_logout_redirect_uris,
backchannel_logout_uri,
backchannel_logout_session_required,
metadata,
token_endpoint_auth_signing_alg,
authorization_code_grant_access_token_lifespan,
authorization_code_grant_id_token_lifespan,
authorization_code_grant_refresh_token_lifespan,
client_credentials_grant_access_token_lifespan,
implicit_grant_access_token_lifespan,
implicit_grant_id_token_lifespan,
jwt_bearer_grant_access_token_lifespan,
password_grant_access_token_lifespan,
password_grant_refresh_token_lifespan,
refresh_token_grant_id_token_lifespan,
refresh_token_grant_access_token_lifespan,
refresh_token_grant_refresh_token_lifespan
FROM "hydra_client";
DROP INDEX hydra_client_id_idx;
DROP TABLE "hydra_client";
ALTER TABLE "_hydra_client_tmp" RENAME TO "hydra_client";
CREATE UNIQUE INDEX hydra_client_id_idx ON hydra_client (id); |
SQL | hydra/persistence/sql/migrations/20211004110001000000_change_client_primary_key.sqlite.up.sql | CREATE TABLE "_hydra_client_tmp"
(
id VARCHAR(255) NOT NULL,
client_name TEXT NOT NULL,
client_secret TEXT NOT NULL,
redirect_uris TEXT NOT NULL,
grant_types TEXT NOT NULL,
response_types TEXT NOT NULL,
scope TEXT NOT NULL,
owner TEXT NOT NULL,
policy_uri TEXT NOT NULL,
tos_uri TEXT NOT NULL,
client_uri TEXT NOT NULL,
logo_uri TEXT NOT NULL,
contacts TEXT NOT NULL,
client_secret_expires_at INTEGER NOT NULL DEFAULT 0,
sector_identifier_uri TEXT NOT NULL,
jwks TEXT NOT NULL,
jwks_uri TEXT NOT NULL,
request_uris TEXT NOT NULL,
token_endpoint_auth_method VARCHAR(25) NOT NULL DEFAULT '',
request_object_signing_alg VARCHAR(10) NOT NULL DEFAULT '',
userinfo_signed_response_alg VARCHAR(10) NOT NULL DEFAULT '',
subject_type VARCHAR(15) NOT NULL DEFAULT '',
allowed_cors_origins TEXT NOT NULL,
pk_deprecated INTEGER NULL DEFAULT NULL,
pk TEXT PRIMARY KEY,
audience TEXT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
frontchannel_logout_uri TEXT NOT NULL DEFAULT '',
frontchannel_logout_session_required INTEGER NOT NULL DEFAULT false,
post_logout_redirect_uris TEXT NOT NULL DEFAULT '',
backchannel_logout_uri TEXT NOT NULL DEFAULT '',
backchannel_logout_session_required INTEGER NOT NULL DEFAULT false,
metadata TEXT NOT NULL DEFAULT '{}',
token_endpoint_auth_signing_alg VARCHAR(10) NOT NULL DEFAULT '',
authorization_code_grant_access_token_lifespan BIGINT NULL DEFAULT NULL,
authorization_code_grant_id_token_lifespan BIGINT NULL DEFAULT NULL,
authorization_code_grant_refresh_token_lifespan BIGINT NULL DEFAULT NULL,
client_credentials_grant_access_token_lifespan BIGINT NULL DEFAULT NULL,
implicit_grant_access_token_lifespan BIGINT NULL DEFAULT NULL,
implicit_grant_id_token_lifespan BIGINT NULL DEFAULT NULL,
jwt_bearer_grant_access_token_lifespan BIGINT NULL DEFAULT NULL,
password_grant_access_token_lifespan BIGINT NULL DEFAULT NULL,
password_grant_refresh_token_lifespan BIGINT NULL DEFAULT NULL,
refresh_token_grant_id_token_lifespan BIGINT NULL DEFAULT NULL,
refresh_token_grant_access_token_lifespan BIGINT NULL DEFAULT NULL,
refresh_token_grant_refresh_token_lifespan BIGINT NULL DEFAULT NULL
);
-- UUID generation based on https://stackoverflow.com/a/61000724/12723442
INSERT INTO "_hydra_client_tmp" (
id,
client_name,
client_secret,
redirect_uris,
grant_types,
response_types,
scope,
owner,
policy_uri,
tos_uri,
client_uri,
logo_uri,
contacts,
client_secret_expires_at,
sector_identifier_uri,
jwks,
jwks_uri,
request_uris,
token_endpoint_auth_method,
request_object_signing_alg,
userinfo_signed_response_alg,
subject_type,
allowed_cors_origins,
pk_deprecated,
pk,
audience,
created_at,
updated_at,
frontchannel_logout_uri,
frontchannel_logout_session_required,
post_logout_redirect_uris,
backchannel_logout_uri,
backchannel_logout_session_required,
metadata,
token_endpoint_auth_signing_alg,
authorization_code_grant_access_token_lifespan,
authorization_code_grant_id_token_lifespan,
authorization_code_grant_refresh_token_lifespan,
client_credentials_grant_access_token_lifespan,
implicit_grant_access_token_lifespan,
implicit_grant_id_token_lifespan,
jwt_bearer_grant_access_token_lifespan,
password_grant_access_token_lifespan,
password_grant_refresh_token_lifespan,
refresh_token_grant_id_token_lifespan,
refresh_token_grant_access_token_lifespan,
refresh_token_grant_refresh_token_lifespan
) SELECT
id,
client_name,
client_secret,
redirect_uris,
grant_types,
response_types,
scope,
owner,
policy_uri,
tos_uri,
client_uri,
logo_uri,
contacts,
client_secret_expires_at,
sector_identifier_uri,
jwks,
jwks_uri,
request_uris,
token_endpoint_auth_method,
request_object_signing_alg,
userinfo_signed_response_alg,
subject_type,
allowed_cors_origins,
pk,
lower(
hex(randomblob(4)) ||
'-' || hex(randomblob(2)) ||
'-' || '4' || substr(hex(randomblob(2)), 2) ||
'-' || substr('AB89', 1 + (abs(random()) % 4) , 1) || substr(hex(randomblob(2)), 2) ||
'-' || hex(randomblob(6))
),
audience,
created_at,
updated_at,
frontchannel_logout_uri,
frontchannel_logout_session_required,
post_logout_redirect_uris,
backchannel_logout_uri,
backchannel_logout_session_required,
metadata,
token_endpoint_auth_signing_alg,
authorization_code_grant_access_token_lifespan,
authorization_code_grant_id_token_lifespan,
authorization_code_grant_refresh_token_lifespan,
client_credentials_grant_access_token_lifespan,
implicit_grant_access_token_lifespan,
implicit_grant_id_token_lifespan,
jwt_bearer_grant_access_token_lifespan,
password_grant_access_token_lifespan,
password_grant_refresh_token_lifespan,
refresh_token_grant_id_token_lifespan,
refresh_token_grant_access_token_lifespan,
refresh_token_grant_refresh_token_lifespan
FROM "hydra_client";
DROP INDEX hydra_client_id_idx;
DROP TABLE "hydra_client";
ALTER TABLE "_hydra_client_tmp" RENAME TO "hydra_client";
CREATE UNIQUE INDEX hydra_client_id_idx ON hydra_client (id); |
SQL | hydra/persistence/sql/migrations/20211004110003000000_change_client_primary_key.cockroach.up.sql | ALTER TABLE hydra_client DROP CONSTRAINT "primary";
ALTER TABLE hydra_client ADD CONSTRAINT "hydra_client_pkey" PRIMARY KEY (pk); |
SQL | hydra/persistence/sql/migrations/20211011000001000000_change_jwk_primary_key.cockroach.down.sql | ALTER TABLE hydra_jwk DROP CONSTRAINT "hydra_jwk", ADD CONSTRAINT "primary" PRIMARY KEY (pk_deprecated); |
SQL | hydra/persistence/sql/migrations/20211011000001000000_change_jwk_primary_key.cockroach.up.sql | ALTER TABLE hydra_jwk RENAME pk TO pk_deprecated;
ALTER TABLE hydra_jwk ADD pk UUID NOT NULL DEFAULT gen_random_uuid(); |
SQL | hydra/persistence/sql/migrations/20211011000001000000_change_jwk_primary_key.mysql.down.sql | ALTER TABLE hydra_jwk DROP PRIMARY KEY, ADD PRIMARY KEY (pk_deprecated);
ALTER TABLE hydra_jwk DROP pk;
ALTER TABLE hydra_jwk CHANGE COLUMN pk_deprecated pk INT UNSIGNED AUTO_INCREMENT; |
SQL | hydra/persistence/sql/migrations/20211011000001000000_change_jwk_primary_key.mysql.up.sql | ALTER TABLE hydra_jwk CHANGE COLUMN pk pk_deprecated INT UNSIGNED;
ALTER TABLE hydra_jwk ADD COLUMN pk CHAR(36);
-- UUIDv4 generation based on https://stackoverflow.com/a/66868340/12723442
UPDATE hydra_jwk SET pk = (SELECT LOWER(CONCAT(
HEX(RANDOM_BYTES(4)),
'-', HEX(RANDOM_BYTES(2)),
'-4', SUBSTR(HEX(RANDOM_BYTES(2)), 2, 3),
'-', CONCAT(HEX(FLOOR(ASCII(RANDOM_BYTES(1)) / 64)+8),SUBSTR(HEX(RANDOM_BYTES(2)), 2, 3)),
'-', HEX(RANDOM_BYTES(6))
)));
ALTER TABLE hydra_jwk ALTER pk DROP DEFAULT;
ALTER TABLE hydra_jwk DROP PRIMARY KEY, ADD PRIMARY KEY (pk);
ALTER TABLE hydra_jwk ADD KEY (pk_deprecated);
ALTER TABLE hydra_jwk CHANGE COLUMN pk_deprecated pk_deprecated INT UNSIGNED AUTO_INCREMENT; |
SQL | hydra/persistence/sql/migrations/20211011000001000000_change_jwk_primary_key.postgres.down.sql | ALTER TABLE hydra_jwk RENAME pk TO pk_tmp;
ALTER TABLE hydra_jwk RENAME pk_deprecated TO pk;
ALTER TABLE hydra_jwk DROP CONSTRAINT hydra_jwk_pkey;
ALTER TABLE hydra_jwk ADD PRIMARY KEY (pk);
ALTER TABLE hydra_jwk DROP pk_tmp; |
SQL | hydra/persistence/sql/migrations/20211011000001000000_change_jwk_primary_key.postgres.up.sql | ALTER TABLE hydra_jwk RENAME pk TO pk_deprecated;
-- UUID generation based on https://stackoverflow.com/a/21327318/12723442
ALTER TABLE hydra_jwk ADD COLUMN pk UUID DEFAULT uuid_in(
overlay(
overlay(
md5(random()::text || ':' || clock_timestamp()::text)
placing '4'
from 13
)
placing to_hex(floor(random()*(11-8+1) + 8)::int)::text
from 17
)::cstring
);
ALTER TABLE hydra_jwk ALTER pk DROP DEFAULT;
ALTER TABLE hydra_jwk DROP CONSTRAINT hydra_jwk_pkey;
ALTER TABLE hydra_jwk ADD PRIMARY KEY (pk); |
SQL | hydra/persistence/sql/migrations/20211011000001000000_change_jwk_primary_key.sqlite.down.sql | CREATE TABLE "_hydra_jwk_tmp"
(
sid VARCHAR(255) NOT NULL,
kid VARCHAR(255) NOT NULL,
version INTEGER DEFAULT 0 NOT NULL,
keydata TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
pk INTEGER PRIMARY KEY
);
INSERT INTO "_hydra_jwk_tmp" (
sid,
kid,
version,
keydata,
created_at,
pk
) SELECT
sid,
kid,
version,
keydata,
created_at,
pk_deprecated
FROM "hydra_jwk";
DROP INDEX hydra_jwk_sid_kid_key;
DROP TABLE "hydra_jwk";
ALTER TABLE "_hydra_jwk_tmp" RENAME TO "hydra_jwk";
CREATE UNIQUE INDEX hydra_jwk_sid_kid_key ON hydra_jwk (sid, kid); |
SQL | hydra/persistence/sql/migrations/20211011000001000000_change_jwk_primary_key.sqlite.up.sql | CREATE TABLE "_hydra_jwk_tmp"
(
sid VARCHAR(255) NOT NULL,
kid VARCHAR(255) NOT NULL,
version INTEGER DEFAULT 0 NOT NULL,
keydata TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
pk TEXT PRIMARY KEY,
pk_deprecated INTEGER NULL DEFAULT NULL
);
-- UUID generation based on https://stackoverflow.com/a/61000724/12723442
INSERT INTO "_hydra_jwk_tmp" (
sid,
kid,
version,
keydata,
created_at,
pk,
pk_deprecated
) SELECT
sid,
kid,
version,
keydata,
created_at,
lower(
hex(randomblob(4)) ||
'-' || hex(randomblob(2)) ||
'-' || '4' || substr(hex(randomblob(2)), 2) ||
'-' || substr('AB89', 1 + (abs(random()) % 4) , 1) || substr(hex(randomblob(2)), 2) ||
'-' || hex(randomblob(6))
),
pk
FROM "hydra_jwk";
DROP INDEX hydra_jwk_sid_kid_key;
DROP TABLE "hydra_jwk";
ALTER TABLE "_hydra_jwk_tmp" RENAME TO "hydra_jwk";
CREATE UNIQUE INDEX hydra_jwk_sid_kid_key ON hydra_jwk (sid, kid); |
SQL | hydra/persistence/sql/migrations/20211011000003000000_change_jwk_primary_key.cockroach.up.sql | ALTER TABLE hydra_jwk DROP CONSTRAINT "primary";
ALTER TABLE hydra_jwk ADD CONSTRAINT "hydra_jwk_pkey" PRIMARY KEY (pk); |
SQL | hydra/persistence/sql/migrations/20211019000001000000_merge_authentication_request_tables.cockroach.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
CREATE TABLE hydra_oauth2_flow
(
login_challenge character varying(40) NOT NULL,
requested_scope text NOT NULL DEFAULT '[]',
login_verifier character varying(40) NOT NULL,
login_csrf character varying(40) NOT NULL,
subject character varying(255) NOT NULL,
request_url text NOT NULL,
login_skip boolean NOT NULL,
client_id character varying(255) NOT NULL,
requested_at timestamp without time zone DEFAULT now() NOT NULL,
login_initialized_at timestamp without time zone NULL DEFAULT NULL,
oidc_context jsonb NOT NULL DEFAULT '{}',
login_session_id character varying(40) NULL,
requested_at_audience text NULL DEFAULT '[]',
state INTEGER NOT NULL,
login_remember boolean NOT NULL DEFAULT false,
login_remember_for integer NOT NULL,
login_error text NULL,
acr text NOT NULL DEFAULT '',
login_authenticated_at timestamp without time zone NULL DEFAULT NULL,
login_was_used boolean NOT NULL DEFAULT false,
forced_subject_identifier character varying(255) NOT NULL DEFAULT ''::character varying,
context jsonb DEFAULT '{}',
amr text DEFAULT '[]',
consent_challenge_id character varying(40) NULL,
consent_skip boolean DEFAULT false NOT NULL,
consent_verifier character varying(40) NULL,
consent_csrf character varying(40) NULL,
granted_scope text NOT NULL DEFAULT '[]',
granted_at_audience text NOT NULL DEFAULT '[]',
consent_remember boolean DEFAULT false NOT NULL,
consent_remember_for integer NULL,
consent_handled_at TIMESTAMP WITHOUT TIME ZONE NULL,
consent_error TEXT NULL,
session_access_token jsonb DEFAULT '{}' NOT NULL,
session_id_token jsonb DEFAULT '{}' NOT NULL,
consent_was_used boolean DEFAULT false NOT NULL,
CHECK (
state = 128 OR
state = 129 OR
state = 1 OR
(state = 2 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL
)) OR
(state = 3 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL
)) OR
(state = 4 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL AND
consent_challenge_id IS NOT NULL AND
consent_verifier IS NOT NULL AND
consent_skip IS NOT NULL AND
consent_csrf IS NOT NULL
)) OR
(state = 5 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL AND
consent_challenge_id IS NOT NULL AND
consent_verifier IS NOT NULL AND
consent_skip IS NOT NULL AND
consent_csrf IS NOT NULL
)) OR
(state = 6 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL AND
consent_challenge_id IS NOT NULL AND
consent_verifier IS NOT NULL AND
consent_skip IS NOT NULL AND
consent_csrf IS NOT NULL AND
granted_scope IS NOT NULL AND
consent_remember IS NOT NULL AND
consent_remember_for IS NOT NULL AND
consent_error IS NOT NULL AND
session_access_token IS NOT NULL AND
session_id_token IS NOT NULL AND
consent_was_used IS NOT NULL
))
)
); |
SQL | hydra/persistence/sql/migrations/20211019000001000000_merge_authentication_request_tables.down.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
-- Down migrations from Hydra 2.x to 1.x are not available. |
SQL | hydra/persistence/sql/migrations/20211019000001000000_merge_authentication_request_tables.mysql.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
CREATE TABLE hydra_oauth2_flow
(
`login_challenge` varchar(40) NOT NULL,
`requested_scope` text NOT NULL DEFAULT ('[]'),
`login_verifier` varchar(40) NOT NULL,
`login_csrf` varchar(40) NOT NULL,
`subject` varchar(255) NOT NULL,
`request_url` text NOT NULL,
`login_skip` tinyint(1) NOT NULL,
`client_id` varchar(255) NOT NULL,
`requested_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`login_initialized_at` timestamp NULL DEFAULT NULL,
`oidc_context` json NOT NULL DEFAULT (('{}')),
`login_session_id` varchar(40) NULL,
`requested_at_audience` text NULL DEFAULT ('[]'),
`state` smallint NOT NULL,
`login_remember` tinyint(1) NOT NULL DEFAULT false,
`login_remember_for` int(11) NOT NULL,
`login_error` text NULL,
`acr` text NOT NULL DEFAULT (''),
`login_authenticated_at` timestamp NULL DEFAULT NULL,
`login_was_used` tinyint(1) NOT NULL DEFAULT false,
`forced_subject_identifier` varchar(255) NOT NULL DEFAULT '',
`context` json NOT NULL DEFAULT ('{}'),
`amr` text NOT NULL DEFAULT ('[]'),
`consent_challenge_id` varchar(40) NULL,
`consent_skip` tinyint(1) NOT NULL DEFAULT 0,
`consent_verifier` varchar(40) NULL,
`consent_csrf` varchar(40) NULL,
`granted_scope` text NOT NULL DEFAULT ('[]'),
`granted_at_audience` text NOT NULL DEFAULT ('[]'),
`consent_remember` tinyint(1) NOT NULL DEFAULT false,
`consent_remember_for` int(11) NULL,
`consent_handled_at` timestamp NULL DEFAULT NULL,
`consent_error` TEXT NULL,
`session_access_token` json DEFAULT ('{}') NOT NULL,
`session_id_token` json DEFAULT ('{}') NOT NULL,
`consent_was_used` tinyint(1),
PRIMARY KEY (`login_challenge`),
UNIQUE KEY `hydra_oauth2_flow_login_verifier_idx` (`login_verifier`),
KEY `hydra_oauth2_flow_cid_idx` (`client_id`),
KEY `hydra_oauth2_flow_sub_idx` (`subject`),
KEY `hydra_oauth2_flow_login_session_id_idx` (`login_session_id`),
CONSTRAINT `hydra_oauth2_flow_client_id_fk` FOREIGN KEY (`client_id`) REFERENCES `hydra_client` (`id`) ON DELETE CASCADE,
CONSTRAINT `hydra_oauth2_flow_login_session_id_fk` FOREIGN KEY (`login_session_id`) REFERENCES `hydra_oauth2_authentication_session` (`id`) ON DELETE CASCADE,
UNIQUE KEY `hydra_oauth2_flow_consent_challenge_idx` (`consent_challenge_id`),
KEY `hydra_oauth2_flow_consent_verifier_idx` (`consent_verifier`),
KEY `hydra_oauth2_flow_client_id_subject_idx` (`client_id`,`subject`)
);
ALTER TABLE hydra_oauth2_flow ADD CONSTRAINT hydra_oauth2_flow_chk CHECK (
state = 128 OR
state = 129 OR
state = 1 OR
(state = 2 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL
)) OR
(state = 3 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL
)) OR
(state = 4 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL AND
consent_challenge_id IS NOT NULL AND
consent_verifier IS NOT NULL AND
consent_skip IS NOT NULL AND
consent_csrf IS NOT NULL
)) OR
(state = 5 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL AND
consent_challenge_id IS NOT NULL AND
consent_verifier IS NOT NULL AND
consent_skip IS NOT NULL AND
consent_csrf IS NOT NULL
)) OR
(state = 6 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL AND
consent_challenge_id IS NOT NULL AND
consent_verifier IS NOT NULL AND
consent_skip IS NOT NULL AND
consent_csrf IS NOT NULL AND
granted_scope IS NOT NULL AND
consent_remember IS NOT NULL AND
consent_remember_for IS NOT NULL AND
consent_error IS NOT NULL AND
session_access_token IS NOT NULL AND
session_id_token IS NOT NULL AND
consent_was_used IS NOT NULL
))
); |
SQL | hydra/persistence/sql/migrations/20211019000001000000_merge_authentication_request_tables.postgres.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
CREATE TABLE hydra_oauth2_flow
(
login_challenge character varying(40) NOT NULL,
requested_scope text NOT NULL DEFAULT '[]',
login_verifier character varying(40) NOT NULL,
login_csrf character varying(40) NOT NULL,
subject character varying(255) NOT NULL,
request_url text NOT NULL,
login_skip boolean NOT NULL,
client_id character varying(255) NOT NULL,
requested_at timestamp without time zone DEFAULT now() NOT NULL,
login_initialized_at timestamp without time zone NULL DEFAULT NULL,
oidc_context jsonb NOT NULL DEFAULT '{}',
login_session_id character varying(40) NULL,
requested_at_audience text DEFAULT '[]'::text,
state INTEGER NOT NULL,
login_remember boolean NOT NULL DEFAULT false,
login_remember_for integer NOT NULL,
login_error text NULL,
acr text NOT NULL DEFAULT '',
login_authenticated_at timestamp without time zone NULL DEFAULT NULL,
login_was_used boolean NOT NULL DEFAULT false,
forced_subject_identifier character varying(255) NOT NULL DEFAULT ''::character varying,
context jsonb NOT NULL DEFAULT '{}',
amr text NOT NULL DEFAULT '[]',
consent_challenge_id character varying(40),
consent_skip boolean DEFAULT false NOT NULL,
consent_verifier character varying(40) NULL,
consent_csrf character varying(40) NULL,
granted_scope text NOT NULL DEFAULT '[]',
granted_at_audience text NOT NULL DEFAULT '[]',
consent_remember boolean DEFAULT false NOT NULL,
consent_remember_for INTEGER NULL,
consent_handled_at TIMESTAMP WITHOUT TIME ZONE NULL,
consent_error TEXT NULL,
session_access_token jsonb DEFAULT '{}' NOT NULL,
session_id_token jsonb DEFAULT '{}' NOT NULL,
consent_was_used boolean DEFAULT false NOT NULL,
CHECK (
state = 128 OR
state = 129 OR
state = 1 OR
(state = 2 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL
)) OR
(state = 3 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL
)) OR
(state = 4 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL AND
consent_challenge_id IS NOT NULL AND
consent_verifier IS NOT NULL AND
consent_skip IS NOT NULL AND
consent_csrf IS NOT NULL
)) OR
(state = 5 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL AND
consent_challenge_id IS NOT NULL AND
consent_verifier IS NOT NULL AND
consent_skip IS NOT NULL AND
consent_csrf IS NOT NULL
)) OR
(state = 6 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL AND
consent_challenge_id IS NOT NULL AND
consent_verifier IS NOT NULL AND
consent_skip IS NOT NULL AND
consent_csrf IS NOT NULL AND
granted_scope IS NOT NULL AND
consent_remember IS NOT NULL AND
consent_remember_for IS NOT NULL AND
consent_error IS NOT NULL AND
session_access_token IS NOT NULL AND
session_id_token IS NOT NULL AND
consent_was_used IS NOT NULL
))
)
); |
SQL | hydra/persistence/sql/migrations/20211019000001000000_merge_authentication_request_tables.sqlite.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
CREATE TABLE hydra_oauth2_flow
(
login_challenge VARCHAR(40) NOT NULL PRIMARY KEY,
requested_scope TEXT NOT NULL DEFAULT '[]',
login_verifier VARCHAR(40) NOT NULL,
login_csrf VARCHAR(40) NOT NULL,
subject VARCHAR(255) NOT NULL,
request_url TEXT NOT NULL,
login_skip INTEGER NOT NULL,
client_id VARCHAR(255) NOT NULL REFERENCES hydra_client (id) ON DELETE CASCADE,
requested_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
login_initialized_at TIMESTAMP NULL DEFAULT NULL,
oidc_context jsonb NOT NULL DEFAULT '{}',
login_session_id VARCHAR(40) NULL REFERENCES hydra_oauth2_authentication_session (id) ON DELETE CASCADE DEFAULT '',
requested_at_audience text NULL DEFAULT '[]',
state INTEGER NOT NULL,
login_remember INTEGER NOT NULL DEFAULT false,
login_remember_for INTEGER NOT NULL,
login_error TEXT NULL,
acr TEXT NOT NULL DEFAULT '',
login_authenticated_at TIMESTAMP NULL DEFAULT NULL,
login_was_used INTEGER NOT NULL DEFAULT false,
forced_subject_identifier VARCHAR(255) NOT NULL DEFAULT '',
context jsonb NOT NULL DEFAULT '{}',
amr text NOT NULL DEFAULT '[]',
consent_challenge_id VARCHAR(40) NULL,
consent_skip INTEGER NOT NULL DEFAULT false,
consent_verifier VARCHAR(40) NULL,
consent_csrf VARCHAR(40) NULL,
granted_scope text NOT NULL DEFAULT '[]',
granted_at_audience text NOT NULL DEFAULT '[]',
consent_remember INTEGER NOT NULL DEFAULT 0,
consent_remember_for INTEGER NULL,
consent_handled_at TIMESTAMP NULL,
consent_was_used INTEGER NOT NULL DEFAULT false,
consent_error TEXT NULL,
session_id_token jsonb NULL DEFAULT '{}',
session_access_token jsonb NULL DEFAULT '{}'
CHECK (
state = 128 OR
state = 129 OR
state = 1 OR
(state = 2 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL
)) OR
(state = 3 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL
)) OR
(state = 4 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL AND
consent_challenge_id IS NOT NULL AND
consent_verifier IS NOT NULL AND
consent_skip IS NOT NULL AND
consent_csrf IS NOT NULL
)) OR
(state = 5 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL AND
consent_challenge_id IS NOT NULL AND
consent_verifier IS NOT NULL AND
consent_skip IS NOT NULL AND
consent_csrf IS NOT NULL
)) OR
(state = 6 AND (
login_remember IS NOT NULL AND
login_remember_for IS NOT NULL AND
login_error IS NOT NULL AND
acr IS NOT NULL AND
login_was_used IS NOT NULL AND
context IS NOT NULL AND
amr IS NOT NULL AND
consent_challenge_id IS NOT NULL AND
consent_verifier IS NOT NULL AND
consent_skip IS NOT NULL AND
consent_csrf IS NOT NULL AND
granted_scope IS NOT NULL AND
consent_remember IS NOT NULL AND
consent_remember_for IS NOT NULL AND
consent_error IS NOT NULL AND
session_access_token IS NOT NULL AND
session_id_token IS NOT NULL AND
consent_was_used IS NOT NULL
))
)
); |
SQL | hydra/persistence/sql/migrations/20211019000001000001_merge_authentication_request_tables.cockroach.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
INSERT INTO hydra_oauth2_flow (
state,
login_challenge,
requested_scope,
login_verifier,
login_csrf,
subject,
request_url,
login_skip,
client_id,
requested_at,
login_initialized_at,
oidc_context,
login_session_id,
requested_at_audience,
login_remember,
login_remember_for,
login_error,
acr,
login_authenticated_at,
login_was_used,
forced_subject_identifier,
context,
amr,
consent_challenge_id,
consent_verifier,
consent_skip,
consent_csrf,
granted_scope,
consent_remember,
consent_remember_for,
consent_error,
session_access_token,
session_id_token,
consent_was_used,
granted_at_audience,
consent_handled_at
) SELECT
case
when hydra_oauth2_authentication_request_handled.error IS NOT NULL then 128
when hydra_oauth2_consent_request_handled.error IS NOT NULL then 129
when hydra_oauth2_consent_request_handled.was_used = true then 6
when hydra_oauth2_consent_request_handled.challenge IS NOT NULL then 5
when hydra_oauth2_consent_request.challenge IS NOT NULL then 4
when hydra_oauth2_authentication_request_handled.was_used = true then 3
when hydra_oauth2_authentication_request_handled.challenge IS NOT NULL then 2
else 1
end,
hydra_oauth2_authentication_request.challenge,
hydra_oauth2_authentication_request.requested_scope,
hydra_oauth2_authentication_request.verifier,
hydra_oauth2_authentication_request.csrf,
hydra_oauth2_authentication_request.subject,
hydra_oauth2_authentication_request.request_url,
hydra_oauth2_authentication_request.skip,
hydra_oauth2_authentication_request.client_id,
hydra_oauth2_authentication_request.requested_at,
hydra_oauth2_authentication_request.authenticated_at,
cast(coalesce(hydra_oauth2_authentication_request.oidc_context, '{}') as jsonb),
hydra_oauth2_authentication_request.login_session_id,
hydra_oauth2_authentication_request.requested_at_audience,
coalesce(hydra_oauth2_authentication_request_handled.remember, false),
coalesce(hydra_oauth2_authentication_request_handled.remember_for, 0),
hydra_oauth2_authentication_request_handled.error,
coalesce(hydra_oauth2_authentication_request_handled.acr, ''),
hydra_oauth2_authentication_request_handled.authenticated_at,
coalesce(hydra_oauth2_authentication_request_handled.was_used, false),
coalesce(hydra_oauth2_consent_request.forced_subject_identifier, hydra_oauth2_authentication_request_handled.forced_subject_identifier, ''),
cast(coalesce(hydra_oauth2_authentication_request_handled.context, '{}') as jsonb),
coalesce(hydra_oauth2_authentication_request_handled.amr, ''),
hydra_oauth2_consent_request.challenge,
hydra_oauth2_consent_request.verifier,
coalesce(hydra_oauth2_consent_request.skip, false),
hydra_oauth2_consent_request.csrf,
coalesce(hydra_oauth2_consent_request_handled.granted_scope, '[]'),
coalesce(hydra_oauth2_consent_request_handled.remember, false),
coalesce(hydra_oauth2_consent_request_handled.remember_for, 0),
hydra_oauth2_consent_request_handled.error,
cast(coalesce(hydra_oauth2_consent_request_handled.session_access_token, '{}') as jsonb),
cast(coalesce(hydra_oauth2_consent_request_handled.session_id_token, '{}') as jsonb),
coalesce(hydra_oauth2_consent_request_handled.was_used, false),
coalesce(hydra_oauth2_consent_request_handled.granted_at_audience, '[]'),
hydra_oauth2_consent_request_handled.handled_at
FROM hydra_oauth2_authentication_request
LEFT JOIN hydra_oauth2_authentication_request_handled
ON hydra_oauth2_authentication_request.challenge = hydra_oauth2_authentication_request_handled.challenge
LEFT JOIN hydra_oauth2_consent_request
ON hydra_oauth2_authentication_request.challenge = hydra_oauth2_consent_request.login_challenge
LEFT JOIN hydra_oauth2_consent_request_handled
ON hydra_oauth2_consent_request.challenge = hydra_oauth2_consent_request_handled.challenge;
UPDATE hydra_oauth2_access AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id);
UPDATE hydra_oauth2_code AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id);
UPDATE hydra_oauth2_oidc AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id);
UPDATE hydra_oauth2_refresh AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id);
UPDATE hydra_oauth2_pkce AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id); |
SQL | hydra/persistence/sql/migrations/20211019000001000001_merge_authentication_request_tables.down.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000001_merge_authentication_request_tables.mysql.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
INSERT INTO hydra_oauth2_flow (
state,
login_challenge,
requested_scope,
login_verifier,
login_csrf,
subject,
request_url,
login_skip,
client_id,
requested_at,
login_initialized_at,
oidc_context,
login_session_id,
requested_at_audience,
login_remember,
login_remember_for,
login_error,
acr,
login_authenticated_at,
login_was_used,
forced_subject_identifier,
context,
amr,
`consent_challenge_id`,
`consent_verifier`,
`consent_skip`,
`consent_csrf`,
`granted_scope`,
`consent_remember`,
`consent_remember_for`,
`consent_error`,
`session_access_token`,
`session_id_token`,
`consent_was_used`,
`granted_at_audience`,
`consent_handled_at`
) SELECT
case
when hydra_oauth2_authentication_request_handled.error IS NOT NULL then 128
when hydra_oauth2_consent_request_handled.error IS NOT NULL then 129
when hydra_oauth2_consent_request_handled.was_used = true then 6
when hydra_oauth2_consent_request_handled.challenge IS NOT NULL then 5
when hydra_oauth2_consent_request.challenge IS NOT NULL then 4
when hydra_oauth2_authentication_request_handled.was_used = true then 3
when hydra_oauth2_authentication_request_handled.challenge IS NOT NULL then 2
else 1
end,
hydra_oauth2_authentication_request.challenge,
hydra_oauth2_authentication_request.requested_scope,
hydra_oauth2_authentication_request.verifier,
hydra_oauth2_authentication_request.csrf,
hydra_oauth2_authentication_request.subject,
hydra_oauth2_authentication_request.request_url,
hydra_oauth2_authentication_request.skip,
hydra_oauth2_authentication_request.client_id,
hydra_oauth2_authentication_request.requested_at,
hydra_oauth2_authentication_request.authenticated_at,
coalesce(hydra_oauth2_authentication_request.oidc_context, '{}'),
hydra_oauth2_authentication_request.login_session_id,
hydra_oauth2_authentication_request.requested_at_audience,
coalesce(hydra_oauth2_authentication_request_handled.remember, false),
coalesce(hydra_oauth2_authentication_request_handled.remember_for, 0),
hydra_oauth2_authentication_request_handled.error,
coalesce(hydra_oauth2_authentication_request_handled.acr, ''),
hydra_oauth2_authentication_request_handled.authenticated_at,
coalesce(hydra_oauth2_authentication_request_handled.was_used, false),
coalesce(hydra_oauth2_consent_request.forced_subject_identifier, hydra_oauth2_authentication_request_handled.forced_subject_identifier, ''),
coalesce(hydra_oauth2_authentication_request_handled.context, '{}'),
coalesce(hydra_oauth2_authentication_request_handled.amr, ''),
hydra_oauth2_consent_request.challenge,
hydra_oauth2_consent_request.verifier,
coalesce(hydra_oauth2_consent_request.skip, false),
hydra_oauth2_consent_request.csrf,
coalesce(hydra_oauth2_consent_request_handled.granted_scope, '[]'),
coalesce(hydra_oauth2_consent_request_handled.remember, false),
coalesce(hydra_oauth2_consent_request_handled.remember_for, 0),
hydra_oauth2_consent_request_handled.error,
coalesce(hydra_oauth2_consent_request_handled.session_access_token, ('{}')),
coalesce(hydra_oauth2_consent_request_handled.session_id_token, ('{}')),
coalesce(hydra_oauth2_consent_request_handled.was_used, false),
coalesce(hydra_oauth2_consent_request_handled.granted_at_audience, '[]'),
hydra_oauth2_consent_request_handled.handled_at
FROM hydra_oauth2_authentication_request
LEFT JOIN hydra_oauth2_authentication_request_handled
ON hydra_oauth2_authentication_request.challenge = hydra_oauth2_authentication_request_handled.challenge
LEFT JOIN hydra_oauth2_consent_request
ON hydra_oauth2_authentication_request.challenge = hydra_oauth2_consent_request.login_challenge
LEFT JOIN hydra_oauth2_consent_request_handled
ON hydra_oauth2_consent_request.challenge = hydra_oauth2_consent_request_handled.challenge;
UPDATE hydra_oauth2_access AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id);
UPDATE hydra_oauth2_code AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id);
UPDATE hydra_oauth2_oidc AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id);
UPDATE hydra_oauth2_refresh AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id);
UPDATE hydra_oauth2_pkce AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id); |
SQL | hydra/persistence/sql/migrations/20211019000001000001_merge_authentication_request_tables.postgres.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
INSERT INTO hydra_oauth2_flow (
state,
login_challenge,
requested_scope,
login_verifier,
login_csrf,
subject,
request_url,
login_skip,
client_id,
requested_at,
login_initialized_at,
oidc_context,
login_session_id,
requested_at_audience,
login_remember,
login_remember_for,
login_error,
acr,
login_authenticated_at,
login_was_used,
forced_subject_identifier,
context,
amr,
consent_challenge_id,
consent_verifier,
consent_skip,
consent_csrf,
granted_scope,
consent_remember,
consent_remember_for,
consent_error,
session_access_token,
session_id_token,
consent_was_used,
granted_at_audience,
consent_handled_at
) SELECT
case
when hydra_oauth2_authentication_request_handled.error IS NOT NULL then 128
when hydra_oauth2_consent_request_handled.error IS NOT NULL then 129
when hydra_oauth2_consent_request_handled.was_used = true then 6
when hydra_oauth2_consent_request_handled.challenge IS NOT NULL then 5
when hydra_oauth2_consent_request.challenge IS NOT NULL then 4
when hydra_oauth2_authentication_request_handled.was_used = true then 3
when hydra_oauth2_authentication_request_handled.challenge IS NOT NULL then 2
else 1
end,
hydra_oauth2_authentication_request.challenge,
hydra_oauth2_authentication_request.requested_scope,
hydra_oauth2_authentication_request.verifier,
hydra_oauth2_authentication_request.csrf,
hydra_oauth2_authentication_request.subject,
hydra_oauth2_authentication_request.request_url,
hydra_oauth2_authentication_request.skip,
hydra_oauth2_authentication_request.client_id,
hydra_oauth2_authentication_request.requested_at,
hydra_oauth2_authentication_request.authenticated_at,
cast(coalesce(hydra_oauth2_authentication_request.oidc_context, '{}') as jsonb),
hydra_oauth2_authentication_request.login_session_id,
hydra_oauth2_authentication_request.requested_at_audience,
coalesce(hydra_oauth2_authentication_request_handled.remember, false),
coalesce(hydra_oauth2_authentication_request_handled.remember_for, 0),
hydra_oauth2_authentication_request_handled.error,
coalesce(hydra_oauth2_authentication_request_handled.acr, ''),
hydra_oauth2_authentication_request_handled.authenticated_at,
coalesce(hydra_oauth2_authentication_request_handled.was_used, false),
coalesce(hydra_oauth2_consent_request.forced_subject_identifier, hydra_oauth2_authentication_request_handled.forced_subject_identifier, ''),
cast(coalesce(hydra_oauth2_authentication_request_handled.context, '{}') as jsonb),
coalesce(hydra_oauth2_authentication_request_handled.amr, ''),
hydra_oauth2_consent_request.challenge,
hydra_oauth2_consent_request.verifier,
coalesce(hydra_oauth2_consent_request.skip, false),
hydra_oauth2_consent_request.csrf,
coalesce(hydra_oauth2_consent_request_handled.granted_scope, '[]'),
coalesce(hydra_oauth2_consent_request_handled.remember, false),
coalesce(hydra_oauth2_consent_request_handled.remember_for, 0),
hydra_oauth2_consent_request_handled.error,
cast(coalesce(hydra_oauth2_consent_request_handled.session_access_token, '{}') as jsonb),
cast(coalesce(hydra_oauth2_consent_request_handled.session_id_token, '{}') as jsonb),
coalesce(hydra_oauth2_consent_request_handled.was_used, false),
coalesce(hydra_oauth2_consent_request_handled.granted_at_audience, '[]'),
hydra_oauth2_consent_request_handled.handled_at
FROM hydra_oauth2_authentication_request
LEFT JOIN hydra_oauth2_authentication_request_handled
ON hydra_oauth2_authentication_request.challenge = hydra_oauth2_authentication_request_handled.challenge
LEFT JOIN hydra_oauth2_consent_request
ON hydra_oauth2_authentication_request.challenge = hydra_oauth2_consent_request.login_challenge
LEFT JOIN hydra_oauth2_consent_request_handled
ON hydra_oauth2_consent_request.challenge = hydra_oauth2_consent_request_handled.challenge;
UPDATE hydra_oauth2_access AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id);
UPDATE hydra_oauth2_code AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id);
UPDATE hydra_oauth2_oidc AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id);
UPDATE hydra_oauth2_refresh AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id);
UPDATE hydra_oauth2_pkce AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id); |
SQL | hydra/persistence/sql/migrations/20211019000001000001_merge_authentication_request_tables.sqlite.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
INSERT INTO hydra_oauth2_flow (
state,
login_challenge,
requested_scope,
login_verifier,
login_csrf,
subject,
request_url,
login_skip,
client_id,
requested_at,
login_initialized_at,
oidc_context,
login_session_id,
requested_at_audience,
login_remember,
login_remember_for,
login_error,
acr,
login_authenticated_at,
login_was_used,
forced_subject_identifier,
context,
amr,
consent_challenge_id,
consent_verifier,
consent_skip,
consent_csrf,
granted_scope,
consent_remember,
consent_remember_for,
consent_error,
session_access_token,
session_id_token,
consent_was_used,
granted_at_audience,
consent_handled_at
) SELECT
case
when hydra_oauth2_authentication_request_handled.error IS NOT NULL then 128
when hydra_oauth2_consent_request_handled.error IS NOT NULL then 129
when hydra_oauth2_consent_request_handled.was_used = true then 6
when hydra_oauth2_consent_request_handled.challenge IS NOT NULL then 5
when hydra_oauth2_consent_request.challenge IS NOT NULL then 4
when hydra_oauth2_authentication_request_handled.was_used = true then 3
when hydra_oauth2_authentication_request_handled.challenge IS NOT NULL then 2
else 1
end,
hydra_oauth2_authentication_request.challenge,
hydra_oauth2_authentication_request.requested_scope,
hydra_oauth2_authentication_request.verifier,
hydra_oauth2_authentication_request.csrf,
hydra_oauth2_authentication_request.subject,
hydra_oauth2_authentication_request.request_url,
hydra_oauth2_authentication_request.skip,
hydra_oauth2_authentication_request.client_id,
hydra_oauth2_authentication_request.requested_at,
hydra_oauth2_authentication_request.authenticated_at,
coalesce(hydra_oauth2_authentication_request.oidc_context, '{}'),
hydra_oauth2_authentication_request.login_session_id,
hydra_oauth2_authentication_request.requested_at_audience,
coalesce(hydra_oauth2_authentication_request_handled.remember, false),
coalesce(hydra_oauth2_authentication_request_handled.remember_for, 0),
hydra_oauth2_authentication_request_handled.error,
coalesce(hydra_oauth2_authentication_request_handled.acr, ''),
hydra_oauth2_authentication_request_handled.authenticated_at,
coalesce(hydra_oauth2_authentication_request_handled.was_used, false),
coalesce(hydra_oauth2_consent_request.forced_subject_identifier, hydra_oauth2_authentication_request_handled.forced_subject_identifier, ''),
coalesce(hydra_oauth2_authentication_request_handled.context, '{}'),
coalesce(hydra_oauth2_authentication_request_handled.amr, ''),
hydra_oauth2_consent_request.challenge,
hydra_oauth2_consent_request.verifier,
coalesce(hydra_oauth2_consent_request.skip, false),
hydra_oauth2_consent_request.csrf,
coalesce(hydra_oauth2_consent_request_handled.granted_scope, '[]'),
coalesce(hydra_oauth2_consent_request_handled.remember, false),
coalesce(hydra_oauth2_consent_request_handled.remember_for, 0),
hydra_oauth2_consent_request_handled.error,
coalesce(hydra_oauth2_consent_request_handled.session_access_token, '{}'),
coalesce(hydra_oauth2_consent_request_handled.session_id_token, '{}'),
coalesce(hydra_oauth2_consent_request_handled.was_used, false),
coalesce(hydra_oauth2_consent_request_handled.granted_at_audience, '[]'),
hydra_oauth2_consent_request_handled.handled_at
FROM hydra_oauth2_authentication_request
LEFT JOIN hydra_oauth2_authentication_request_handled
ON hydra_oauth2_authentication_request.challenge = hydra_oauth2_authentication_request_handled.challenge
LEFT JOIN hydra_oauth2_consent_request
ON hydra_oauth2_authentication_request.challenge = hydra_oauth2_consent_request.login_challenge
LEFT JOIN hydra_oauth2_consent_request_handled
ON hydra_oauth2_consent_request.challenge = hydra_oauth2_consent_request_handled.challenge;
UPDATE hydra_oauth2_access AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id);
UPDATE hydra_oauth2_code AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id);
UPDATE hydra_oauth2_oidc AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id);
UPDATE hydra_oauth2_refresh AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id);
UPDATE hydra_oauth2_pkce AS t1
SET challenge_id = NULL
WHERE challenge_id IS NOT NULL
AND NOT exists(SELECT NULL FROM hydra_oauth2_flow t2 WHERE t1.challenge_id = t2.consent_challenge_id); |
SQL | hydra/persistence/sql/migrations/20211019000001000002_merge_authentication_request_tables.cockroach.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
CREATE INDEX hydra_oauth2_flow_client_id_subject_idx ON hydra_oauth2_flow USING btree (client_id, subject);
CREATE INDEX hydra_oauth2_flow_cid_idx ON hydra_oauth2_flow USING btree (client_id);
CREATE INDEX hydra_oauth2_flow_login_session_id_idx ON hydra_oauth2_flow USING btree (login_session_id);
CREATE INDEX hydra_oauth2_flow_sub_idx ON hydra_oauth2_flow USING btree (subject);
CREATE UNIQUE INDEX hydra_oauth2_flow_consent_challenge_idx ON hydra_oauth2_flow USING btree (consent_challenge_id);
CREATE UNIQUE INDEX hydra_oauth2_flow_login_verifier_idx ON hydra_oauth2_flow USING btree (login_verifier);
CREATE INDEX hydra_oauth2_flow_consent_verifier_idx ON hydra_oauth2_flow USING btree (consent_verifier); |
SQL | hydra/persistence/sql/migrations/20211019000001000002_merge_authentication_request_tables.down.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000002_merge_authentication_request_tables.mysql.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
ALTER TABLE hydra_oauth2_access DROP FOREIGN KEY hydra_oauth2_access_challenge_id_fk; |
SQL | hydra/persistence/sql/migrations/20211019000001000002_merge_authentication_request_tables.postgres.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
CREATE INDEX hydra_oauth2_flow_client_id_subject_idx ON hydra_oauth2_flow USING btree (client_id, subject);
CREATE INDEX hydra_oauth2_flow_cid_idx ON hydra_oauth2_flow USING btree (client_id);
CREATE INDEX hydra_oauth2_flow_login_session_id_idx ON hydra_oauth2_flow USING btree (login_session_id);
CREATE INDEX hydra_oauth2_flow_sub_idx ON hydra_oauth2_flow USING btree (subject);
CREATE UNIQUE INDEX hydra_oauth2_flow_consent_challenge_idx ON hydra_oauth2_flow USING btree (consent_challenge_id);
CREATE UNIQUE INDEX hydra_oauth2_flow_login_verifier_idx ON hydra_oauth2_flow USING btree (login_verifier);
CREATE INDEX hydra_oauth2_flow_consent_verifier_idx ON hydra_oauth2_flow USING btree (consent_verifier);
ALTER TABLE ONLY hydra_oauth2_flow ADD CONSTRAINT hydra_oauth2_flow_pkey PRIMARY KEY (login_challenge);
ALTER TABLE ONLY hydra_oauth2_flow ADD CONSTRAINT hydra_oauth2_flow_client_id_fk FOREIGN KEY (client_id) REFERENCES hydra_client(id) ON DELETE CASCADE;
ALTER TABLE ONLY hydra_oauth2_flow ADD CONSTRAINT hydra_oauth2_flow_login_session_id_fk FOREIGN KEY (login_session_id) REFERENCES hydra_oauth2_authentication_session(id) ON DELETE CASCADE;
ALTER TABLE ONLY hydra_oauth2_access DROP CONSTRAINT hydra_oauth2_access_challenge_id_fk;
ALTER TABLE ONLY hydra_oauth2_access ADD CONSTRAINT hydra_oauth2_access_challenge_id_fk FOREIGN KEY (challenge_id) REFERENCES hydra_oauth2_flow(consent_challenge_id) ON DELETE CASCADE;
ALTER TABLE ONLY hydra_oauth2_code DROP CONSTRAINT hydra_oauth2_code_challenge_id_fk;
ALTER TABLE ONLY hydra_oauth2_code ADD CONSTRAINT hydra_oauth2_code_challenge_id_fk FOREIGN KEY (challenge_id) REFERENCES hydra_oauth2_flow(consent_challenge_id) ON DELETE CASCADE;
ALTER TABLE ONLY hydra_oauth2_oidc DROP CONSTRAINT hydra_oauth2_oidc_challenge_id_fk;
ALTER TABLE ONLY hydra_oauth2_oidc ADD CONSTRAINT hydra_oauth2_oidc_challenge_id_fk FOREIGN KEY (challenge_id) REFERENCES hydra_oauth2_flow(consent_challenge_id) ON DELETE CASCADE;
ALTER TABLE ONLY hydra_oauth2_pkce DROP CONSTRAINT hydra_oauth2_pkce_challenge_id_fk;
ALTER TABLE ONLY hydra_oauth2_pkce ADD CONSTRAINT hydra_oauth2_pkce_challenge_id_fk FOREIGN KEY (challenge_id) REFERENCES hydra_oauth2_flow(consent_challenge_id) ON DELETE CASCADE;
ALTER TABLE ONLY hydra_oauth2_refresh DROP CONSTRAINT hydra_oauth2_refresh_challenge_id_fk;
ALTER TABLE ONLY hydra_oauth2_refresh ADD CONSTRAINT hydra_oauth2_refresh_challenge_id_fk FOREIGN KEY (challenge_id) REFERENCES hydra_oauth2_flow(consent_challenge_id) ON DELETE CASCADE; |
SQL | hydra/persistence/sql/migrations/20211019000001000002_merge_authentication_request_tables.sqlite.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
CREATE INDEX hydra_oauth2_flow_client_id_idx ON hydra_oauth2_flow (client_id); |
SQL | hydra/persistence/sql/migrations/20211019000001000003_merge_authentication_request_tables.cockroach.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
ALTER TABLE ONLY hydra_oauth2_flow ADD CONSTRAINT hydra_oauth2_flow_pkey PRIMARY KEY (login_challenge); |
SQL | hydra/persistence/sql/migrations/20211019000001000003_merge_authentication_request_tables.down.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000003_merge_authentication_request_tables.mysql.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
ALTER TABLE hydra_oauth2_access ADD CONSTRAINT hydra_oauth2_access_challenge_id_fk FOREIGN KEY (challenge_id) REFERENCES hydra_oauth2_flow(consent_challenge_id) ON DELETE CASCADE; |
SQL | hydra/persistence/sql/migrations/20211019000001000003_merge_authentication_request_tables.postgres.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
DROP TABLE hydra_oauth2_consent_request_handled; |
SQL | hydra/persistence/sql/migrations/20211019000001000003_merge_authentication_request_tables.sqlite.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
CREATE INDEX hydra_oauth2_flow_login_session_id_idx ON hydra_oauth2_flow (login_session_id); |
SQL | hydra/persistence/sql/migrations/20211019000001000004_merge_authentication_request_tables.cockroach.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
ALTER TABLE ONLY hydra_oauth2_flow ADD CONSTRAINT hydra_oauth2_flow_client_id_fk FOREIGN KEY (client_id) REFERENCES hydra_client(id) ON DELETE CASCADE;
ALTER TABLE ONLY hydra_oauth2_flow ADD CONSTRAINT hydra_oauth2_flow_login_session_id_fk FOREIGN KEY (login_session_id) REFERENCES hydra_oauth2_authentication_session(id) ON DELETE CASCADE;
ALTER TABLE ONLY hydra_oauth2_access DROP CONSTRAINT hydra_oauth2_access_challenge_id_fk;
ALTER TABLE ONLY hydra_oauth2_access ADD CONSTRAINT hydra_oauth2_access_challenge_id_fk FOREIGN KEY (challenge_id) REFERENCES hydra_oauth2_flow(consent_challenge_id) ON DELETE CASCADE;
ALTER TABLE ONLY hydra_oauth2_code DROP CONSTRAINT hydra_oauth2_code_challenge_id_fk;
ALTER TABLE ONLY hydra_oauth2_code ADD CONSTRAINT hydra_oauth2_code_challenge_id_fk FOREIGN KEY (challenge_id) REFERENCES hydra_oauth2_flow(consent_challenge_id) ON DELETE CASCADE;
ALTER TABLE ONLY hydra_oauth2_oidc DROP CONSTRAINT hydra_oauth2_oidc_challenge_id_fk;
ALTER TABLE ONLY hydra_oauth2_oidc ADD CONSTRAINT hydra_oauth2_oidc_challenge_id_fk FOREIGN KEY (challenge_id) REFERENCES hydra_oauth2_flow(consent_challenge_id) ON DELETE CASCADE;
ALTER TABLE ONLY hydra_oauth2_pkce DROP CONSTRAINT hydra_oauth2_pkce_challenge_id_fk;
ALTER TABLE ONLY hydra_oauth2_pkce ADD CONSTRAINT hydra_oauth2_pkce_challenge_id_fk FOREIGN KEY (challenge_id) REFERENCES hydra_oauth2_flow(consent_challenge_id) ON DELETE CASCADE;
ALTER TABLE ONLY hydra_oauth2_refresh DROP CONSTRAINT hydra_oauth2_refresh_challenge_id_fk;
ALTER TABLE ONLY hydra_oauth2_refresh ADD CONSTRAINT hydra_oauth2_refresh_challenge_id_fk FOREIGN KEY (challenge_id) REFERENCES hydra_oauth2_flow(consent_challenge_id) ON DELETE CASCADE; |
SQL | hydra/persistence/sql/migrations/20211019000001000004_merge_authentication_request_tables.down.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000004_merge_authentication_request_tables.mysql.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
ALTER TABLE hydra_oauth2_code DROP FOREIGN KEY hydra_oauth2_code_challenge_id_fk; |
SQL | hydra/persistence/sql/migrations/20211019000001000004_merge_authentication_request_tables.postgres.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
DROP TABLE hydra_oauth2_consent_request; |
SQL | hydra/persistence/sql/migrations/20211019000001000004_merge_authentication_request_tables.sqlite.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
CREATE INDEX hydra_oauth2_flow_subject_idx ON hydra_oauth2_flow (subject); |
SQL | hydra/persistence/sql/migrations/20211019000001000005_merge_authentication_request_tables.cockroach.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
DROP TABLE hydra_oauth2_consent_request_handled; |
SQL | hydra/persistence/sql/migrations/20211019000001000005_merge_authentication_request_tables.down.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000005_merge_authentication_request_tables.mysql.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
ALTER TABLE hydra_oauth2_code ADD CONSTRAINT hydra_oauth2_code_challenge_id_fk FOREIGN KEY (challenge_id) REFERENCES hydra_oauth2_flow(consent_challenge_id) ON DELETE CASCADE; |
SQL | hydra/persistence/sql/migrations/20211019000001000005_merge_authentication_request_tables.postgres.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
DROP TABLE hydra_oauth2_authentication_request_handled; |
SQL | hydra/persistence/sql/migrations/20211019000001000005_merge_authentication_request_tables.sqlite.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
CREATE UNIQUE INDEX hydra_oauth2_flow_consent_challenge_id_idx ON hydra_oauth2_flow (consent_challenge_id); |
SQL | hydra/persistence/sql/migrations/20211019000001000006_merge_authentication_request_tables.cockroach.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
DROP TABLE hydra_oauth2_consent_request; |
SQL | hydra/persistence/sql/migrations/20211019000001000006_merge_authentication_request_tables.down.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000006_merge_authentication_request_tables.mysql.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
ALTER TABLE hydra_oauth2_oidc DROP FOREIGN KEY hydra_oauth2_oidc_challenge_id_fk; |
SQL | hydra/persistence/sql/migrations/20211019000001000006_merge_authentication_request_tables.postgres.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
DROP TABLE hydra_oauth2_authentication_request; |
SQL | hydra/persistence/sql/migrations/20211019000001000006_merge_authentication_request_tables.sqlite.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
CREATE UNIQUE INDEX hydra_oauth2_flow_login_verifier_idx ON hydra_oauth2_flow (login_verifier); |
SQL | hydra/persistence/sql/migrations/20211019000001000007_merge_authentication_request_tables.cockroach.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
DROP TABLE hydra_oauth2_authentication_request_handled; |
SQL | hydra/persistence/sql/migrations/20211019000001000007_merge_authentication_request_tables.down.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000007_merge_authentication_request_tables.mysql.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
ALTER TABLE hydra_oauth2_oidc ADD CONSTRAINT hydra_oauth2_oidc_challenge_id_fk FOREIGN KEY (challenge_id) REFERENCES hydra_oauth2_flow(consent_challenge_id) ON DELETE CASCADE; |
SQL | hydra/persistence/sql/migrations/20211019000001000007_merge_authentication_request_tables.postgres.up.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000007_merge_authentication_request_tables.sqlite.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
CREATE INDEX hydra_oauth2_flow_consent_verifier_idx ON hydra_oauth2_flow (consent_verifier); |
SQL | hydra/persistence/sql/migrations/20211019000001000008_merge_authentication_request_tables.cockroach.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
DROP TABLE hydra_oauth2_authentication_request; |
SQL | hydra/persistence/sql/migrations/20211019000001000008_merge_authentication_request_tables.down.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000008_merge_authentication_request_tables.mysql.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
ALTER TABLE hydra_oauth2_pkce DROP FOREIGN KEY hydra_oauth2_pkce_challenge_id_fk; |
SQL | hydra/persistence/sql/migrations/20211019000001000008_merge_authentication_request_tables.postgres.up.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000008_merge_authentication_request_tables.sqlite.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
DROP TABLE hydra_oauth2_authentication_request; |
SQL | hydra/persistence/sql/migrations/20211019000001000009_merge_authentication_request_tables.cockroach.up.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000009_merge_authentication_request_tables.down.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000009_merge_authentication_request_tables.mysql.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
ALTER TABLE hydra_oauth2_pkce ADD CONSTRAINT hydra_oauth2_pkce_challenge_id_fk FOREIGN KEY (challenge_id) REFERENCES hydra_oauth2_flow(consent_challenge_id) ON DELETE CASCADE; |
SQL | hydra/persistence/sql/migrations/20211019000001000009_merge_authentication_request_tables.postgres.up.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000009_merge_authentication_request_tables.sqlite.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
DROP TABLE hydra_oauth2_authentication_request_handled; |
SQL | hydra/persistence/sql/migrations/20211019000001000010_merge_authentication_request_tables.cockroach.up.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000010_merge_authentication_request_tables.down.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000010_merge_authentication_request_tables.mysql.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
ALTER TABLE hydra_oauth2_refresh DROP FOREIGN KEY hydra_oauth2_refresh_challenge_id_fk; |
SQL | hydra/persistence/sql/migrations/20211019000001000010_merge_authentication_request_tables.postgres.up.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000010_merge_authentication_request_tables.sqlite.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
DROP TABLE hydra_oauth2_consent_request; |
SQL | hydra/persistence/sql/migrations/20211019000001000011_merge_authentication_request_tables.cockroach.up.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000011_merge_authentication_request_tables.down.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000011_merge_authentication_request_tables.mysql.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
ALTER TABLE hydra_oauth2_refresh ADD CONSTRAINT hydra_oauth2_refresh_challenge_id_fk FOREIGN KEY (challenge_id) REFERENCES hydra_oauth2_flow(consent_challenge_id) ON DELETE CASCADE; |
SQL | hydra/persistence/sql/migrations/20211019000001000011_merge_authentication_request_tables.postgres.up.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000011_merge_authentication_request_tables.sqlite.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
DROP TABLE hydra_oauth2_consent_request_handled; |
SQL | hydra/persistence/sql/migrations/20211019000001000012_merge_authentication_request_tables.cockroach.up.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000012_merge_authentication_request_tables.down.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000012_merge_authentication_request_tables.mysql.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
DROP TABLE hydra_oauth2_consent_request_handled; |
SQL | hydra/persistence/sql/migrations/20211019000001000012_merge_authentication_request_tables.postgres.up.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000012_merge_authentication_request_tables.sqlite.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
DROP TABLE hydra_oauth2_code; |
SQL | hydra/persistence/sql/migrations/20211019000001000013_merge_authentication_request_tables.cockroach.up.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000013_merge_authentication_request_tables.down.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000013_merge_authentication_request_tables.mysql.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
DROP TABLE hydra_oauth2_consent_request; |
SQL | hydra/persistence/sql/migrations/20211019000001000013_merge_authentication_request_tables.postgres.up.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000013_merge_authentication_request_tables.sqlite.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
CREATE TABLE hydra_oauth2_code
(
signature VARCHAR(255) NOT NULL,
request_id VARCHAR(40) NOT NULL,
requested_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
client_id VARCHAR(255) NOT NULL REFERENCES hydra_client (id) ON DELETE CASCADE,
scope TEXT NOT NULL,
granted_scope TEXT NOT NULL,
form_data TEXT NOT NULL,
session_data TEXT NOT NULL,
subject VARCHAR(255) NOT NULL DEFAULT '',
active INTEGER NOT NULL DEFAULT true,
requested_audience TEXT NULL DEFAULT '',
granted_audience TEXT NULL DEFAULT '',
challenge_id VARCHAR(40) NULL REFERENCES hydra_oauth2_flow (consent_challenge_id) ON DELETE CASCADE
); |
SQL | hydra/persistence/sql/migrations/20211019000001000014_merge_authentication_request_tables.cockroach.up.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000014_merge_authentication_request_tables.down.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000014_merge_authentication_request_tables.mysql.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
DROP TABLE hydra_oauth2_authentication_request_handled; |
SQL | hydra/persistence/sql/migrations/20211019000001000014_merge_authentication_request_tables.postgres.up.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000014_merge_authentication_request_tables.sqlite.up.sql | -- Migration generated by the command below; DO NOT EDIT.
-- hydra:generate hydra migrate gen
CREATE INDEX hydra_oauth2_code_client_id_idx ON hydra_oauth2_code (client_id); |
SQL | hydra/persistence/sql/migrations/20211019000001000015_merge_authentication_request_tables.cockroach.up.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
SQL | hydra/persistence/sql/migrations/20211019000001000015_merge_authentication_request_tables.down.sql | -- This blank migration was generated to meet ory/x/popx validation criteria, see https://github.com/ory/x/pull/509; DO NOT EDIT.
-- hydra:generate hydra migrate gen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.