1791331200_redirect_uri_kind.sql 674 B

12345678910111213
  1. -- Distinguish authorization-response redirect URIs from post-logout return
  2. -- URIs in the shared catalog. Both kinds use the same exact-match + RFC 8252
  3. -- loopback validation, so they live in one table rather than a parallel one.
  4. --
  5. -- Existing rows predate post-logout support and are all authorization-response
  6. -- URIs, so they backfill to 'authorize' via the column default.
  7. ALTER TABLE redirect_uris
  8. ADD COLUMN kind text NOT NULL DEFAULT 'authorize';
  9. ALTER TABLE redirect_uris
  10. DROP CONSTRAINT ux_redirect_uris_uri,
  11. ADD CONSTRAINT ux_redirect_uris_uri_kind UNIQUE (uri, kind),
  12. ADD CONSTRAINT ck_redirect_uris_kind CHECK (kind IN ('authorize', 'post_logout'));