| 1 | CREATE TABLE "jwks" ( |
| 2 | "id" text PRIMARY KEY |
| 3 | "public_key" text NOT NULL |
| 4 | "private_key" text NOT NULL |
| 5 | "created_at" timestamp with time zone NOT NULL |
| 6 | "expires_at" timestamp with time zone, |
| 7 | "alg" text, |
| 8 | "crv" text |
| 9 | ); |
| 10 | --> statement-breakpoint |
| 11 | CREATE TABLE "oauth_access_token" ( |
| 12 | "id" text PRIMARY KEY |
| 13 | "token" text, |
| 14 | "client_id" text NOT NULL |
| 15 | "session_id" text, |
| 16 | "user_id" text, |
| 17 | "reference_id" text, |
| 18 | "authorization_code_id" text, |
| 19 | "resources" text[], |
| 20 | "requested_user_info_claims" text[], |
| 21 | "refresh_id" text, |
| 22 | "expires_at" timestamp with time zone, |
| 23 | "created_at" timestamp with time zone, |
| 24 | "revoked" timestamp with time zone, |
| 25 | "confirmation" jsonb, |
| 26 | "scopes" text[] |
| 27 | CONSTRAINT "oauth_access_token_token_unique" UNIQUE |
| 28 | ); |
| 29 | --> statement-breakpoint |
| 30 | CREATE TABLE "oauth_client" ( |
| 31 | "id" text PRIMARY KEY |
| 32 | "client_id" text NOT NULL |
| 33 | "client_secret" text, |
| 34 | "client_discovery_id" text, |
| 35 | "disabled" boolean DEFAULT |
| 36 | "skip_consent" boolean, |
| 37 | "enable_end_session" boolean, |
| 38 | "subject_type" text, |
| 39 | "scopes" text[], |
| 40 | "client_credentials_scopes" text[] |
| 41 | "user_id" text, |
| 42 | "created_at" timestamp with time zone, |
| 43 | "updated_at" timestamp with time zone, |
| 44 | "name" text, |
| 45 | "uri" text, |
| 46 | "icon" text, |
| 47 | "contacts" text[], |
| 48 | "tos" text, |
| 49 | "policy" text, |
| 50 | "software_id" text, |
| 51 | "software_version" text, |
| 52 | "software_statement" text, |
| 53 | "redirect_uris" text[] |
| 54 | "post_logout_redirect_uris" text[], |
| 55 | "backchannel_logout_uri" text, |
| 56 | "backchannel_logout_session_required" boolean, |
| 57 | "token_endpoint_auth_method" text, |
| 58 | "application_type" text, |
| 59 | "jwks" text, |
| 60 | "jwks_uri" text, |
| 61 | "grant_types" text[], |
| 62 | "response_types" text[], |
| 63 | "require_pkce" boolean, |
| 64 | "dpop_bound_access_tokens" boolean DEFAULT |
| 65 | "reference_id" text, |
| 66 | "metadata" jsonb, |
| 67 | CONSTRAINT "oauth_client_client_id_unique" UNIQUE |
| 68 | ); |
| 69 | --> statement-breakpoint |
| 70 | CREATE TABLE "oauth_client_assertion" ( |
| 71 | "id" text PRIMARY KEY |
| 72 | "expires_at" timestamp with time zone NOT NULL |
| 73 | ); |
| 74 | --> statement-breakpoint |
| 75 | CREATE TABLE "oauth_client_resource" ( |
| 76 | "id" text PRIMARY KEY |
| 77 | "client_id" text NOT NULL |
| 78 | "resource_id" text NOT NULL |
| 79 | "metadata" jsonb, |
| 80 | "created_at" timestamp with time zone |
| 81 | ); |
| 82 | --> statement-breakpoint |
| 83 | CREATE TABLE "oauth_consent" ( |
| 84 | "id" text PRIMARY KEY |
| 85 | "client_id" text NOT NULL |
| 86 | "user_id" text, |
| 87 | "reference_id" text, |
| 88 | "resources" text[], |
| 89 | "requested_user_info_claims" text[], |
| 90 | "scopes" text[] |
| 91 | "created_at" timestamp with time zone, |
| 92 | "updated_at" timestamp with time zone |
| 93 | ); |
| 94 | --> statement-breakpoint |
| 95 | CREATE TABLE "oauth_refresh_token" ( |
| 96 | "id" text PRIMARY KEY |
| 97 | "token" text NOT NULL |
| 98 | "client_id" text NOT NULL |
| 99 | "session_id" text, |
| 100 | "user_id" text NOT NULL |
| 101 | "reference_id" text, |
| 102 | "authorization_code_id" text, |
| 103 | "resources" text[], |
| 104 | "requested_user_info_claims" text[], |
| 105 | "expires_at" timestamp with time zone, |
| 106 | "created_at" timestamp with time zone, |
| 107 | "revoked" timestamp with time zone, |
| 108 | "rotated_at" timestamp with time zone, |
| 109 | "rotation_replay_response" text, |
| 110 | "rotation_replay_expires_at" timestamp with time zone, |
| 111 | "auth_time" timestamp with time zone, |
| 112 | "confirmation" jsonb, |
| 113 | "scopes" text[] |
| 114 | CONSTRAINT "oauth_refresh_token_token_unique" UNIQUE |
| 115 | ); |
| 116 | --> statement-breakpoint |
| 117 | CREATE TABLE "oauth_resource" ( |
| 118 | "id" text PRIMARY KEY |
| 119 | "identifier" text NOT NULL |
| 120 | "name" text NOT NULL |
| 121 | "access_token_ttl" integer, |
| 122 | "refresh_token_ttl" integer, |
| 123 | "signing_algorithm" text, |
| 124 | "signing_key_id" text, |
| 125 | "allowed_scopes" text[], |
| 126 | "custom_claims" jsonb, |
| 127 | "dpop_bound_access_tokens_required" boolean DEFAULT |
| 128 | "disabled" boolean DEFAULT |
| 129 | "created_at" timestamp with time zone, |
| 130 | "updated_at" timestamp with time zone, |
| 131 | "policy_version" integer DEFAULT |
| 132 | "metadata" jsonb, |
| 133 | CONSTRAINT "oauth_resource_identifier_unique" UNIQUE |
| 134 | ); |
| 135 | --> statement-breakpoint |
| 136 | ALTER TABLE "oauth_access_token" ADD |
| 137 | ALTER TABLE "oauth_access_token" ADD |
| 138 | ALTER TABLE "oauth_access_token" ADD |
| 139 | ALTER TABLE "oauth_access_token" ADD |
| 140 | ALTER TABLE "oauth_client" ADD |
| 141 | ALTER TABLE "oauth_client_resource" ADD |
| 142 | ALTER TABLE "oauth_client_resource" ADD |
| 143 | ALTER TABLE "oauth_consent" ADD |
| 144 | ALTER TABLE "oauth_consent" ADD |
| 145 | ALTER TABLE "oauth_refresh_token" ADD |
| 146 | ALTER TABLE "oauth_refresh_token" ADD |
| 147 | ALTER TABLE "oauth_refresh_token" ADD |
| 148 | CREATE INDEX "oauth_access_token_client_id_idx" ON |
| 149 | CREATE INDEX "oauth_access_token_session_id_idx" ON |
| 150 | CREATE INDEX "oauth_access_token_user_id_idx" ON |
| 151 | CREATE INDEX "oauth_access_token_authorization_code_id_idx" ON |
| 152 | CREATE INDEX "oauth_access_token_refresh_id_idx" ON |
| 153 | CREATE INDEX "oauth_client_user_id_idx" ON |
| 154 | CREATE INDEX "oauth_client_resource_client_id_idx" ON |
| 155 | CREATE INDEX "oauth_client_resource_resource_id_idx" ON |
| 156 | CREATE INDEX "oauth_consent_client_id_idx" ON |
| 157 | CREATE INDEX "oauth_consent_user_id_idx" ON |
| 158 | CREATE INDEX "oauth_refresh_token_client_id_idx" ON |
| 159 | CREATE INDEX "oauth_refresh_token_session_id_idx" ON |
| 160 | CREATE INDEX "oauth_refresh_token_user_id_idx" ON |
| 161 | CREATE INDEX "oauth_refresh_token_authorization_code_id_idx" ON |