language
stringlengths
0
24
filename
stringlengths
9
214
code
stringlengths
99
9.93M
SQL
hydra/persistence/sql/migrations/20190300000001000000_consent.down.sql
DROP TABLE hydra_oauth2_consent_request; DROP TABLE hydra_oauth2_authentication_request; DROP TABLE hydra_oauth2_authentication_session; DROP TABLE hydra_oauth2_consent_request_handled; DROP TABLE hydra_oauth2_authentication_request_handled;
SQL
hydra/persistence/sql/migrations/20190300000001000000_consent.up.sql
CREATE TABLE hydra_oauth2_consent_request ( challenge varchar(40) NOT NULL PRIMARY KEY, verifier varchar(40) NOT NULL, client_id varchar(255) NOT NULL, subject varchar(255) NOT NULL, request_url text NOT NULL, skip bool NOT NULL, requested_scope text NOT NULL, csrf ...
SQL
hydra/persistence/sql/migrations/20190300000002000000_consent.down.sql
ALTER TABLE hydra_oauth2_consent_request DROP COLUMN forced_subject_identifier; ALTER TABLE hydra_oauth2_authentication_request_handled DROP COLUMN forced_subject_identifier; DROP TABLE hydra_oauth2_obfuscated_authentication_session;
SQL
hydra/persistence/sql/migrations/20190300000002000000_consent.up.sql
ALTER TABLE hydra_oauth2_consent_request ADD forced_subject_identifier VARCHAR(255) NULL DEFAULT ''; ALTER TABLE hydra_oauth2_authentication_request_handled ADD forced_subject_identifier VARCHAR(255) NULL DEFAULT ''; CREATE TABLE hydra_oauth2_obfuscated_authentication_session ( subject varchar(255) NOT NUL...
SQL
hydra/persistence/sql/migrations/20190300000003000000_consent.down.sql
ALTER TABLE hydra_oauth2_consent_request DROP COLUMN login_session_id; ALTER TABLE hydra_oauth2_consent_request DROP COLUMN login_challenge; ALTER TABLE hydra_oauth2_authentication_request DROP COLUMN login_session_id;
SQL
hydra/persistence/sql/migrations/20190300000003000000_consent.up.sql
ALTER TABLE hydra_oauth2_consent_request ADD login_session_id VARCHAR(40) NULL DEFAULT ''; ALTER TABLE hydra_oauth2_consent_request ADD login_challenge VARCHAR(40) NULL DEFAULT ''; ALTER TABLE hydra_oauth2_authentication_request ADD login_session_id VARCHAR(40) NULL DEFAULT '';
SQL
hydra/persistence/sql/migrations/20190300000004000000_consent.mysql.down.sql
ALTER TABLE hydra_oauth2_consent_request DROP COLUMN requested_at_audience; ALTER TABLE hydra_oauth2_authentication_request DROP COLUMN requested_at_audience; ALTER TABLE hydra_oauth2_consent_request_handled DROP COLUMN granted_at_audience;
SQL
hydra/persistence/sql/migrations/20190300000004000000_consent.mysql.up.sql
ALTER TABLE hydra_oauth2_consent_request ADD requested_at_audience TEXT NULL; ALTER TABLE hydra_oauth2_authentication_request ADD requested_at_audience TEXT NULL; ALTER TABLE hydra_oauth2_consent_request_handled ADD granted_at_audience TEXT NULL; UPDATE hydra_oauth2_consent_request SET requested_at_audience=''; UPDATE...
SQL
hydra/persistence/sql/migrations/20190300000004000000_consent.postgres.down.sql
ALTER TABLE hydra_oauth2_consent_request DROP COLUMN requested_at_audience; ALTER TABLE hydra_oauth2_authentication_request DROP COLUMN requested_at_audience; ALTER TABLE hydra_oauth2_consent_request_handled DROP COLUMN granted_at_audience;
SQL
hydra/persistence/sql/migrations/20190300000004000000_consent.postgres.up.sql
ALTER TABLE hydra_oauth2_consent_request ADD requested_at_audience TEXT NULL DEFAULT ''; ALTER TABLE hydra_oauth2_authentication_request ADD requested_at_audience TEXT NULL DEFAULT ''; ALTER TABLE hydra_oauth2_consent_request_handled ADD granted_at_audience TEXT NULL DEFAULT '';
SQL
hydra/persistence/sql/migrations/20190300000005000000_consent.mysql.down.sql
DROP INDEX hydra_oauth2_obfuscated_authentication_session_so_idx ON hydra_oauth2_obfuscated_authentication_session; DROP INDEX hydra_oauth2_consent_request_cid_idx ON hydra_oauth2_consent_request; DROP INDEX hydra_oauth2_consent_request_sub_idx ON hydra_oauth2_consent_request; DROP INDEX hydra_oauth2_consent_request_v...
SQL
hydra/persistence/sql/migrations/20190300000005000000_consent.mysql.up.sql
CREATE UNIQUE INDEX hydra_oauth2_obfuscated_authentication_session_so_idx ON hydra_oauth2_obfuscated_authentication_session (client_id, subject_obfuscated); CREATE INDEX hydra_oauth2_consent_request_cid_idx ON hydra_oauth2_consent_request (client_id); CREATE INDEX hydra_oauth2_consent_request_sub_idx ON hydra_oauth2_c...
SQL
hydra/persistence/sql/migrations/20190300000005000000_consent.postgres.down.sql
DROP INDEX hydra_oauth2_obfuscated_authentication_session_so_idx; DROP INDEX hydra_oauth2_consent_request_cid_idx; DROP INDEX hydra_oauth2_consent_request_sub_idx; DROP INDEX hydra_oauth2_consent_request_veri_idx; DROP INDEX hydra_oauth2_authentication_request_cid_idx; DROP INDEX hydra_oauth2_authentication_request_s...
SQL
hydra/persistence/sql/migrations/20190300000005000000_consent.postgres.up.sql
CREATE UNIQUE INDEX hydra_oauth2_obfuscated_authentication_session_so_idx ON hydra_oauth2_obfuscated_authentication_session (client_id, subject_obfuscated); CREATE INDEX hydra_oauth2_consent_request_cid_idx ON hydra_oauth2_consent_request (client_id); CREATE INDEX hydra_oauth2_consent_request_sub_idx ON hydra_oauth2_c...
SQL
hydra/persistence/sql/migrations/20190300000006000000_consent.mysql.up.sql
ALTER TABLE hydra_oauth2_consent_request ADD acr TEXT NULL; UPDATE hydra_oauth2_consent_request SET acr=''; ALTER TABLE hydra_oauth2_consent_request MODIFY acr TEXT NOT NULL;
SQL
hydra/persistence/sql/migrations/20190300000007000000_consent.mysql.down.sql
ALTER TABLE hydra_oauth2_consent_request_handled DROP FOREIGN KEY hydra_oauth2_consent_request_handled_challenge_fk; ALTER TABLE hydra_oauth2_authentication_request_handled DROP FOREIGN KEY hydra_oauth2_authentication_request_handled_challenge_fk; ALTER TABLE hydra_oauth2_consent_request DROP FOREIGN KEY hydra_oauth2_...
SQL
hydra/persistence/sql/migrations/20190300000007000000_consent.mysql.up.sql
-- This can be null when no previous login session exists, so let's remove default ALTER TABLE hydra_oauth2_authentication_request ALTER COLUMN login_session_id DROP DEFAULT; -- This can be null when no previous login session exists or if that session has been removed, so let's remove default ALTER TABLE hydra_oauth2_...
SQL
hydra/persistence/sql/migrations/20190300000007000000_consent.postgres.down.sql
ALTER TABLE hydra_oauth2_consent_request_handled DROP CONSTRAINT hydra_oauth2_consent_request_handled_challenge_fk; ALTER TABLE hydra_oauth2_authentication_request_handled DROP CONSTRAINT hydra_oauth2_authentication_request_handled_challenge_fk; ALTER TABLE hydra_oauth2_consent_request DROP CONSTRAINT hydra_oauth2_con...
SQL
hydra/persistence/sql/migrations/20190300000007000000_consent.postgres.up.sql
-- This can be null when no previous login session exists, so let's remove default ALTER TABLE hydra_oauth2_authentication_request ALTER COLUMN login_session_id DROP DEFAULT; -- This can be null when no previous login session exists or if that session has been removed, so let's remove default ALTER TABLE hydra_oauth2_...
SQL
hydra/persistence/sql/migrations/20190300000008000000_consent.mysql.down.sql
ALTER TABLE hydra_oauth2_authentication_request_handled DROP COLUMN context; ALTER TABLE hydra_oauth2_consent_request DROP COLUMN context;
SQL
hydra/persistence/sql/migrations/20190300000008000000_consent.mysql.up.sql
ALTER TABLE hydra_oauth2_authentication_request_handled ADD context TEXT NULL; ALTER TABLE hydra_oauth2_consent_request ADD context TEXT NULL; UPDATE hydra_oauth2_authentication_request_handled SET context='{}'; UPDATE hydra_oauth2_consent_request SET context='{}'; ALTER TABLE hydra_oauth2_authentication_request_hand...
SQL
hydra/persistence/sql/migrations/20190300000008000000_consent.postgres.down.sql
ALTER TABLE hydra_oauth2_authentication_request_handled DROP COLUMN context; ALTER TABLE hydra_oauth2_consent_request DROP COLUMN context;
SQL
hydra/persistence/sql/migrations/20190300000008000000_consent.postgres.up.sql
ALTER TABLE hydra_oauth2_authentication_request_handled ADD context TEXT NOT NULL DEFAULT '{}'; ALTER TABLE hydra_oauth2_consent_request ADD context TEXT NOT NULL DEFAULT '{}';
SQL
hydra/persistence/sql/migrations/20190300000009000000_consent.up.sql
CREATE TABLE hydra_oauth2_logout_request ( challenge varchar(36) NOT NULL PRIMARY KEY, verifier varchar(36) NOT NULL, subject varchar(255) NOT NULL, sid varchar(36) NOT NULL, client_id varchar(255) NOT NULL, request_url text NOT NULL, r...
SQL
hydra/persistence/sql/migrations/20190300000010000000_consent.mysql.down.sql
DROP INDEX hydra_oauth2_logout_request_veri_idx ON hydra_oauth2_logout_request; ALTER TABLE hydra_oauth2_logout_request DROP FOREIGN KEY hydra_oauth2_logout_request_client_id_fk;
SQL
hydra/persistence/sql/migrations/20190300000010000000_consent.mysql.up.sql
CREATE UNIQUE INDEX hydra_oauth2_logout_request_veri_idx ON hydra_oauth2_logout_request (verifier); ALTER TABLE hydra_oauth2_logout_request ADD CONSTRAINT hydra_oauth2_logout_request_client_id_fk FOREIGN KEY (client_id) REFERENCES hydra_client(id) ON DELETE CASCADE;
SQL
hydra/persistence/sql/migrations/20190300000010000000_consent.postgres.down.sql
DROP INDEX hydra_oauth2_logout_request_veri_idx; ALTER TABLE hydra_oauth2_logout_request DROP CONSTRAINT hydra_oauth2_logout_request_client_id_fk;
SQL
hydra/persistence/sql/migrations/20190300000010000000_consent.postgres.up.sql
CREATE UNIQUE INDEX hydra_oauth2_logout_request_veri_idx ON hydra_oauth2_logout_request (verifier); ALTER TABLE hydra_oauth2_logout_request ADD CONSTRAINT hydra_oauth2_logout_request_client_id_fk FOREIGN KEY (client_id) REFERENCES hydra_client(id) ON DELETE CASCADE;
SQL
hydra/persistence/sql/migrations/20190300000011000000_consent.up.sql
ALTER TABLE hydra_oauth2_authentication_session ADD remember bool NOT NULL DEFAULT FALSE; UPDATE hydra_oauth2_authentication_session SET remember=TRUE;
SQL
hydra/persistence/sql/migrations/20190300000012000000_consent.cockroach.down.sql
DROP TABLE hydra_oauth2_consent_request_handled; DROP TABLE hydra_oauth2_consent_request; DROP TABLE hydra_oauth2_authentication_request_handled; DROP TABLE hydra_oauth2_authentication_request; DROP TABLE hydra_oauth2_authentication_session; DROP TABLE hydra_oauth2_obfuscated_authentication_session; DROP TABLE hydra_oa...
SQL
hydra/persistence/sql/migrations/20190300000012000000_consent.cockroach.up.sql
CREATE TABLE hydra_oauth2_consent_request ( challenge varchar(40) NOT NULL PRIMARY KEY, verifier varchar(40) NOT NULL, client_id varchar(255) NOT NULL, subject varchar(255) NOT NULL, request_url text NOT NULL, skip bool NOT NULL, requested_scope text NOT NULL, csrf varchar(40) NOT NULL, authenticated_at timest...
SQL
hydra/persistence/sql/migrations/20190300000012000000_consent.mysql.down.sql
DELETE FROM hydra_oauth2_logout_request WHERE client_id IS NULL; ALTER TABLE hydra_oauth2_logout_request MODIFY client_id varchar(255) NOT NULL;
SQL
hydra/persistence/sql/migrations/20190300000012000000_consent.postgres.down.sql
DELETE FROM hydra_oauth2_logout_request WHERE client_id IS NULL; ALTER TABLE hydra_oauth2_logout_request ALTER COLUMN client_id SET NOT NULL;
SQL
hydra/persistence/sql/migrations/20190300000013000000_consent.cockroach.down.sql
-- Fix performance issue of Admin API - Revoke Login Sessions DROP INDEX hydra_oauth2_authentication_session@hydra_oauth2_authentication_session_subject_idx;
SQL
hydra/persistence/sql/migrations/20190300000013000000_consent.cockroach.up.sql
-- Fix performance issue of Admin API - Revoke Login Sessions CREATE INDEX ON hydra_oauth2_authentication_session (subject);
SQL
hydra/persistence/sql/migrations/20190300000013000000_consent.mysql.down.sql
-- Fix performance issue of Admin API - Revoke Login Sessions DROP INDEX hydra_oauth2_authentication_session_sub_idx ON hydra_oauth2_authentication_session; -- The following 3 sets are for dropping indices for foreign keys. MySQL forbids me to drop indices on foreign keys: MySQL Cannot drop index needed in a foreign ke...
SQL
hydra/persistence/sql/migrations/20190300000013000000_consent.mysql.up.sql
-- Fix performance issue of Admin API - Revoke Login Sessions CREATE INDEX hydra_oauth2_authentication_session_sub_idx ON hydra_oauth2_authentication_session (subject); CREATE INDEX hydra_oauth2_authentication_request_login_session_id_idx ON hydra_oauth2_authentication_request (login_session_id); CREATE INDEX hydra_oau...
SQL
hydra/persistence/sql/migrations/20190300000013000000_consent.postgres.down.sql
-- Fix performance issue of Admin API - Revoke Login Sessions DROP INDEX hydra_oauth2_authentication_session_sub_idx; DROP INDEX hydra_oauth2_authentication_request_login_session_id_idx; DROP INDEX hydra_oauth2_consent_request_login_session_id_idx; DROP INDEX hydra_oauth2_consent_request_login_challenge_idx; -- Fix pe...
SQL
hydra/persistence/sql/migrations/20190300000013000000_consent.postgres.up.sql
-- Fix performance issue of Admin API - Revoke Login Sessions CREATE INDEX hydra_oauth2_authentication_session_sub_idx ON hydra_oauth2_authentication_session (subject); CREATE INDEX hydra_oauth2_authentication_request_login_session_id_idx ON hydra_oauth2_authentication_request (login_session_id); CREATE INDEX hydra_oau...
SQL
hydra/persistence/sql/migrations/20190400000001000000_oauth2.down.sql
DROP TABLE hydra_oauth2_access; DROP TABLE hydra_oauth2_refresh; DROP TABLE hydra_oauth2_code; DROP TABLE hydra_oauth2_oidc;
SQL
hydra/persistence/sql/migrations/20190400000001000000_oauth2.up.sql
CREATE TABLE IF NOT EXISTS hydra_oauth2_access ( signature varchar(255) NOT NULL PRIMARY KEY, request_id varchar(255) NOT NULL, requested_at timestamp NOT NULL DEFAULT now(), client_id text NOT NULL, scope text NOT NULL, granted_scope text NOT NULL, form_data text NOT NULL, sessio...
SQL
hydra/persistence/sql/migrations/20190400000002000000_oauth2.down.sql
ALTER TABLE hydra_oauth2_access DROP COLUMN subject; ALTER TABLE hydra_oauth2_refresh DROP COLUMN subject; ALTER TABLE hydra_oauth2_code DROP COLUMN subject; ALTER TABLE hydra_oauth2_oidc DROP COLUMN subject;
SQL
hydra/persistence/sql/migrations/20190400000002000000_oauth2.up.sql
ALTER TABLE hydra_oauth2_access ADD subject varchar(255) NOT NULL DEFAULT ''; ALTER TABLE hydra_oauth2_refresh ADD subject varchar(255) NOT NULL DEFAULT ''; ALTER TABLE hydra_oauth2_code ADD subject varchar(255) NOT NULL DEFAULT ''; ALTER TABLE hydra_oauth2_oidc ADD subject varchar(255) NOT NULL DEFAULT '';
SQL
hydra/persistence/sql/migrations/20190400000003000000_oauth2.up.sql
CREATE TABLE IF NOT EXISTS hydra_oauth2_pkce ( signature varchar(255) NOT NULL PRIMARY KEY, request_id varchar(255) NOT NULL, requested_at timestamp NOT NULL DEFAULT now(), client_id text NOT NULL, scope text NOT NULL, granted_scope text NOT NULL, form_data text NOT NULL, session_...
SQL
hydra/persistence/sql/migrations/20190400000004000000_oauth2.down.sql
ALTER TABLE hydra_oauth2_access DROP COLUMN active; ALTER TABLE hydra_oauth2_refresh DROP COLUMN active; ALTER TABLE hydra_oauth2_code DROP COLUMN active; ALTER TABLE hydra_oauth2_oidc DROP COLUMN active; ALTER TABLE hydra_oauth2_pkce DROP COLUMN active;
SQL
hydra/persistence/sql/migrations/20190400000004000000_oauth2.up.sql
ALTER TABLE hydra_oauth2_access ADD active BOOL NOT NULL DEFAULT TRUE; ALTER TABLE hydra_oauth2_refresh ADD active BOOL NOT NULL DEFAULT TRUE; ALTER TABLE hydra_oauth2_code ADD active BOOL NOT NULL DEFAULT TRUE; ALTER TABLE hydra_oauth2_oidc ADD active BOOL NOT NULL DEFAULT TRUE; ALTER TABLE hydra_oauth2_pkce ADD activ...
SQL
hydra/persistence/sql/migrations/20190400000005000000_oauth2.mysql.down.sql
DROP INDEX hydra_oauth2_access_request_id_idx ON hydra_oauth2_access; DROP INDEX hydra_oauth2_refresh_request_id_idx ON hydra_oauth2_refresh;
SQL
hydra/persistence/sql/migrations/20190400000005000000_oauth2.mysql.up.sql
CREATE UNIQUE INDEX hydra_oauth2_access_request_id_idx ON hydra_oauth2_access (request_id); CREATE UNIQUE INDEX hydra_oauth2_refresh_request_id_idx ON hydra_oauth2_refresh (request_id);
SQL
hydra/persistence/sql/migrations/20190400000005000000_oauth2.postgres.up.sql
CREATE UNIQUE INDEX hydra_oauth2_access_request_id_idx ON hydra_oauth2_access (request_id); CREATE UNIQUE INDEX hydra_oauth2_refresh_request_id_idx ON hydra_oauth2_refresh (request_id);
SQL
hydra/persistence/sql/migrations/20190400000007000000_oauth2.mysql.down.sql
ALTER TABLE hydra_oauth2_access DROP COLUMN requested_audience; ALTER TABLE hydra_oauth2_access DROP COLUMN granted_audience; ALTER TABLE hydra_oauth2_refresh DROP COLUMN requested_audience; ALTER TABLE hydra_oauth2_refresh DROP COLUMN granted_audience; ALTER TABLE hydra_oauth2_code DROP COLUMN requested_audience; AL...
SQL
hydra/persistence/sql/migrations/20190400000007000000_oauth2.mysql.up.sql
ALTER TABLE hydra_oauth2_access ADD requested_audience TEXT NULL; UPDATE hydra_oauth2_access SET requested_audience=''; ALTER TABLE hydra_oauth2_access MODIFY requested_audience TEXT NOT NULL; ALTER TABLE hydra_oauth2_access ADD granted_audience TEXT NULL; UPDATE hydra_oauth2_access SET granted_audience=''; ALTER TABLE...
SQL
hydra/persistence/sql/migrations/20190400000007000000_oauth2.postgres.down.sql
ALTER TABLE hydra_oauth2_access DROP COLUMN requested_audience; ALTER TABLE hydra_oauth2_access DROP COLUMN granted_audience; ALTER TABLE hydra_oauth2_refresh DROP COLUMN requested_audience; ALTER TABLE hydra_oauth2_refresh DROP COLUMN granted_audience; ALTER TABLE hydra_oauth2_code DROP COLUMN requested_audience; AL...
SQL
hydra/persistence/sql/migrations/20190400000007000000_oauth2.postgres.up.sql
ALTER TABLE hydra_oauth2_access ADD requested_audience TEXT NULL DEFAULT ''; ALTER TABLE hydra_oauth2_access ADD granted_audience TEXT NULL DEFAULT ''; ALTER TABLE hydra_oauth2_refresh ADD requested_audience TEXT NULL DEFAULT ''; ALTER TABLE hydra_oauth2_refresh ADD granted_audience TEXT NULL DEFAULT ''; ALTER TABLE ...
SQL
hydra/persistence/sql/migrations/20190400000008000000_oauth2.down.sql
ALTER TABLE hydra_oauth2_access DROP COLUMN challenge_id; ALTER TABLE hydra_oauth2_refresh DROP COLUMN challenge_id; ALTER TABLE hydra_oauth2_code DROP COLUMN challenge_id; ALTER TABLE hydra_oauth2_oidc DROP COLUMN challenge_id; ALTER TABLE hydra_oauth2_pkce DROP COLUMN challenge_id;
SQL
hydra/persistence/sql/migrations/20190400000008000000_oauth2.up.sql
ALTER TABLE hydra_oauth2_access ADD challenge_id varchar(40) NULL; ALTER TABLE hydra_oauth2_refresh ADD challenge_id varchar(40) NULL; ALTER TABLE hydra_oauth2_code ADD challenge_id varchar(40) NULL; ALTER TABLE hydra_oauth2_oidc ADD challenge_id varchar(40) NULL; ALTER TABLE hydra_oauth2_pkce ADD challenge_id varchar(...
SQL
hydra/persistence/sql/migrations/20190400000009000000_oauth2.cockroach.down.sql
DROP TABLE hydra_oauth2_access; DROP TABLE hydra_oauth2_refresh; DROP TABLE hydra_oauth2_code; DROP TABLE hydra_oauth2_oidc; DROP TABLE hydra_oauth2_pkce;
SQL
hydra/persistence/sql/migrations/20190400000009000000_oauth2.cockroach.up.sql
CREATE TABLE IF NOT EXISTS hydra_oauth2_access ( signature varchar(255) NOT NULL, request_id varchar(40) NOT NULL, requested_at timestamp NOT NULL DEFAULT now(), client_id varchar(255) NOT NULL, scope text NOT NULL, granted_scope text NOT NULL, form_data text NOT NULL, session_data text NOT NULL, subject varch...
SQL
hydra/persistence/sql/migrations/20190400000009000000_oauth2.mysql.down.sql
-- Drops the client_id foreign key ALTER TABLE hydra_oauth2_access DROP FOREIGN KEY hydra_oauth2_access_client_id_fk; ALTER TABLE hydra_oauth2_refresh DROP FOREIGN KEY hydra_oauth2_refresh_client_id_fk; ALTER TABLE hydra_oauth2_code DROP FOREIGN KEY hydra_oauth2_code_client_id_fk; ALTER TABLE hydra_oauth2_oidc DROP FOR...
SQL
hydra/persistence/sql/migrations/20190400000009000000_oauth2.mysql.up.sql
-- First we need to delete all rows that point to a non-existing oauth2 client. DELETE FROM hydra_oauth2_access WHERE NOT EXISTS (SELECT 1 FROM hydra_client WHERE hydra_oauth2_access.client_id = hydra_client.id); DELETE FROM hydra_oauth2_refresh WHERE NOT EXISTS (SELECT 1 FROM hydra_client WHERE hydra_oauth2_refresh.cl...
SQL
hydra/persistence/sql/migrations/20190400000009000000_oauth2.postgres.down.sql
-- Drops the client_id foreign key ALTER TABLE hydra_oauth2_access DROP CONSTRAINT hydra_oauth2_access_client_id_fk; ALTER TABLE hydra_oauth2_refresh DROP CONSTRAINT hydra_oauth2_refresh_client_id_fk; ALTER TABLE hydra_oauth2_code DROP CONSTRAINT hydra_oauth2_code_client_id_fk; ALTER TABLE hydra_oauth2_oidc DROP CONSTR...
SQL
hydra/persistence/sql/migrations/20190400000009000000_oauth2.postgres.up.sql
-- First we need to delete all rows that point to a non-existing oauth2 client. DELETE FROM hydra_oauth2_access WHERE NOT EXISTS (SELECT 1 FROM hydra_client WHERE hydra_oauth2_access.client_id = hydra_client.id); DELETE FROM hydra_oauth2_refresh WHERE NOT EXISTS (SELECT 1 FROM hydra_client WHERE hydra_oauth2_refresh.cl...
SQL
hydra/persistence/sql/migrations/20190400000010000000_oauth2.cockroach.up.sql
-- Empty because CockroachDB creates indices for foreign keys automatically: -- https://www.cockroachlabs.com/docs/stable/foreign-key.html -- +migrate Up
SQL
hydra/persistence/sql/migrations/20190400000010000000_oauth2.mysql.down.sql
ALTER TABLE hydra_oauth2_access DROP FOREIGN KEY hydra_oauth2_access_challenge_id_fk; DROP INDEX hydra_oauth2_access_challenge_id_idx ON hydra_oauth2_access; ALTER TABLE hydra_oauth2_access ADD CONSTRAINT hydra_oauth2_access_challenge_id_fk FOREIGN KEY (challenge_id) REFERENCES hydra_oauth2_consent_request_handled(chal...
SQL
hydra/persistence/sql/migrations/20190400000010000000_oauth2.mysql.up.sql
CREATE INDEX hydra_oauth2_access_challenge_id_idx ON hydra_oauth2_access (challenge_id); CREATE INDEX hydra_oauth2_refresh_challenge_id_idx ON hydra_oauth2_refresh (challenge_id); CREATE INDEX hydra_oauth2_code_challenge_id_idx ON hydra_oauth2_code (challenge_id); CREATE INDEX hydra_oauth2_oidc_challenge_id_idx ON hydr...
SQL
hydra/persistence/sql/migrations/20190400000010000000_oauth2.postgres.down.sql
DROP INDEX hydra_oauth2_access_challenge_id_idx; DROP INDEX hydra_oauth2_refresh_challenge_id_idx; DROP INDEX hydra_oauth2_code_challenge_id_idx; DROP INDEX hydra_oauth2_oidc_challenge_id_idx; DROP INDEX hydra_oauth2_pkce_challenge_id_idx;
SQL
hydra/persistence/sql/migrations/20190400000010000000_oauth2.postgres.up.sql
CREATE INDEX hydra_oauth2_access_challenge_id_idx ON hydra_oauth2_access (challenge_id); CREATE INDEX hydra_oauth2_refresh_challenge_id_idx ON hydra_oauth2_refresh (challenge_id); CREATE INDEX hydra_oauth2_code_challenge_id_idx ON hydra_oauth2_code (challenge_id); CREATE INDEX hydra_oauth2_oidc_challenge_id_idx ON hydr...
SQL
hydra/persistence/sql/migrations/20190400000011000000_oauth2.cockroach.up.sql
CREATE TABLE IF NOT EXISTS hydra_oauth2_jti_blacklist ( signature varchar(64) NOT NULL, expires_at timestamp NOT NULL DEFAULT now(), CONSTRAINT "primary" PRIMARY KEY (signature ASC) ); CREATE INDEX ON hydra_oauth2_jti_blacklist ( expires_at );
SQL
hydra/persistence/sql/migrations/20190400000011000000_oauth2.up.sql
CREATE TABLE IF NOT EXISTS hydra_oauth2_jti_blacklist ( signature varchar(64) NOT NULL PRIMARY KEY, expires_at timestamp NOT NULL DEFAULT now() ); -- mysql requires the index to be named CREATE INDEX hydra_oauth2_jti_blacklist_expiry ON hydra_oauth2_jti_blacklist ( expires_at );
SQL
hydra/persistence/sql/migrations/20200521071434000000_consent.cockroach.up.sql
CREATE INDEX hydra_oauth2_consent_request_client_id_subject_idx ON hydra_oauth2_consent_request (client_id, subject);
SQL
hydra/persistence/sql/migrations/20200521071434000000_consent.mysql.up.sql
CREATE INDEX hydra_oauth2_consent_request_client_id_subject_idx ON hydra_oauth2_consent_request (client_id, subject);
SQL
hydra/persistence/sql/migrations/20200521071434000000_consent.postgres.up.sql
CREATE INDEX hydra_oauth2_consent_request_client_id_subject_idx ON hydra_oauth2_consent_request (client_id, subject);
SQL
hydra/persistence/sql/migrations/20200527215732000000_client.up.sql
-- complement for migration 20200527215731_client.up -- due to cockroach being unable to handle a scheme modification and update statement in a single migration transaction UPDATE hydra_client SET token_endpoint_auth_signing_alg = 'RS256' WHERE token_endpoint_auth_method = 'private_key_jwt';
SQL
hydra/persistence/sql/migrations/20200819163013000000_add_client_id_subject_idx_to_access_and_refresh.cockroach.down.sql
DROP INDEX hydra_oauth2_refresh@hydra_oauth2_refresh_client_id_subject_idx; DROP INDEX hydra_oauth2_access@hydra_oauth2_access_client_id_subject_idx;
SQL
hydra/persistence/sql/migrations/20200819163013000000_add_client_id_subject_idx_to_access_and_refresh.cockroach.up.sql
CREATE INDEX hydra_oauth2_access_client_id_subject_idx ON hydra_oauth2_access (client_id, subject); CREATE INDEX hydra_oauth2_refresh_client_id_subject_idx ON hydra_oauth2_refresh (client_id, subject);
SQL
hydra/persistence/sql/migrations/20200819163013000000_add_client_id_subject_idx_to_access_and_refresh.mysql.down.sql
DROP INDEX hydra_oauth2_refresh_client_id_subject_idx ON hydra_oauth2_refresh; DROP INDEX hydra_oauth2_access_client_id_subject_idx ON hydra_oauth2_access;
SQL
hydra/persistence/sql/migrations/20200819163013000000_add_client_id_subject_idx_to_access_and_refresh.mysql.up.sql
CREATE INDEX hydra_oauth2_access_client_id_subject_idx ON hydra_oauth2_access (client_id, subject); CREATE INDEX hydra_oauth2_refresh_client_id_subject_idx ON hydra_oauth2_refresh (client_id, subject);
SQL
hydra/persistence/sql/migrations/20200819163013000000_add_client_id_subject_idx_to_access_and_refresh.postgres.down.sql
DROP INDEX hydra_oauth2_refresh_client_id_subject_idx; DROP INDEX hydra_oauth2_access_client_id_subject_idx;
SQL
hydra/persistence/sql/migrations/20200819163013000000_add_client_id_subject_idx_to_access_and_refresh.postgres.up.sql
CREATE INDEX hydra_oauth2_access_client_id_subject_idx ON hydra_oauth2_access (client_id, subject); CREATE INDEX hydra_oauth2_refresh_client_id_subject_idx ON hydra_oauth2_refresh (client_id, subject);
SQL
hydra/persistence/sql/migrations/20200913192340000000_initial_sqlite.sqlite.down.sql
DROP TABLE hydra_client; DROP TABLE hydra_jwk; DROP TABLE hydra_oauth2_authentication_session; DROP TABLE hydra_oauth2_authentication_request; DROP TABLE hydra_oauth2_consent_request; DROP TABLE hydra_oauth2_consent_request_handled; DROP TABLE hydra_oauth2_access; DROP TABLE hydra_oauth2_authentication_request_h...
SQL
hydra/persistence/sql/migrations/20200913192340000000_initial_sqlite.sqlite.up.sql
CREATE TABLE IF NOT EXISTS hydra_client ( id VARCHAR(255) NOT NULL, client_name TEXT NOT NULL, client_secret TEXT NOT NULL, redirect_uris TEXT NOT NULL, grant_types ...
SQL
hydra/persistence/sql/migrations/20201110104000000000_drop_uq_oauth2.cockroach.down.sql
DROP INDEX hydra_oauth2_access_request_id_idx; DROP INDEX hydra_oauth2_refresh_request_id_idx; CREATE UNIQUE INDEX hydra_oauth2_access_request_id_idx ON hydra_oauth2_access (request_id); CREATE UNIQUE INDEX hydra_oauth2_refresh_request_id_idx ON hydra_oauth2_refresh (request_id); DROP INDEX hydra_oauth2_code_request_...
SQL
hydra/persistence/sql/migrations/20201110104000000000_drop_uq_oauth2.cockroach.up.sql
--- This is hardcoded and if it fails we need to manually figure out the constraint name: --- SELECT constraint_name FROM information_schema.table_constraints WHERE table_name='hydra_oauth2_access' AND constraint_type='UNIQUE'; DROP INDEX hydra_oauth2_access_request_id_key CASCADE; DROP INDEX hydra_oauth2_refresh_reque...
SQL
hydra/persistence/sql/migrations/20201110104000000000_drop_uq_oauth2.mysql.down.sql
DROP INDEX hydra_oauth2_access_request_id_idx ON hydra_oauth2_access; DROP INDEX hydra_oauth2_refresh_request_id_idx ON hydra_oauth2_refresh; CREATE UNIQUE INDEX hydra_oauth2_access_request_id_idx ON hydra_oauth2_access (request_id); CREATE UNIQUE INDEX hydra_oauth2_refresh_request_id_idx ON hydra_oauth2_refresh (requ...
SQL
hydra/persistence/sql/migrations/20201110104000000000_drop_uq_oauth2.mysql.up.sql
DROP INDEX hydra_oauth2_access_request_id_idx ON hydra_oauth2_access; DROP INDEX hydra_oauth2_refresh_request_id_idx ON hydra_oauth2_refresh; CREATE INDEX hydra_oauth2_access_request_id_idx ON hydra_oauth2_access (request_id); CREATE INDEX hydra_oauth2_refresh_request_id_idx ON hydra_oauth2_refresh (request_id); CREA...
SQL
hydra/persistence/sql/migrations/20201110104000000000_drop_uq_oauth2.postgres.down.sql
DROP INDEX hydra_oauth2_access_request_id_idx; DROP INDEX hydra_oauth2_refresh_request_id_idx; CREATE UNIQUE INDEX hydra_oauth2_access_request_id_idx ON hydra_oauth2_access (request_id); CREATE UNIQUE INDEX hydra_oauth2_refresh_request_id_idx ON hydra_oauth2_refresh (request_id); DROP INDEX hydra_oauth2_code_request_...
SQL
hydra/persistence/sql/migrations/20201110104000000000_drop_uq_oauth2.postgres.up.sql
DROP INDEX hydra_oauth2_access_request_id_idx; DROP INDEX hydra_oauth2_refresh_request_id_idx; CREATE INDEX hydra_oauth2_access_request_id_idx ON hydra_oauth2_access (request_id); CREATE INDEX hydra_oauth2_refresh_request_id_idx ON hydra_oauth2_refresh (request_id); CREATE INDEX hydra_oauth2_code_request_id_idx ON hy...
SQL
hydra/persistence/sql/migrations/20201110104000000000_drop_uq_oauth2.sqlite.down.sql
DROP INDEX hydra_oauth2_access_request_id_idx; DROP INDEX hydra_oauth2_refresh_request_id_idx; DROP INDEX hydra_oauth2_code_request_id_idx; DROP INDEX hydra_oauth2_oidc_request_id_idx; DROP INDEX hydra_oauth2_pkce_request_id_idx; --- CREATE TABLE "_hydra_oauth2_access_tmp" ( signature VARCHAR(255) NOT NU...
SQL
hydra/persistence/sql/migrations/20201110104000000000_drop_uq_oauth2.sqlite.up.sql
CREATE TABLE "_hydra_oauth2_access_tmp" ( signature VARCHAR(255) NOT NULL PRIMARY KEY, 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...
SQL
hydra/persistence/sql/migrations/20201116133000000000_set_null_time.cockroach.down.sql
ALTER TABLE hydra_oauth2_authentication_session ALTER COLUMN authenticated_at SET DEFAULT NOW(); ALTER TABLE hydra_oauth2_authentication_session ALTER COLUMN authenticated_at SET NOT NULL;
SQL
hydra/persistence/sql/migrations/20201116133000000000_set_null_time.cockroach.up.sql
ALTER TABLE hydra_oauth2_authentication_session ALTER COLUMN authenticated_at DROP NOT NULL; ALTER TABLE hydra_oauth2_authentication_session ALTER COLUMN authenticated_at DROP DEFAULT;
SQL
hydra/persistence/sql/migrations/20201116133000000000_set_null_time.mysql.down.sql
ALTER TABLE hydra_oauth2_authentication_session MODIFY authenticated_at timestamp NOT NULL DEFAULT NOW();
SQL
hydra/persistence/sql/migrations/20201116133000000000_set_null_time.postgres.down.sql
ALTER TABLE hydra_oauth2_authentication_session ALTER COLUMN authenticated_at SET DEFAULT NOW(); ALTER TABLE hydra_oauth2_authentication_session ALTER COLUMN authenticated_at SET NOT NULL;
SQL
hydra/persistence/sql/migrations/20201116133000000000_set_null_time.postgres.up.sql
ALTER TABLE hydra_oauth2_authentication_session ALTER COLUMN authenticated_at DROP NOT NULL; ALTER TABLE hydra_oauth2_authentication_session ALTER COLUMN authenticated_at DROP DEFAULT;
SQL
hydra/persistence/sql/migrations/20201116133000000000_set_null_time.sqlite.down.sql
CREATE TABLE "_hydra_oauth2_authentication_session_tmp" ( id VARCHAR(40) NOT NULL PRIMARY KEY, authenticated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, subject VARCHAR(255) NOT NULL, remember INTEGER NOT NULL DEFAULT false ); DELETE FROM hydra_oauth2_authen...
SQL
hydra/persistence/sql/migrations/20201116133000000000_set_null_time.sqlite.up.sql
CREATE TABLE "_hydra_oauth2_authentication_session_tmp" ( id VARCHAR(40) NOT NULL PRIMARY KEY, authenticated_at TIMESTAMP NULL, subject VARCHAR(255) NOT NULL, remember INTEGER NOT NULL DEFAULT false ); INSERT INTO "_hydra_oauth2_authentication_session_tmp" ( ...
SQL
hydra/persistence/sql/migrations/20210928155900000000_support_amr_claim.cockroach.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.cockroach.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.mysql.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.mysql.up.sql
ALTER TABLE hydra_oauth2_consent_request ADD amr TEXT NULL; UPDATE hydra_oauth2_consent_request SET amr=''; ALTER TABLE hydra_oauth2_consent_request MODIFY amr TEXT NOT NULL; ALTER TABLE hydra_oauth2_authentication_request_handled ADD amr TEXT NULL; UPDATE hydra_oauth2_authentication_request_handled SET amr=''; ALTER ...
SQL
hydra/persistence/sql/migrations/20210928155900000000_support_amr_claim.postgres.down.sql
ALTER TABLE hydra_oauth2_consent_request DROP COLUMN amr; ALTER TABLE hydra_oauth2_authentication_request_handled DROP COLUMN amr;