ory-am/hydra

View on GitHub
persistence/sql/migrations/20230908104443000000_change_client_pk.sqlite.up.sql

Summary

Maintainability
Test Coverage
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                                              TEXT         NULL,
  pk_deprecated                                   INTEGER NULL DEFAULT NULL,
  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 '',
  registration_access_token_signature             VARCHAR(128) NOT NULL DEFAULT '',
  access_token_strategy                           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,
  skip_consent                                    BOOLEAN      NOT NULL DEFAULT false,
  nid                                             CHAR(36)     NOT NULL,
  PRIMARY KEY (id, nid)
);
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,
                                 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,
                                 registration_access_token_signature,
                                 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,
                                 skip_consent,
                                 nid)
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,
       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,
       registration_access_token_signature,
       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,
       skip_consent,
       nid
FROM "hydra_client";
DROP TABLE "hydra_client";
ALTER TABLE "_hydra_client_tmp" RENAME TO "hydra_client";