diff --git a/authentication/src/app/service-worker.ts b/authentication/src/app/service-worker.ts index b9741f4..0538ba3 100644 --- a/authentication/src/app/service-worker.ts +++ b/authentication/src/app/service-worker.ts @@ -1,24 +1,18 @@ +import type { PrecacheEntry } from '@serwist/precaching'; +import { installSerwist } from '@serwist/sw'; import { defaultCache } from '@serwist/next/worker'; -import type { PrecacheEntry, SerwistGlobalConfig } from 'serwist'; -import { Serwist } from 'serwist'; -declare const self: ServiceWorkerGlobalScope; +declare const self: ServiceWorkerGlobalScope & { + // Change this attribute's name to your `injectionPoint`. + // `injectionPoint` is an InjectManifest option. + // See https://serwist.pages.dev/docs/build/inject-manifest/configuring + __SW_MANIFEST: (PrecacheEntry | string)[] | undefined; +}; -declare global { - interface WorkerGlobalScope extends SerwistGlobalConfig { - // Change this attribute's name to your `injectionPoint`. - // `injectionPoint` is an InjectManifest option. - // See https://serwist.pages.dev/docs/build/configuring - __SW_MANIFEST: (PrecacheEntry | string)[] | undefined; - } -} - -const serwist = new Serwist({ +installSerwist({ precacheEntries: self.__SW_MANIFEST, skipWaiting: true, clientsClaim: true, navigationPreload: true, runtimeCaching: defaultCache, }); - -serwist.addEventListeners(); diff --git a/dashboard/.env.example b/dashboard/.env.example index 07958f8..0890e33 100644 --- a/dashboard/.env.example +++ b/dashboard/.env.example @@ -1,12 +1,8 @@ -DATABASE_URL=postgresql://postgres:postgres@localhost:5432/kratos - ORY_KRATOS_ADMIN_URL=http://localhost:4434 ORY_HYDRA_ADMIN_URL=http://localhost:4445 -ORY_KETO_ADMIN_URL=http://localhost:4467 NEXT_PUBLIC_ORY_KRATOS_URL=http://localhost:4433 -NEXT_PUBLIC_ORY_KETO_URL=http://localhost:4466 NEXT_PUBLIC_AUTHENTICATION_NODE_URL=http://localhost:3000 NEXT_PUBLIC_DASHBOARD_NODE_URL=http://localhost:4000 diff --git a/dashboard/bun.lockb b/dashboard/bun.lockb index 457965a..af3b2c6 100755 Binary files a/dashboard/bun.lockb and b/dashboard/bun.lockb differ diff --git a/dashboard/drizzle.config.ts b/dashboard/drizzle.config.ts deleted file mode 100644 index 21ed5ad..0000000 --- a/dashboard/drizzle.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -'use server'; - -import 'dotenv/config'; -import { defineConfig } from 'drizzle-kit'; - - -export default defineConfig({ - out: './drizzle', - schema: './src/db/schema.ts', - dialect: 'postgresql', - dbCredentials: { - url: process.env.DATABASE_URL!, - }, -}); diff --git a/dashboard/drizzle/0000_square_moondragon.sql b/dashboard/drizzle/0000_square_moondragon.sql deleted file mode 100644 index 5400fe7..0000000 --- a/dashboard/drizzle/0000_square_moondragon.sql +++ /dev/null @@ -1,484 +0,0 @@ --- Current sql file was generated after introspecting the database --- If you want to run this migration please uncomment this code before executing migrations -/* -CREATE TABLE "schema_migration" ( - "version" varchar(48) NOT NULL, - "version_self" integer DEFAULT 0 NOT NULL -); ---> statement-breakpoint -CREATE TABLE "identity_credentials" ( - "id" uuid PRIMARY KEY NOT NULL, - "config" jsonb NOT NULL, - "identity_credential_type_id" uuid NOT NULL, - "identity_id" uuid NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "nid" uuid, - "version" integer DEFAULT 0 NOT NULL -); ---> statement-breakpoint -CREATE TABLE "identity_credential_types" ( - "id" uuid PRIMARY KEY NOT NULL, - "name" varchar(32) NOT NULL -); ---> statement-breakpoint -CREATE TABLE "selfservice_login_flows" ( - "id" uuid PRIMARY KEY NOT NULL, - "request_url" text NOT NULL, - "issued_at" timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, - "expires_at" timestamp NOT NULL, - "active_method" varchar(32) NOT NULL, - "csrf_token" varchar(255) NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "forced" boolean DEFAULT false NOT NULL, - "type" varchar(16) DEFAULT 'browser' NOT NULL, - "ui" jsonb, - "nid" uuid, - "requested_aal" varchar(4) DEFAULT 'aal1' NOT NULL, - "internal_context" jsonb NOT NULL, - "oauth2_login_challenge" uuid, - "oauth2_login_challenge_data" text, - "state" varchar(255), - "submit_count" integer DEFAULT 0 NOT NULL, - "organization_id" uuid -); ---> statement-breakpoint -CREATE TABLE "networks" ( - "id" uuid PRIMARY KEY NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL -); ---> statement-breakpoint -CREATE TABLE "selfservice_registration_flows" ( - "id" uuid PRIMARY KEY NOT NULL, - "request_url" text NOT NULL, - "issued_at" timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, - "expires_at" timestamp NOT NULL, - "active_method" varchar(32) NOT NULL, - "csrf_token" varchar(255) NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "type" varchar(16) DEFAULT 'browser' NOT NULL, - "ui" jsonb, - "nid" uuid, - "internal_context" jsonb NOT NULL, - "oauth2_login_challenge" uuid, - "oauth2_login_challenge_data" text, - "state" varchar(255), - "submit_count" integer DEFAULT 0 NOT NULL, - "organization_id" uuid -); ---> statement-breakpoint -CREATE TABLE "identities" ( - "id" uuid PRIMARY KEY NOT NULL, - "schema_id" varchar(2048) NOT NULL, - "traits" jsonb NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "nid" uuid, - "state" varchar(255) DEFAULT 'active' NOT NULL, - "state_changed_at" timestamp, - "metadata_public" jsonb, - "metadata_admin" jsonb, - "available_aal" varchar(4), - "organization_id" uuid -); ---> statement-breakpoint -CREATE TABLE "identity_credential_identifiers" ( - "id" uuid PRIMARY KEY NOT NULL, - "identifier" varchar(255) NOT NULL, - "identity_credential_id" uuid NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "nid" uuid, - "identity_credential_type_id" uuid NOT NULL -); ---> statement-breakpoint -CREATE TABLE "identity_verifiable_addresses" ( - "id" uuid PRIMARY KEY NOT NULL, - "status" varchar(16) NOT NULL, - "via" varchar(16) NOT NULL, - "verified" boolean NOT NULL, - "value" varchar(400) NOT NULL, - "verified_at" timestamp, - "identity_id" uuid NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "nid" uuid -); ---> statement-breakpoint -CREATE TABLE "courier_messages" ( - "id" uuid PRIMARY KEY NOT NULL, - "type" integer NOT NULL, - "status" integer NOT NULL, - "body" text NOT NULL, - "subject" varchar(255) NOT NULL, - "recipient" varchar(255) NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "template_type" varchar(255) DEFAULT '' NOT NULL, - "template_data" "bytea", - "nid" uuid, - "send_count" integer DEFAULT 0 NOT NULL, - "channel" varchar(32) -); ---> statement-breakpoint -CREATE TABLE "selfservice_errors" ( - "id" uuid PRIMARY KEY NOT NULL, - "errors" jsonb NOT NULL, - "seen_at" timestamp, - "was_seen" boolean NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "csrf_token" varchar(255) DEFAULT '' NOT NULL, - "nid" uuid -); ---> statement-breakpoint -CREATE TABLE "selfservice_verification_flows" ( - "id" uuid PRIMARY KEY NOT NULL, - "request_url" text NOT NULL, - "issued_at" timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, - "expires_at" timestamp NOT NULL, - "csrf_token" varchar(255) NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "type" varchar(16) DEFAULT 'browser' NOT NULL, - "state" varchar(255) DEFAULT 'show_form' NOT NULL, - "active_method" varchar(32), - "ui" jsonb, - "nid" uuid, - "submit_count" integer DEFAULT 0 NOT NULL, - "oauth2_login_challenge" text, - "session_id" uuid, - "identity_id" uuid, - "authentication_methods" json -); ---> statement-breakpoint -CREATE TABLE "selfservice_settings_flows" ( - "id" uuid PRIMARY KEY NOT NULL, - "request_url" text NOT NULL, - "issued_at" timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, - "expires_at" timestamp NOT NULL, - "identity_id" uuid NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "active_method" varchar(32), - "state" varchar(255) DEFAULT 'show_form' NOT NULL, - "type" varchar(16) DEFAULT 'browser' NOT NULL, - "ui" jsonb, - "nid" uuid, - "internal_context" jsonb NOT NULL -); ---> statement-breakpoint -CREATE TABLE "continuity_containers" ( - "id" uuid PRIMARY KEY NOT NULL, - "identity_id" uuid, - "name" varchar(255) NOT NULL, - "payload" jsonb, - "expires_at" timestamp NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "nid" uuid -); ---> statement-breakpoint -CREATE TABLE "sessions" ( - "id" uuid PRIMARY KEY NOT NULL, - "issued_at" timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, - "expires_at" timestamp NOT NULL, - "authenticated_at" timestamp NOT NULL, - "identity_id" uuid NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "token" varchar(39), - "active" boolean DEFAULT false, - "nid" uuid, - "logout_token" varchar(39), - "aal" varchar(4) DEFAULT 'aal1' NOT NULL, - "authentication_methods" jsonb NOT NULL -); ---> statement-breakpoint -CREATE TABLE "identity_recovery_addresses" ( - "id" uuid PRIMARY KEY NOT NULL, - "via" varchar(16) NOT NULL, - "value" varchar(400) NOT NULL, - "identity_id" uuid NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "nid" uuid -); ---> statement-breakpoint -CREATE TABLE "identity_verification_tokens" ( - "id" uuid PRIMARY KEY NOT NULL, - "token" varchar(64) NOT NULL, - "used" boolean DEFAULT false NOT NULL, - "used_at" timestamp, - "expires_at" timestamp NOT NULL, - "issued_at" timestamp NOT NULL, - "identity_verifiable_address_id" uuid NOT NULL, - "selfservice_verification_flow_id" uuid NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "nid" uuid -); ---> statement-breakpoint -CREATE TABLE "selfservice_recovery_flows" ( - "id" uuid PRIMARY KEY NOT NULL, - "request_url" text NOT NULL, - "issued_at" timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, - "expires_at" timestamp NOT NULL, - "active_method" varchar(32), - "csrf_token" varchar(255) NOT NULL, - "state" varchar(32) NOT NULL, - "recovered_identity_id" uuid, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "type" varchar(16) DEFAULT 'browser' NOT NULL, - "ui" jsonb, - "nid" uuid, - "submit_count" integer DEFAULT 0 NOT NULL, - "skip_csrf_check" boolean DEFAULT false NOT NULL -); ---> statement-breakpoint -CREATE TABLE "identity_recovery_tokens" ( - "id" uuid PRIMARY KEY NOT NULL, - "token" varchar(64) NOT NULL, - "used" boolean DEFAULT false NOT NULL, - "used_at" timestamp, - "identity_recovery_address_id" uuid, - "selfservice_recovery_flow_id" uuid, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "expires_at" timestamp DEFAULT '2000-01-01 00:00:00' NOT NULL, - "issued_at" timestamp DEFAULT '2000-01-01 00:00:00' NOT NULL, - "nid" uuid, - "identity_id" uuid NOT NULL, - "token_type" integer DEFAULT 0 NOT NULL, - CONSTRAINT "identity_recovery_tokens_token_type_ck" CHECK ((token_type = 1) OR (token_type = 2)) -); ---> statement-breakpoint -CREATE TABLE "identity_recovery_codes" ( - "id" uuid PRIMARY KEY NOT NULL, - "code" varchar(64) NOT NULL, - "used_at" timestamp, - "identity_recovery_address_id" uuid, - "code_type" integer NOT NULL, - "expires_at" timestamp DEFAULT '2000-01-01 00:00:00' NOT NULL, - "issued_at" timestamp DEFAULT '2000-01-01 00:00:00' NOT NULL, - "selfservice_recovery_flow_id" uuid NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "nid" uuid NOT NULL, - "identity_id" uuid NOT NULL -); ---> statement-breakpoint -CREATE TABLE "session_devices" ( - "id" uuid PRIMARY KEY NOT NULL, - "ip_address" varchar(50) DEFAULT '', - "user_agent" varchar(512) DEFAULT '', - "location" varchar(512) DEFAULT '', - "nid" uuid NOT NULL, - "session_id" uuid NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - CONSTRAINT "unique_session_device" UNIQUE("ip_address","user_agent","nid","session_id") -); ---> statement-breakpoint -CREATE TABLE "identity_verification_codes" ( - "id" uuid PRIMARY KEY NOT NULL, - "code_hmac" varchar(64) NOT NULL, - "used_at" timestamp, - "identity_verifiable_address_id" uuid, - "expires_at" timestamp DEFAULT '2000-01-01 00:00:00' NOT NULL, - "issued_at" timestamp DEFAULT '2000-01-01 00:00:00' NOT NULL, - "selfservice_verification_flow_id" uuid NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL, - "nid" uuid NOT NULL -); ---> statement-breakpoint -CREATE TABLE "courier_message_dispatches" ( - "id" uuid PRIMARY KEY NOT NULL, - "message_id" uuid NOT NULL, - "status" varchar(7) NOT NULL, - "error" json, - "nid" uuid NOT NULL, - "created_at" timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL -); ---> statement-breakpoint -CREATE TABLE "session_token_exchanges" ( - "id" uuid PRIMARY KEY NOT NULL, - "nid" uuid NOT NULL, - "flow_id" uuid NOT NULL, - "session_id" uuid, - "init_code" varchar(64) NOT NULL, - "return_to_code" varchar(64) NOT NULL, - "created_at" timestamp NOT NULL, - "updated_at" timestamp NOT NULL -); ---> statement-breakpoint -CREATE TABLE "identity_login_codes" ( - "id" uuid PRIMARY KEY NOT NULL, - "code" varchar(64) NOT NULL, - "address" varchar(255) NOT NULL, - "address_type" char(36) NOT NULL, - "used_at" timestamp, - "expires_at" timestamp DEFAULT '2000-01-01 00:00:00' NOT NULL, - "issued_at" timestamp DEFAULT '2000-01-01 00:00:00' NOT NULL, - "selfservice_login_flow_id" uuid NOT NULL, - "identity_id" uuid NOT NULL, - "created_at" timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, - "nid" uuid NOT NULL -); ---> statement-breakpoint -CREATE TABLE "identity_registration_codes" ( - "id" uuid PRIMARY KEY NOT NULL, - "code" varchar(64) NOT NULL, - "address" varchar(255) NOT NULL, - "address_type" char(36) NOT NULL, - "used_at" timestamp, - "expires_at" timestamp DEFAULT '2000-01-01 00:00:00' NOT NULL, - "issued_at" timestamp DEFAULT '2000-01-01 00:00:00' NOT NULL, - "selfservice_registration_flow_id" uuid NOT NULL, - "created_at" timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, - "updated_at" timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, - "nid" uuid NOT NULL -); ---> statement-breakpoint -ALTER TABLE "identity_credentials" ADD CONSTRAINT "identity_credentials_identity_id_fkey" FOREIGN KEY ("identity_id") REFERENCES "public"."identities"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "identity_credentials" ADD CONSTRAINT "identity_credentials_identity_credential_type_id_fkey" FOREIGN KEY ("identity_credential_type_id") REFERENCES "public"."identity_credential_types"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "identity_credentials" ADD CONSTRAINT "identity_credentials_nid_fk_idx" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "selfservice_login_flows" ADD CONSTRAINT "selfservice_login_flows_nid_fk_idx" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "selfservice_registration_flows" ADD CONSTRAINT "selfservice_registration_flows_nid_fk_idx" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "identities" ADD CONSTRAINT "identities_nid_fk_idx" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "identity_credential_identifiers" ADD CONSTRAINT "identity_credential_identifiers_identity_credential_id_fkey" FOREIGN KEY ("identity_credential_id") REFERENCES "public"."identity_credentials"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "identity_credential_identifiers" ADD CONSTRAINT "identity_credential_identifiers_nid_fk_idx" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "identity_credential_identifiers" ADD CONSTRAINT "identity_credential_identifiers_type_id_fk_idx" FOREIGN KEY ("identity_credential_type_id") REFERENCES "public"."identity_credential_types"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "identity_verifiable_addresses" ADD CONSTRAINT "identity_verifiable_addresses_identity_id_fkey" FOREIGN KEY ("identity_id") REFERENCES "public"."identities"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "identity_verifiable_addresses" ADD CONSTRAINT "identity_verifiable_addresses_nid_fk_idx" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "courier_messages" ADD CONSTRAINT "courier_messages_nid_fk_idx" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "selfservice_errors" ADD CONSTRAINT "selfservice_errors_nid_fk_idx" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "selfservice_verification_flows" ADD CONSTRAINT "selfservice_verification_flows_nid_fk_idx" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "selfservice_settings_flows" ADD CONSTRAINT "selfservice_profile_management_requests_identity_id_fkey" FOREIGN KEY ("identity_id") REFERENCES "public"."identities"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "selfservice_settings_flows" ADD CONSTRAINT "selfservice_settings_flows_nid_fk_idx" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "continuity_containers" ADD CONSTRAINT "continuity_containers_identity_id_fkey" FOREIGN KEY ("identity_id") REFERENCES "public"."identities"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "continuity_containers" ADD CONSTRAINT "continuity_containers_nid_fk_idx" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "sessions" ADD CONSTRAINT "sessions_identity_id_fkey" FOREIGN KEY ("identity_id") REFERENCES "public"."identities"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "sessions" ADD CONSTRAINT "sessions_nid_fk_idx" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "identity_recovery_addresses" ADD CONSTRAINT "identity_recovery_addresses_identity_id_fkey" FOREIGN KEY ("identity_id") REFERENCES "public"."identities"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "identity_recovery_addresses" ADD CONSTRAINT "identity_recovery_addresses_nid_fk_idx" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "identity_verification_tokens" ADD CONSTRAINT "identity_verification_tokens_identity_verifiable_address_i_fkey" FOREIGN KEY ("identity_verifiable_address_id") REFERENCES "public"."identity_verifiable_addresses"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "identity_verification_tokens" ADD CONSTRAINT "identity_verification_tokens_selfservice_verification_flow_fkey" FOREIGN KEY ("selfservice_verification_flow_id") REFERENCES "public"."selfservice_verification_flows"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "identity_verification_tokens" ADD CONSTRAINT "identity_verification_tokens_nid_fk_idx" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "selfservice_recovery_flows" ADD CONSTRAINT "selfservice_recovery_requests_recovered_identity_id_fkey" FOREIGN KEY ("recovered_identity_id") REFERENCES "public"."identities"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "selfservice_recovery_flows" ADD CONSTRAINT "selfservice_recovery_flows_nid_fk_idx" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "identity_recovery_tokens" ADD CONSTRAINT "identity_recovery_tokens_selfservice_recovery_request_id_fkey" FOREIGN KEY ("selfservice_recovery_flow_id") REFERENCES "public"."selfservice_recovery_flows"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "identity_recovery_tokens" ADD CONSTRAINT "identity_recovery_tokens_nid_fk_idx" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "identity_recovery_tokens" ADD CONSTRAINT "identity_recovery_tokens_identity_recovery_address_id_fkey" FOREIGN KEY ("identity_recovery_address_id") REFERENCES "public"."identity_recovery_addresses"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "identity_recovery_tokens" ADD CONSTRAINT "identity_recovery_tokens_identity_id_fk_idx" FOREIGN KEY ("identity_id") REFERENCES "public"."identities"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "identity_recovery_codes" ADD CONSTRAINT "identity_recovery_codes_identity_recovery_addresses_id_fk" FOREIGN KEY ("identity_recovery_address_id") REFERENCES "public"."identity_recovery_addresses"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "identity_recovery_codes" ADD CONSTRAINT "identity_recovery_codes_selfservice_recovery_flows_id_fk" FOREIGN KEY ("selfservice_recovery_flow_id") REFERENCES "public"."selfservice_recovery_flows"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "identity_recovery_codes" ADD CONSTRAINT "identity_recovery_codes_identity_id_fk" FOREIGN KEY ("identity_id") REFERENCES "public"."identities"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "identity_recovery_codes" ADD CONSTRAINT "identity_recovery_codes_networks_id_fk" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "session_devices" ADD CONSTRAINT "session_metadata_sessions_id_fk" FOREIGN KEY ("session_id") REFERENCES "public"."sessions"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "session_devices" ADD CONSTRAINT "session_metadata_nid_fk" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "identity_verification_codes" ADD CONSTRAINT "identity_verification_codes_identity_verifiable_addresses_id_fk" FOREIGN KEY ("identity_verifiable_address_id") REFERENCES "public"."identity_verifiable_addresses"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "identity_verification_codes" ADD CONSTRAINT "identity_verification_codes_selfservice_verification_flows_id_f" FOREIGN KEY ("selfservice_verification_flow_id") REFERENCES "public"."selfservice_verification_flows"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "identity_verification_codes" ADD CONSTRAINT "identity_verification_codes_networks_id_fk" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "courier_message_dispatches" ADD CONSTRAINT "courier_message_dispatches_message_id_fk" FOREIGN KEY ("message_id") REFERENCES "public"."courier_messages"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "courier_message_dispatches" ADD CONSTRAINT "courier_message_dispatches_nid_fk" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "identity_login_codes" ADD CONSTRAINT "identity_login_codes_selfservice_login_flows_id_fk" FOREIGN KEY ("selfservice_login_flow_id") REFERENCES "public"."selfservice_login_flows"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "identity_login_codes" ADD CONSTRAINT "identity_login_codes_networks_id_fk" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "identity_login_codes" ADD CONSTRAINT "identity_login_codes_identity_id_fk" FOREIGN KEY ("identity_id") REFERENCES "public"."identities"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -ALTER TABLE "identity_registration_codes" ADD CONSTRAINT "identity_registration_codes_selfservice_registration_flows_id_f" FOREIGN KEY ("selfservice_registration_flow_id") REFERENCES "public"."selfservice_registration_flows"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "identity_registration_codes" ADD CONSTRAINT "identity_registration_codes_networks_id_fk" FOREIGN KEY ("nid") REFERENCES "public"."networks"("id") ON DELETE cascade ON UPDATE restrict;--> statement-breakpoint -CREATE UNIQUE INDEX "schema_migration_version_idx" ON "schema_migration" USING btree ("version" text_ops);--> statement-breakpoint -CREATE INDEX "schema_migration_version_self_idx" ON "schema_migration" USING btree ("version_self" int4_ops);--> statement-breakpoint -CREATE INDEX "identity_credentials_id_nid_idx" ON "identity_credentials" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_credentials_nid_id_idx" ON "identity_credentials" USING btree ("nid" uuid_ops,"id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_credentials_nid_identity_id_idx" ON "identity_credentials" USING btree ("identity_id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE UNIQUE INDEX "identity_credential_types_name_idx" ON "identity_credential_types" USING btree ("name" text_ops);--> statement-breakpoint -CREATE INDEX "selfservice_login_flows_id_nid_idx" ON "selfservice_login_flows" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "selfservice_login_flows_nid_id_idx" ON "selfservice_login_flows" USING btree ("nid" uuid_ops,"id" uuid_ops);--> statement-breakpoint -CREATE INDEX "selfservice_registration_flows_id_nid_idx" ON "selfservice_registration_flows" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "selfservice_registration_flows_nid_id_idx" ON "selfservice_registration_flows" USING btree ("nid" uuid_ops,"id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identities_id_nid_idx" ON "identities" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identities_nid_id_idx" ON "identities" USING btree ("nid" uuid_ops,"id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_credential_identifiers_id_nid_idx" ON "identity_credential_identifiers" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE UNIQUE INDEX "identity_credential_identifiers_identifier_nid_type_uq_idx" ON "identity_credential_identifiers" USING btree ("nid" uuid_ops,"identity_credential_type_id" uuid_ops,"identifier" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_credential_identifiers_nid_i_ici_idx" ON "identity_credential_identifiers" USING btree ("nid" text_ops,"identifier" text_ops,"identity_credential_id" text_ops);--> statement-breakpoint -CREATE INDEX "identity_credential_identifiers_nid_id_idx" ON "identity_credential_identifiers" USING btree ("nid" uuid_ops,"id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_credential_identifiers_nid_identity_credential_id_idx" ON "identity_credential_identifiers" USING btree ("identity_credential_id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_verifiable_addresses_id_nid_idx" ON "identity_verifiable_addresses" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_verifiable_addresses_nid_id_idx" ON "identity_verifiable_addresses" USING btree ("nid" uuid_ops,"id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_verifiable_addresses_nid_identity_id_idx" ON "identity_verifiable_addresses" USING btree ("identity_id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_verifiable_addresses_status_via_idx" ON "identity_verifiable_addresses" USING btree ("nid" text_ops,"via" text_ops,"value" text_ops);--> statement-breakpoint -CREATE UNIQUE INDEX "identity_verifiable_addresses_status_via_uq_idx" ON "identity_verifiable_addresses" USING btree ("nid" text_ops,"via" text_ops,"value" uuid_ops);--> statement-breakpoint -CREATE INDEX "courier_messages_id_nid_idx" ON "courier_messages" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "courier_messages_nid_created_at_id_idx" ON "courier_messages" USING btree ("nid" timestamp_ops,"created_at" uuid_ops);--> statement-breakpoint -CREATE INDEX "courier_messages_nid_id_idx" ON "courier_messages" USING btree ("nid" uuid_ops,"id" uuid_ops);--> statement-breakpoint -CREATE INDEX "courier_messages_nid_recipient_created_at_id_idx" ON "courier_messages" USING btree ("nid" timestamp_ops,"recipient" text_ops,"created_at" uuid_ops);--> statement-breakpoint -CREATE INDEX "courier_messages_nid_status_created_at_id_idx" ON "courier_messages" USING btree ("nid" uuid_ops,"status" timestamp_ops,"created_at" uuid_ops);--> statement-breakpoint -CREATE INDEX "courier_messages_status_idx" ON "courier_messages" USING btree ("status" int4_ops);--> statement-breakpoint -CREATE INDEX "selfservice_errors_errors_nid_id_idx" ON "selfservice_errors" USING btree ("nid" uuid_ops,"id" uuid_ops);--> statement-breakpoint -CREATE INDEX "selfservice_verification_flows_id_nid_idx" ON "selfservice_verification_flows" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "selfservice_verification_flows_nid_id_idx" ON "selfservice_verification_flows" USING btree ("nid" uuid_ops,"id" uuid_ops);--> statement-breakpoint -CREATE INDEX "selfservice_settings_flows_id_nid_idx" ON "selfservice_settings_flows" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "selfservice_settings_flows_identity_id_nid_idx" ON "selfservice_settings_flows" USING btree ("identity_id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "selfservice_settings_flows_nid_id_idx" ON "selfservice_settings_flows" USING btree ("nid" uuid_ops,"id" uuid_ops);--> statement-breakpoint -CREATE INDEX "continuity_containers_id_nid_idx" ON "continuity_containers" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "continuity_containers_identity_id_nid_idx" ON "continuity_containers" USING btree ("identity_id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "continuity_containers_nid_id_idx" ON "continuity_containers" USING btree ("nid" uuid_ops,"id" uuid_ops);--> statement-breakpoint -CREATE INDEX "sessions_id_nid_idx" ON "sessions" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "sessions_identity_id_nid_sorted_idx" ON "sessions" USING btree ("identity_id" timestamp_ops,"nid" timestamp_ops,"authenticated_at" uuid_ops);--> statement-breakpoint -CREATE UNIQUE INDEX "sessions_logout_token_uq_idx" ON "sessions" USING btree ("logout_token" text_ops);--> statement-breakpoint -CREATE INDEX "sessions_nid_created_at_id_idx" ON "sessions" USING btree ("nid" uuid_ops,"created_at" uuid_ops,"id" uuid_ops);--> statement-breakpoint -CREATE INDEX "sessions_nid_id_identity_id_idx" ON "sessions" USING btree ("nid" uuid_ops,"identity_id" uuid_ops,"id" uuid_ops);--> statement-breakpoint -CREATE INDEX "sessions_token_nid_idx" ON "sessions" USING btree ("nid" uuid_ops,"token" text_ops);--> statement-breakpoint -CREATE UNIQUE INDEX "sessions_token_uq_idx" ON "sessions" USING btree ("token" text_ops);--> statement-breakpoint -CREATE INDEX "identity_recovery_addresses_id_nid_idx" ON "identity_recovery_addresses" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_recovery_addresses_nid_id_idx" ON "identity_recovery_addresses" USING btree ("nid" uuid_ops,"id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_recovery_addresses_nid_identity_id_idx" ON "identity_recovery_addresses" USING btree ("identity_id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_recovery_addresses_status_via_idx" ON "identity_recovery_addresses" USING btree ("nid" text_ops,"via" text_ops,"value" text_ops);--> statement-breakpoint -CREATE UNIQUE INDEX "identity_recovery_addresses_status_via_uq_idx" ON "identity_recovery_addresses" USING btree ("nid" text_ops,"via" text_ops,"value" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_verification_tokens_id_nid_idx" ON "identity_verification_tokens" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_verification_tokens_nid_id_idx" ON "identity_verification_tokens" USING btree ("nid" uuid_ops,"id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_verification_tokens_token_nid_used_flow_id_idx" ON "identity_verification_tokens" USING btree ("nid" uuid_ops,"token" bool_ops,"used" text_ops,"selfservice_verification_flow_id" uuid_ops);--> statement-breakpoint -CREATE UNIQUE INDEX "identity_verification_tokens_token_uq_idx" ON "identity_verification_tokens" USING btree ("token" text_ops);--> statement-breakpoint -CREATE INDEX "identity_verification_tokens_verifiable_address_id_idx" ON "identity_verification_tokens" USING btree ("identity_verifiable_address_id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_verification_tokens_verification_flow_id_idx" ON "identity_verification_tokens" USING btree ("selfservice_verification_flow_id" uuid_ops);--> statement-breakpoint -CREATE INDEX "selfservice_recovery_flows_id_nid_idx" ON "selfservice_recovery_flows" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "selfservice_recovery_flows_nid_id_idx" ON "selfservice_recovery_flows" USING btree ("nid" uuid_ops,"id" uuid_ops);--> statement-breakpoint -CREATE INDEX "selfservice_recovery_flows_recovered_identity_id_nid_idx" ON "selfservice_recovery_flows" USING btree ("recovered_identity_id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE UNIQUE INDEX "identity_recovery_addresses_code_uq_idx" ON "identity_recovery_tokens" USING btree ("token" text_ops);--> statement-breakpoint -CREATE INDEX "identity_recovery_tokens_id_nid_idx" ON "identity_recovery_tokens" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_recovery_tokens_identity_id_nid_idx" ON "identity_recovery_tokens" USING btree ("identity_id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_recovery_tokens_identity_recovery_address_id_idx" ON "identity_recovery_tokens" USING btree ("identity_recovery_address_id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_recovery_tokens_nid_id_idx" ON "identity_recovery_tokens" USING btree ("nid" uuid_ops,"id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_recovery_tokens_selfservice_recovery_flow_id_idx" ON "identity_recovery_tokens" USING btree ("selfservice_recovery_flow_id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_recovery_tokens_token_nid_used_idx" ON "identity_recovery_tokens" USING btree ("nid" bool_ops,"token" text_ops,"used" bool_ops);--> statement-breakpoint -CREATE INDEX "identity_recovery_codes_flow_id_idx" ON "identity_recovery_codes" USING btree ("selfservice_recovery_flow_id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_recovery_codes_id_nid_idx" ON "identity_recovery_codes" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_recovery_codes_identity_id_nid_idx" ON "identity_recovery_codes" USING btree ("identity_id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_recovery_codes_identity_recovery_address_id_nid_idx" ON "identity_recovery_codes" USING btree ("identity_recovery_address_id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_recovery_codes_nid_flow_id_idx" ON "identity_recovery_codes" USING btree ("nid" uuid_ops,"selfservice_recovery_flow_id" uuid_ops);--> statement-breakpoint -CREATE INDEX "session_devices_id_nid_idx" ON "session_devices" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "session_devices_session_id_nid_idx" ON "session_devices" USING btree ("session_id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_verification_codes_flow_id_idx" ON "identity_verification_codes" USING btree ("selfservice_verification_flow_id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_verification_codes_id_nid_idx" ON "identity_verification_codes" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_verification_codes_nid_flow_id_idx" ON "identity_verification_codes" USING btree ("nid" uuid_ops,"selfservice_verification_flow_id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_verification_codes_verifiable_address_nid_idx" ON "identity_verification_codes" USING btree ("identity_verifiable_address_id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "courier_message_dispatches_message_id_idx" ON "courier_message_dispatches" USING btree ("message_id" timestamp_ops,"created_at" timestamp_ops);--> statement-breakpoint -CREATE INDEX "courier_message_dispatches_nid_idx" ON "courier_message_dispatches" USING btree ("nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "session_token_exchanges_nid_code_idx" ON "session_token_exchanges" USING btree ("init_code" uuid_ops,"nid" text_ops);--> statement-breakpoint -CREATE INDEX "session_token_exchanges_nid_flow_id_idx" ON "session_token_exchanges" USING btree ("flow_id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_login_codes_flow_id_idx" ON "identity_login_codes" USING btree ("selfservice_login_flow_id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_login_codes_id_nid_idx" ON "identity_login_codes" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_login_codes_identity_id_idx" ON "identity_login_codes" USING btree ("identity_id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_login_codes_nid_flow_id_idx" ON "identity_login_codes" USING btree ("nid" uuid_ops,"selfservice_login_flow_id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_registration_codes_flow_id_idx" ON "identity_registration_codes" USING btree ("selfservice_registration_flow_id" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_registration_codes_id_nid_idx" ON "identity_registration_codes" USING btree ("id" uuid_ops,"nid" uuid_ops);--> statement-breakpoint -CREATE INDEX "identity_registration_codes_nid_flow_id_idx" ON "identity_registration_codes" USING btree ("nid" uuid_ops,"selfservice_registration_flow_id" uuid_ops); -*/ \ No newline at end of file diff --git a/dashboard/drizzle/meta/0000_snapshot.json b/dashboard/drizzle/meta/0000_snapshot.json deleted file mode 100644 index 4d455bc..0000000 --- a/dashboard/drizzle/meta/0000_snapshot.json +++ /dev/null @@ -1,4700 +0,0 @@ -{ - "id": "00000000-0000-0000-0000-000000000000", - "prevId": "", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.schema_migration": { - "name": "schema_migration", - "schema": "", - "columns": { - "version": { - "name": "version", - "type": "varchar(48)", - "primaryKey": false, - "notNull": true - }, - "version_self": { - "name": "version_self", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - } - }, - "indexes": { - "schema_migration_version_idx": { - "name": "schema_migration_version_idx", - "columns": [ - { - "expression": "version", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "schema_migration_version_self_idx": { - "name": "schema_migration_version_self_idx", - "columns": [ - { - "expression": "version_self", - "asc": true, - "nulls": "last", - "opclass": "int4_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.identity_credentials": { - "name": "identity_credentials", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "identity_credential_type_id": { - "name": "identity_credential_type_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "identity_id": { - "name": "identity_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - } - }, - "indexes": { - "identity_credentials_id_nid_idx": { - "name": "identity_credentials_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_credentials_nid_id_idx": { - "name": "identity_credentials_nid_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_credentials_nid_identity_id_idx": { - "name": "identity_credentials_nid_identity_id_idx", - "columns": [ - { - "expression": "identity_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "identity_credentials_identity_id_fkey": { - "name": "identity_credentials_identity_id_fkey", - "tableFrom": "identity_credentials", - "tableTo": "identities", - "schemaTo": "public", - "columnsFrom": [ - "identity_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "identity_credentials_identity_credential_type_id_fkey": { - "name": "identity_credentials_identity_credential_type_id_fkey", - "tableFrom": "identity_credentials", - "tableTo": "identity_credential_types", - "schemaTo": "public", - "columnsFrom": [ - "identity_credential_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "identity_credentials_nid_fk_idx": { - "name": "identity_credentials_nid_fk_idx", - "tableFrom": "identity_credentials", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.identity_credential_types": { - "name": "identity_credential_types", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "identity_credential_types_name_idx": { - "name": "identity_credential_types_name_idx", - "columns": [ - { - "expression": "name", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.selfservice_login_flows": { - "name": "selfservice_login_flows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "request_url": { - "name": "request_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "issued_at": { - "name": "issued_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "CURRENT_TIMESTAMP" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "active_method": { - "name": "active_method", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "csrf_token": { - "name": "csrf_token", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "forced": { - "name": "forced", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "type": { - "name": "type", - "type": "varchar(16)", - "primaryKey": false, - "notNull": true, - "default": "'browser'" - }, - "ui": { - "name": "ui", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "requested_aal": { - "name": "requested_aal", - "type": "varchar(4)", - "primaryKey": false, - "notNull": true, - "default": "'aal1'" - }, - "internal_context": { - "name": "internal_context", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "oauth2_login_challenge": { - "name": "oauth2_login_challenge", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "oauth2_login_challenge_data": { - "name": "oauth2_login_challenge_data", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "state": { - "name": "state", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "submit_count": { - "name": "submit_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "organization_id": { - "name": "organization_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "selfservice_login_flows_id_nid_idx": { - "name": "selfservice_login_flows_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "selfservice_login_flows_nid_id_idx": { - "name": "selfservice_login_flows_nid_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "selfservice_login_flows_nid_fk_idx": { - "name": "selfservice_login_flows_nid_fk_idx", - "tableFrom": "selfservice_login_flows", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.networks": { - "name": "networks", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.selfservice_registration_flows": { - "name": "selfservice_registration_flows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "request_url": { - "name": "request_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "issued_at": { - "name": "issued_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "CURRENT_TIMESTAMP" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "active_method": { - "name": "active_method", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "csrf_token": { - "name": "csrf_token", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "varchar(16)", - "primaryKey": false, - "notNull": true, - "default": "'browser'" - }, - "ui": { - "name": "ui", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "internal_context": { - "name": "internal_context", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "oauth2_login_challenge": { - "name": "oauth2_login_challenge", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "oauth2_login_challenge_data": { - "name": "oauth2_login_challenge_data", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "state": { - "name": "state", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "submit_count": { - "name": "submit_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "organization_id": { - "name": "organization_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "selfservice_registration_flows_id_nid_idx": { - "name": "selfservice_registration_flows_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "selfservice_registration_flows_nid_id_idx": { - "name": "selfservice_registration_flows_nid_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "selfservice_registration_flows_nid_fk_idx": { - "name": "selfservice_registration_flows_nid_fk_idx", - "tableFrom": "selfservice_registration_flows", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.identities": { - "name": "identities", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "schema_id": { - "name": "schema_id", - "type": "varchar(2048)", - "primaryKey": false, - "notNull": true - }, - "traits": { - "name": "traits", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "state": { - "name": "state", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true, - "default": "'active'" - }, - "state_changed_at": { - "name": "state_changed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "metadata_public": { - "name": "metadata_public", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "metadata_admin": { - "name": "metadata_admin", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "available_aal": { - "name": "available_aal", - "type": "varchar(4)", - "primaryKey": false, - "notNull": false - }, - "organization_id": { - "name": "organization_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "identities_id_nid_idx": { - "name": "identities_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identities_nid_id_idx": { - "name": "identities_nid_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "identities_nid_fk_idx": { - "name": "identities_nid_fk_idx", - "tableFrom": "identities", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.identity_credential_identifiers": { - "name": "identity_credential_identifiers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "identity_credential_id": { - "name": "identity_credential_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "identity_credential_type_id": { - "name": "identity_credential_type_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "identity_credential_identifiers_id_nid_idx": { - "name": "identity_credential_identifiers_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_credential_identifiers_identifier_nid_type_uq_idx": { - "name": "identity_credential_identifiers_identifier_nid_type_uq_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "identity_credential_type_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "identifier", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_credential_identifiers_nid_i_ici_idx": { - "name": "identity_credential_identifiers_nid_i_ici_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - }, - { - "expression": "identifier", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - }, - { - "expression": "identity_credential_id", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_credential_identifiers_nid_id_idx": { - "name": "identity_credential_identifiers_nid_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_credential_identifiers_nid_identity_credential_id_idx": { - "name": "identity_credential_identifiers_nid_identity_credential_id_idx", - "columns": [ - { - "expression": "identity_credential_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "identity_credential_identifiers_identity_credential_id_fkey": { - "name": "identity_credential_identifiers_identity_credential_id_fkey", - "tableFrom": "identity_credential_identifiers", - "tableTo": "identity_credentials", - "schemaTo": "public", - "columnsFrom": [ - "identity_credential_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "identity_credential_identifiers_nid_fk_idx": { - "name": "identity_credential_identifiers_nid_fk_idx", - "tableFrom": "identity_credential_identifiers", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - }, - "identity_credential_identifiers_type_id_fk_idx": { - "name": "identity_credential_identifiers_type_id_fk_idx", - "tableFrom": "identity_credential_identifiers", - "tableTo": "identity_credential_types", - "schemaTo": "public", - "columnsFrom": [ - "identity_credential_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.identity_verifiable_addresses": { - "name": "identity_verifiable_addresses", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(16)", - "primaryKey": false, - "notNull": true - }, - "via": { - "name": "via", - "type": "varchar(16)", - "primaryKey": false, - "notNull": true - }, - "verified": { - "name": "verified", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "varchar(400)", - "primaryKey": false, - "notNull": true - }, - "verified_at": { - "name": "verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "identity_id": { - "name": "identity_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "identity_verifiable_addresses_id_nid_idx": { - "name": "identity_verifiable_addresses_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_verifiable_addresses_nid_id_idx": { - "name": "identity_verifiable_addresses_nid_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_verifiable_addresses_nid_identity_id_idx": { - "name": "identity_verifiable_addresses_nid_identity_id_idx", - "columns": [ - { - "expression": "identity_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_verifiable_addresses_status_via_idx": { - "name": "identity_verifiable_addresses_status_via_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - }, - { - "expression": "via", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - }, - { - "expression": "value", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_verifiable_addresses_status_via_uq_idx": { - "name": "identity_verifiable_addresses_status_via_uq_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - }, - { - "expression": "via", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - }, - { - "expression": "value", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "identity_verifiable_addresses_identity_id_fkey": { - "name": "identity_verifiable_addresses_identity_id_fkey", - "tableFrom": "identity_verifiable_addresses", - "tableTo": "identities", - "schemaTo": "public", - "columnsFrom": [ - "identity_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "identity_verifiable_addresses_nid_fk_idx": { - "name": "identity_verifiable_addresses_nid_fk_idx", - "tableFrom": "identity_verifiable_addresses", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.courier_messages": { - "name": "courier_messages", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "type": { - "name": "type", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "subject": { - "name": "subject", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "recipient": { - "name": "recipient", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "template_type": { - "name": "template_type", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "template_data": { - "name": "template_data", - "type": "bytea", - "primaryKey": false, - "notNull": false - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "send_count": { - "name": "send_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "channel": { - "name": "channel", - "type": "varchar(32)", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "courier_messages_id_nid_idx": { - "name": "courier_messages_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "courier_messages_nid_created_at_id_idx": { - "name": "courier_messages_nid_created_at_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "timestamp_ops", - "isExpression": false - }, - { - "expression": "created_at", - "asc": false, - "nulls": "first", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "courier_messages_nid_id_idx": { - "name": "courier_messages_nid_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "courier_messages_nid_recipient_created_at_id_idx": { - "name": "courier_messages_nid_recipient_created_at_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "timestamp_ops", - "isExpression": false - }, - { - "expression": "recipient", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - }, - { - "expression": "created_at", - "asc": false, - "nulls": "first", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "courier_messages_nid_status_created_at_id_idx": { - "name": "courier_messages_nid_status_created_at_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "status", - "asc": true, - "nulls": "last", - "opclass": "timestamp_ops", - "isExpression": false - }, - { - "expression": "created_at", - "asc": false, - "nulls": "first", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "courier_messages_status_idx": { - "name": "courier_messages_status_idx", - "columns": [ - { - "expression": "status", - "asc": true, - "nulls": "last", - "opclass": "int4_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "courier_messages_nid_fk_idx": { - "name": "courier_messages_nid_fk_idx", - "tableFrom": "courier_messages", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.selfservice_errors": { - "name": "selfservice_errors", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "errors": { - "name": "errors", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "seen_at": { - "name": "seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "was_seen": { - "name": "was_seen", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "csrf_token": { - "name": "csrf_token", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "selfservice_errors_errors_nid_id_idx": { - "name": "selfservice_errors_errors_nid_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "selfservice_errors_nid_fk_idx": { - "name": "selfservice_errors_nid_fk_idx", - "tableFrom": "selfservice_errors", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.selfservice_verification_flows": { - "name": "selfservice_verification_flows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "request_url": { - "name": "request_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "issued_at": { - "name": "issued_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "CURRENT_TIMESTAMP" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "csrf_token": { - "name": "csrf_token", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "varchar(16)", - "primaryKey": false, - "notNull": true, - "default": "'browser'" - }, - "state": { - "name": "state", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true, - "default": "'show_form'" - }, - "active_method": { - "name": "active_method", - "type": "varchar(32)", - "primaryKey": false, - "notNull": false - }, - "ui": { - "name": "ui", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "submit_count": { - "name": "submit_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "oauth2_login_challenge": { - "name": "oauth2_login_challenge", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "session_id": { - "name": "session_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "identity_id": { - "name": "identity_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "authentication_methods": { - "name": "authentication_methods", - "type": "json", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "selfservice_verification_flows_id_nid_idx": { - "name": "selfservice_verification_flows_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "selfservice_verification_flows_nid_id_idx": { - "name": "selfservice_verification_flows_nid_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "selfservice_verification_flows_nid_fk_idx": { - "name": "selfservice_verification_flows_nid_fk_idx", - "tableFrom": "selfservice_verification_flows", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.selfservice_settings_flows": { - "name": "selfservice_settings_flows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "request_url": { - "name": "request_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "issued_at": { - "name": "issued_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "CURRENT_TIMESTAMP" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "identity_id": { - "name": "identity_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "active_method": { - "name": "active_method", - "type": "varchar(32)", - "primaryKey": false, - "notNull": false - }, - "state": { - "name": "state", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true, - "default": "'show_form'" - }, - "type": { - "name": "type", - "type": "varchar(16)", - "primaryKey": false, - "notNull": true, - "default": "'browser'" - }, - "ui": { - "name": "ui", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "internal_context": { - "name": "internal_context", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "selfservice_settings_flows_id_nid_idx": { - "name": "selfservice_settings_flows_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "selfservice_settings_flows_identity_id_nid_idx": { - "name": "selfservice_settings_flows_identity_id_nid_idx", - "columns": [ - { - "expression": "identity_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "selfservice_settings_flows_nid_id_idx": { - "name": "selfservice_settings_flows_nid_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "selfservice_profile_management_requests_identity_id_fkey": { - "name": "selfservice_profile_management_requests_identity_id_fkey", - "tableFrom": "selfservice_settings_flows", - "tableTo": "identities", - "schemaTo": "public", - "columnsFrom": [ - "identity_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "selfservice_settings_flows_nid_fk_idx": { - "name": "selfservice_settings_flows_nid_fk_idx", - "tableFrom": "selfservice_settings_flows", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.continuity_containers": { - "name": "continuity_containers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "identity_id": { - "name": "identity_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "payload": { - "name": "payload", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "continuity_containers_id_nid_idx": { - "name": "continuity_containers_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "continuity_containers_identity_id_nid_idx": { - "name": "continuity_containers_identity_id_nid_idx", - "columns": [ - { - "expression": "identity_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "continuity_containers_nid_id_idx": { - "name": "continuity_containers_nid_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "continuity_containers_identity_id_fkey": { - "name": "continuity_containers_identity_id_fkey", - "tableFrom": "continuity_containers", - "tableTo": "identities", - "schemaTo": "public", - "columnsFrom": [ - "identity_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "continuity_containers_nid_fk_idx": { - "name": "continuity_containers_nid_fk_idx", - "tableFrom": "continuity_containers", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.sessions": { - "name": "sessions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "issued_at": { - "name": "issued_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "CURRENT_TIMESTAMP" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "authenticated_at": { - "name": "authenticated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "identity_id": { - "name": "identity_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "varchar(39)", - "primaryKey": false, - "notNull": false - }, - "active": { - "name": "active", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "logout_token": { - "name": "logout_token", - "type": "varchar(39)", - "primaryKey": false, - "notNull": false - }, - "aal": { - "name": "aal", - "type": "varchar(4)", - "primaryKey": false, - "notNull": true, - "default": "'aal1'" - }, - "authentication_methods": { - "name": "authentication_methods", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "sessions_id_nid_idx": { - "name": "sessions_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_identity_id_nid_sorted_idx": { - "name": "sessions_identity_id_nid_sorted_idx", - "columns": [ - { - "expression": "identity_id", - "asc": true, - "nulls": "last", - "opclass": "timestamp_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "timestamp_ops", - "isExpression": false - }, - { - "expression": "authenticated_at", - "asc": false, - "nulls": "first", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_logout_token_uq_idx": { - "name": "sessions_logout_token_uq_idx", - "columns": [ - { - "expression": "logout_token", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_nid_created_at_id_idx": { - "name": "sessions_nid_created_at_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "created_at", - "asc": false, - "nulls": "first", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_nid_id_identity_id_idx": { - "name": "sessions_nid_id_identity_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "identity_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_token_nid_idx": { - "name": "sessions_token_nid_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "token", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_token_uq_idx": { - "name": "sessions_token_uq_idx", - "columns": [ - { - "expression": "token", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "sessions_identity_id_fkey": { - "name": "sessions_identity_id_fkey", - "tableFrom": "sessions", - "tableTo": "identities", - "schemaTo": "public", - "columnsFrom": [ - "identity_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "sessions_nid_fk_idx": { - "name": "sessions_nid_fk_idx", - "tableFrom": "sessions", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.identity_recovery_addresses": { - "name": "identity_recovery_addresses", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "via": { - "name": "via", - "type": "varchar(16)", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "varchar(400)", - "primaryKey": false, - "notNull": true - }, - "identity_id": { - "name": "identity_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "identity_recovery_addresses_id_nid_idx": { - "name": "identity_recovery_addresses_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_recovery_addresses_nid_id_idx": { - "name": "identity_recovery_addresses_nid_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_recovery_addresses_nid_identity_id_idx": { - "name": "identity_recovery_addresses_nid_identity_id_idx", - "columns": [ - { - "expression": "identity_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_recovery_addresses_status_via_idx": { - "name": "identity_recovery_addresses_status_via_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - }, - { - "expression": "via", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - }, - { - "expression": "value", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_recovery_addresses_status_via_uq_idx": { - "name": "identity_recovery_addresses_status_via_uq_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - }, - { - "expression": "via", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - }, - { - "expression": "value", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "identity_recovery_addresses_identity_id_fkey": { - "name": "identity_recovery_addresses_identity_id_fkey", - "tableFrom": "identity_recovery_addresses", - "tableTo": "identities", - "schemaTo": "public", - "columnsFrom": [ - "identity_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "identity_recovery_addresses_nid_fk_idx": { - "name": "identity_recovery_addresses_nid_fk_idx", - "tableFrom": "identity_recovery_addresses", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.identity_verification_tokens": { - "name": "identity_verification_tokens", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "token": { - "name": "token", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "used": { - "name": "used", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "used_at": { - "name": "used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "issued_at": { - "name": "issued_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "identity_verifiable_address_id": { - "name": "identity_verifiable_address_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "selfservice_verification_flow_id": { - "name": "selfservice_verification_flow_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "identity_verification_tokens_id_nid_idx": { - "name": "identity_verification_tokens_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_verification_tokens_nid_id_idx": { - "name": "identity_verification_tokens_nid_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_verification_tokens_token_nid_used_flow_id_idx": { - "name": "identity_verification_tokens_token_nid_used_flow_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "token", - "asc": true, - "nulls": "last", - "opclass": "bool_ops", - "isExpression": false - }, - { - "expression": "used", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - }, - { - "expression": "selfservice_verification_flow_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_verification_tokens_token_uq_idx": { - "name": "identity_verification_tokens_token_uq_idx", - "columns": [ - { - "expression": "token", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_verification_tokens_verifiable_address_id_idx": { - "name": "identity_verification_tokens_verifiable_address_id_idx", - "columns": [ - { - "expression": "identity_verifiable_address_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_verification_tokens_verification_flow_id_idx": { - "name": "identity_verification_tokens_verification_flow_id_idx", - "columns": [ - { - "expression": "selfservice_verification_flow_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "identity_verification_tokens_identity_verifiable_address_i_fkey": { - "name": "identity_verification_tokens_identity_verifiable_address_i_fkey", - "tableFrom": "identity_verification_tokens", - "tableTo": "identity_verifiable_addresses", - "schemaTo": "public", - "columnsFrom": [ - "identity_verifiable_address_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "identity_verification_tokens_selfservice_verification_flow_fkey": { - "name": "identity_verification_tokens_selfservice_verification_flow_fkey", - "tableFrom": "identity_verification_tokens", - "tableTo": "selfservice_verification_flows", - "schemaTo": "public", - "columnsFrom": [ - "selfservice_verification_flow_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "identity_verification_tokens_nid_fk_idx": { - "name": "identity_verification_tokens_nid_fk_idx", - "tableFrom": "identity_verification_tokens", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.selfservice_recovery_flows": { - "name": "selfservice_recovery_flows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "request_url": { - "name": "request_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "issued_at": { - "name": "issued_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "CURRENT_TIMESTAMP" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "active_method": { - "name": "active_method", - "type": "varchar(32)", - "primaryKey": false, - "notNull": false - }, - "csrf_token": { - "name": "csrf_token", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "state": { - "name": "state", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "recovered_identity_id": { - "name": "recovered_identity_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "varchar(16)", - "primaryKey": false, - "notNull": true, - "default": "'browser'" - }, - "ui": { - "name": "ui", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "submit_count": { - "name": "submit_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "skip_csrf_check": { - "name": "skip_csrf_check", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - } - }, - "indexes": { - "selfservice_recovery_flows_id_nid_idx": { - "name": "selfservice_recovery_flows_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "selfservice_recovery_flows_nid_id_idx": { - "name": "selfservice_recovery_flows_nid_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "selfservice_recovery_flows_recovered_identity_id_nid_idx": { - "name": "selfservice_recovery_flows_recovered_identity_id_nid_idx", - "columns": [ - { - "expression": "recovered_identity_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "selfservice_recovery_requests_recovered_identity_id_fkey": { - "name": "selfservice_recovery_requests_recovered_identity_id_fkey", - "tableFrom": "selfservice_recovery_flows", - "tableTo": "identities", - "schemaTo": "public", - "columnsFrom": [ - "recovered_identity_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "selfservice_recovery_flows_nid_fk_idx": { - "name": "selfservice_recovery_flows_nid_fk_idx", - "tableFrom": "selfservice_recovery_flows", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.identity_recovery_tokens": { - "name": "identity_recovery_tokens", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "token": { - "name": "token", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "used": { - "name": "used", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "used_at": { - "name": "used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "identity_recovery_address_id": { - "name": "identity_recovery_address_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "selfservice_recovery_flow_id": { - "name": "selfservice_recovery_flow_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "'2000-01-01 00:00:00'" - }, - "issued_at": { - "name": "issued_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "'2000-01-01 00:00:00'" - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "identity_id": { - "name": "identity_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "token_type": { - "name": "token_type", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - } - }, - "indexes": { - "identity_recovery_addresses_code_uq_idx": { - "name": "identity_recovery_addresses_code_uq_idx", - "columns": [ - { - "expression": "token", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_recovery_tokens_id_nid_idx": { - "name": "identity_recovery_tokens_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_recovery_tokens_identity_id_nid_idx": { - "name": "identity_recovery_tokens_identity_id_nid_idx", - "columns": [ - { - "expression": "identity_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_recovery_tokens_identity_recovery_address_id_idx": { - "name": "identity_recovery_tokens_identity_recovery_address_id_idx", - "columns": [ - { - "expression": "identity_recovery_address_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_recovery_tokens_nid_id_idx": { - "name": "identity_recovery_tokens_nid_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_recovery_tokens_selfservice_recovery_flow_id_idx": { - "name": "identity_recovery_tokens_selfservice_recovery_flow_id_idx", - "columns": [ - { - "expression": "selfservice_recovery_flow_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_recovery_tokens_token_nid_used_idx": { - "name": "identity_recovery_tokens_token_nid_used_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "bool_ops", - "isExpression": false - }, - { - "expression": "token", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - }, - { - "expression": "used", - "asc": true, - "nulls": "last", - "opclass": "bool_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "identity_recovery_tokens_selfservice_recovery_request_id_fkey": { - "name": "identity_recovery_tokens_selfservice_recovery_request_id_fkey", - "tableFrom": "identity_recovery_tokens", - "tableTo": "selfservice_recovery_flows", - "schemaTo": "public", - "columnsFrom": [ - "selfservice_recovery_flow_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "identity_recovery_tokens_nid_fk_idx": { - "name": "identity_recovery_tokens_nid_fk_idx", - "tableFrom": "identity_recovery_tokens", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - }, - "identity_recovery_tokens_identity_recovery_address_id_fkey": { - "name": "identity_recovery_tokens_identity_recovery_address_id_fkey", - "tableFrom": "identity_recovery_tokens", - "tableTo": "identity_recovery_addresses", - "schemaTo": "public", - "columnsFrom": [ - "identity_recovery_address_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "identity_recovery_tokens_identity_id_fk_idx": { - "name": "identity_recovery_tokens_identity_id_fk_idx", - "tableFrom": "identity_recovery_tokens", - "tableTo": "identities", - "schemaTo": "public", - "columnsFrom": [ - "identity_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": { - "identity_recovery_tokens_token_type_ck": { - "name": "identity_recovery_tokens_token_type_ck", - "value": "(token_type = 1) OR (token_type = 2)" - } - }, - "policies": {}, - "isRLSEnabled": false - }, - "public.identity_recovery_codes": { - "name": "identity_recovery_codes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "code": { - "name": "code", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "used_at": { - "name": "used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "identity_recovery_address_id": { - "name": "identity_recovery_address_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "code_type": { - "name": "code_type", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "'2000-01-01 00:00:00'" - }, - "issued_at": { - "name": "issued_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "'2000-01-01 00:00:00'" - }, - "selfservice_recovery_flow_id": { - "name": "selfservice_recovery_flow_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "identity_id": { - "name": "identity_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "identity_recovery_codes_flow_id_idx": { - "name": "identity_recovery_codes_flow_id_idx", - "columns": [ - { - "expression": "selfservice_recovery_flow_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_recovery_codes_id_nid_idx": { - "name": "identity_recovery_codes_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_recovery_codes_identity_id_nid_idx": { - "name": "identity_recovery_codes_identity_id_nid_idx", - "columns": [ - { - "expression": "identity_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_recovery_codes_identity_recovery_address_id_nid_idx": { - "name": "identity_recovery_codes_identity_recovery_address_id_nid_idx", - "columns": [ - { - "expression": "identity_recovery_address_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_recovery_codes_nid_flow_id_idx": { - "name": "identity_recovery_codes_nid_flow_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "selfservice_recovery_flow_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "identity_recovery_codes_identity_recovery_addresses_id_fk": { - "name": "identity_recovery_codes_identity_recovery_addresses_id_fk", - "tableFrom": "identity_recovery_codes", - "tableTo": "identity_recovery_addresses", - "schemaTo": "public", - "columnsFrom": [ - "identity_recovery_address_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "identity_recovery_codes_selfservice_recovery_flows_id_fk": { - "name": "identity_recovery_codes_selfservice_recovery_flows_id_fk", - "tableFrom": "identity_recovery_codes", - "tableTo": "selfservice_recovery_flows", - "schemaTo": "public", - "columnsFrom": [ - "selfservice_recovery_flow_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "identity_recovery_codes_identity_id_fk": { - "name": "identity_recovery_codes_identity_id_fk", - "tableFrom": "identity_recovery_codes", - "tableTo": "identities", - "schemaTo": "public", - "columnsFrom": [ - "identity_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - }, - "identity_recovery_codes_networks_id_fk": { - "name": "identity_recovery_codes_networks_id_fk", - "tableFrom": "identity_recovery_codes", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.session_devices": { - "name": "session_devices", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "ip_address": { - "name": "ip_address", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "user_agent": { - "name": "user_agent", - "type": "varchar(512)", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "location": { - "name": "location", - "type": "varchar(512)", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "session_id": { - "name": "session_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "session_devices_id_nid_idx": { - "name": "session_devices_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "session_devices_session_id_nid_idx": { - "name": "session_devices_session_id_nid_idx", - "columns": [ - { - "expression": "session_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "session_metadata_sessions_id_fk": { - "name": "session_metadata_sessions_id_fk", - "tableFrom": "session_devices", - "tableTo": "sessions", - "schemaTo": "public", - "columnsFrom": [ - "session_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "session_metadata_nid_fk": { - "name": "session_metadata_nid_fk", - "tableFrom": "session_devices", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "unique_session_device": { - "columns": [ - "ip_address", - "user_agent", - "nid", - "session_id" - ], - "nullsNotDistinct": false, - "name": "unique_session_device" - } - }, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.identity_verification_codes": { - "name": "identity_verification_codes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "code_hmac": { - "name": "code_hmac", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "used_at": { - "name": "used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "identity_verifiable_address_id": { - "name": "identity_verifiable_address_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "'2000-01-01 00:00:00'" - }, - "issued_at": { - "name": "issued_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "'2000-01-01 00:00:00'" - }, - "selfservice_verification_flow_id": { - "name": "selfservice_verification_flow_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "identity_verification_codes_flow_id_idx": { - "name": "identity_verification_codes_flow_id_idx", - "columns": [ - { - "expression": "selfservice_verification_flow_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_verification_codes_id_nid_idx": { - "name": "identity_verification_codes_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_verification_codes_nid_flow_id_idx": { - "name": "identity_verification_codes_nid_flow_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "selfservice_verification_flow_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_verification_codes_verifiable_address_nid_idx": { - "name": "identity_verification_codes_verifiable_address_nid_idx", - "columns": [ - { - "expression": "identity_verifiable_address_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "identity_verification_codes_identity_verifiable_addresses_id_fk": { - "name": "identity_verification_codes_identity_verifiable_addresses_id_fk", - "tableFrom": "identity_verification_codes", - "tableTo": "identity_verifiable_addresses", - "schemaTo": "public", - "columnsFrom": [ - "identity_verifiable_address_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "identity_verification_codes_selfservice_verification_flows_id_f": { - "name": "identity_verification_codes_selfservice_verification_flows_id_f", - "tableFrom": "identity_verification_codes", - "tableTo": "selfservice_verification_flows", - "schemaTo": "public", - "columnsFrom": [ - "selfservice_verification_flow_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "identity_verification_codes_networks_id_fk": { - "name": "identity_verification_codes_networks_id_fk", - "tableFrom": "identity_verification_codes", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.courier_message_dispatches": { - "name": "courier_message_dispatches", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "message_id": { - "name": "message_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(7)", - "primaryKey": false, - "notNull": true - }, - "error": { - "name": "error", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "CURRENT_TIMESTAMP" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "CURRENT_TIMESTAMP" - } - }, - "indexes": { - "courier_message_dispatches_message_id_idx": { - "name": "courier_message_dispatches_message_id_idx", - "columns": [ - { - "expression": "message_id", - "asc": true, - "nulls": "last", - "opclass": "timestamp_ops", - "isExpression": false - }, - { - "expression": "created_at", - "asc": false, - "nulls": "first", - "opclass": "timestamp_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "courier_message_dispatches_nid_idx": { - "name": "courier_message_dispatches_nid_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "courier_message_dispatches_message_id_fk": { - "name": "courier_message_dispatches_message_id_fk", - "tableFrom": "courier_message_dispatches", - "tableTo": "courier_messages", - "schemaTo": "public", - "columnsFrom": [ - "message_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "courier_message_dispatches_nid_fk": { - "name": "courier_message_dispatches_nid_fk", - "tableFrom": "courier_message_dispatches", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.session_token_exchanges": { - "name": "session_token_exchanges", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "flow_id": { - "name": "flow_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "session_id": { - "name": "session_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "init_code": { - "name": "init_code", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "return_to_code": { - "name": "return_to_code", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "session_token_exchanges_nid_code_idx": { - "name": "session_token_exchanges_nid_code_idx", - "columns": [ - { - "expression": "init_code", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "text_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "session_token_exchanges_nid_flow_id_idx": { - "name": "session_token_exchanges_nid_flow_id_idx", - "columns": [ - { - "expression": "flow_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.identity_login_codes": { - "name": "identity_login_codes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "code": { - "name": "code", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "address": { - "name": "address", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "address_type": { - "name": "address_type", - "type": "char(36)", - "primaryKey": false, - "notNull": true - }, - "used_at": { - "name": "used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "'2000-01-01 00:00:00'" - }, - "issued_at": { - "name": "issued_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "'2000-01-01 00:00:00'" - }, - "selfservice_login_flow_id": { - "name": "selfservice_login_flow_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "identity_id": { - "name": "identity_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "CURRENT_TIMESTAMP" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "CURRENT_TIMESTAMP" - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "identity_login_codes_flow_id_idx": { - "name": "identity_login_codes_flow_id_idx", - "columns": [ - { - "expression": "selfservice_login_flow_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_login_codes_id_nid_idx": { - "name": "identity_login_codes_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_login_codes_identity_id_idx": { - "name": "identity_login_codes_identity_id_idx", - "columns": [ - { - "expression": "identity_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_login_codes_nid_flow_id_idx": { - "name": "identity_login_codes_nid_flow_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "selfservice_login_flow_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "identity_login_codes_selfservice_login_flows_id_fk": { - "name": "identity_login_codes_selfservice_login_flows_id_fk", - "tableFrom": "identity_login_codes", - "tableTo": "selfservice_login_flows", - "schemaTo": "public", - "columnsFrom": [ - "selfservice_login_flow_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "identity_login_codes_networks_id_fk": { - "name": "identity_login_codes_networks_id_fk", - "tableFrom": "identity_login_codes", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - }, - "identity_login_codes_identity_id_fk": { - "name": "identity_login_codes_identity_id_fk", - "tableFrom": "identity_login_codes", - "tableTo": "identities", - "schemaTo": "public", - "columnsFrom": [ - "identity_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - }, - "public.identity_registration_codes": { - "name": "identity_registration_codes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true - }, - "code": { - "name": "code", - "type": "varchar(64)", - "primaryKey": false, - "notNull": true - }, - "address": { - "name": "address", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "address_type": { - "name": "address_type", - "type": "char(36)", - "primaryKey": false, - "notNull": true - }, - "used_at": { - "name": "used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "'2000-01-01 00:00:00'" - }, - "issued_at": { - "name": "issued_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "'2000-01-01 00:00:00'" - }, - "selfservice_registration_flow_id": { - "name": "selfservice_registration_flow_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "CURRENT_TIMESTAMP" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "CURRENT_TIMESTAMP" - }, - "nid": { - "name": "nid", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "identity_registration_codes_flow_id_idx": { - "name": "identity_registration_codes_flow_id_idx", - "columns": [ - { - "expression": "selfservice_registration_flow_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_registration_codes_id_nid_idx": { - "name": "identity_registration_codes_id_nid_idx", - "columns": [ - { - "expression": "id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "identity_registration_codes_nid_flow_id_idx": { - "name": "identity_registration_codes_nid_flow_id_idx", - "columns": [ - { - "expression": "nid", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - }, - { - "expression": "selfservice_registration_flow_id", - "asc": true, - "nulls": "last", - "opclass": "uuid_ops", - "isExpression": false - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "identity_registration_codes_selfservice_registration_flows_id_f": { - "name": "identity_registration_codes_selfservice_registration_flows_id_f", - "tableFrom": "identity_registration_codes", - "tableTo": "selfservice_registration_flows", - "schemaTo": "public", - "columnsFrom": [ - "selfservice_registration_flow_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "identity_registration_codes_networks_id_fk": { - "name": "identity_registration_codes_networks_id_fk", - "tableFrom": "identity_registration_codes", - "tableTo": "networks", - "schemaTo": "public", - "columnsFrom": [ - "nid" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "restrict" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {}, - "policies": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "tables": {} - } -} \ No newline at end of file diff --git a/dashboard/drizzle/meta/_journal.json b/dashboard/drizzle/meta/_journal.json deleted file mode 100644 index b7874f0..0000000 --- a/dashboard/drizzle/meta/_journal.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": "7", - "dialect": "postgresql", - "entries": [ - { - "idx": 0, - "version": "7", - "when": 1735943555589, - "tag": "0000_square_moondragon", - "breakpoints": true - } - ] -} \ No newline at end of file diff --git a/dashboard/drizzle/relations.ts b/dashboard/drizzle/relations.ts deleted file mode 100644 index 615b353..0000000 --- a/dashboard/drizzle/relations.ts +++ /dev/null @@ -1,334 +0,0 @@ -import { relations } from 'drizzle-orm/relations'; -import { - continuityContainers, - courierMessageDispatches, - courierMessages, - identities, - identityCredentialIdentifiers, - identityCredentials, - identityCredentialTypes, - identityLoginCodes, - identityRecoveryAddresses, - identityRecoveryCodes, - identityRecoveryTokens, - identityRegistrationCodes, - identityVerifiableAddresses, - identityVerificationCodes, - identityVerificationTokens, - networks, - selfserviceErrors, - selfserviceLoginFlows, - selfserviceRecoveryFlows, - selfserviceRegistrationFlows, - selfserviceSettingsFlows, - selfserviceVerificationFlows, - sessionDevices, - sessions, -} from './schema'; - -export const identityCredentialsRelations = relations(identityCredentials, ({ one, many }) => ({ - identity: one(identities, { - fields: [identityCredentials.identityId], - references: [identities.id], - }), - identityCredentialType: one(identityCredentialTypes, { - fields: [identityCredentials.identityCredentialTypeId], - references: [identityCredentialTypes.id], - }), - network: one(networks, { - fields: [identityCredentials.nid], - references: [networks.id], - }), - identityCredentialIdentifiers: many(identityCredentialIdentifiers), -})); - -export const identitiesRelations = relations(identities, ({ one, many }) => ({ - identityCredentials: many(identityCredentials), - network: one(networks, { - fields: [identities.nid], - references: [networks.id], - }), - identityVerifiableAddresses: many(identityVerifiableAddresses), - selfserviceSettingsFlows: many(selfserviceSettingsFlows), - continuityContainers: many(continuityContainers), - sessions: many(sessions), - identityRecoveryAddresses: many(identityRecoveryAddresses), - selfserviceRecoveryFlows: many(selfserviceRecoveryFlows), - identityRecoveryTokens: many(identityRecoveryTokens), - identityRecoveryCodes: many(identityRecoveryCodes), - identityLoginCodes: many(identityLoginCodes), -})); - -export const identityCredentialTypesRelations = relations(identityCredentialTypes, ({ many }) => ({ - identityCredentials: many(identityCredentials), - identityCredentialIdentifiers: many(identityCredentialIdentifiers), -})); - -export const networksRelations = relations(networks, ({ many }) => ({ - identityCredentials: many(identityCredentials), - selfserviceLoginFlows: many(selfserviceLoginFlows), - selfserviceRegistrationFlows: many(selfserviceRegistrationFlows), - identities: many(identities), - identityCredentialIdentifiers: many(identityCredentialIdentifiers), - identityVerifiableAddresses: many(identityVerifiableAddresses), - courierMessages: many(courierMessages), - selfserviceErrors: many(selfserviceErrors), - selfserviceVerificationFlows: many(selfserviceVerificationFlows), - selfserviceSettingsFlows: many(selfserviceSettingsFlows), - continuityContainers: many(continuityContainers), - sessions: many(sessions), - identityRecoveryAddresses: many(identityRecoveryAddresses), - identityVerificationTokens: many(identityVerificationTokens), - selfserviceRecoveryFlows: many(selfserviceRecoveryFlows), - identityRecoveryTokens: many(identityRecoveryTokens), - identityRecoveryCodes: many(identityRecoveryCodes), - sessionDevices: many(sessionDevices), - identityVerificationCodes: many(identityVerificationCodes), - courierMessageDispatches: many(courierMessageDispatches), - identityLoginCodes: many(identityLoginCodes), - identityRegistrationCodes: many(identityRegistrationCodes), -})); - -export const selfserviceLoginFlowsRelations = relations(selfserviceLoginFlows, ({ one, many }) => ({ - network: one(networks, { - fields: [selfserviceLoginFlows.nid], - references: [networks.id], - }), - identityLoginCodes: many(identityLoginCodes), -})); - -export const selfserviceRegistrationFlowsRelations = relations(selfserviceRegistrationFlows, ({ one, many }) => ({ - network: one(networks, { - fields: [selfserviceRegistrationFlows.nid], - references: [networks.id], - }), - identityRegistrationCodes: many(identityRegistrationCodes), -})); - -export const identityCredentialIdentifiersRelations = relations(identityCredentialIdentifiers, ({ one }) => ({ - identityCredential: one(identityCredentials, { - fields: [identityCredentialIdentifiers.identityCredentialId], - references: [identityCredentials.id], - }), - network: one(networks, { - fields: [identityCredentialIdentifiers.nid], - references: [networks.id], - }), - identityCredentialType: one(identityCredentialTypes, { - fields: [identityCredentialIdentifiers.identityCredentialTypeId], - references: [identityCredentialTypes.id], - }), -})); - -export const identityVerifiableAddressesRelations = relations(identityVerifiableAddresses, ({ one, many }) => ({ - identity: one(identities, { - fields: [identityVerifiableAddresses.identityId], - references: [identities.id], - }), - network: one(networks, { - fields: [identityVerifiableAddresses.nid], - references: [networks.id], - }), - identityVerificationTokens: many(identityVerificationTokens), - identityVerificationCodes: many(identityVerificationCodes), -})); - -export const courierMessagesRelations = relations(courierMessages, ({ one, many }) => ({ - network: one(networks, { - fields: [courierMessages.nid], - references: [networks.id], - }), - courierMessageDispatches: many(courierMessageDispatches), -})); - -export const selfserviceErrorsRelations = relations(selfserviceErrors, ({ one }) => ({ - network: one(networks, { - fields: [selfserviceErrors.nid], - references: [networks.id], - }), -})); - -export const selfserviceVerificationFlowsRelations = relations(selfserviceVerificationFlows, ({ one, many }) => ({ - network: one(networks, { - fields: [selfserviceVerificationFlows.nid], - references: [networks.id], - }), - identityVerificationTokens: many(identityVerificationTokens), - identityVerificationCodes: many(identityVerificationCodes), -})); - -export const selfserviceSettingsFlowsRelations = relations(selfserviceSettingsFlows, ({ one }) => ({ - identity: one(identities, { - fields: [selfserviceSettingsFlows.identityId], - references: [identities.id], - }), - network: one(networks, { - fields: [selfserviceSettingsFlows.nid], - references: [networks.id], - }), -})); - -export const continuityContainersRelations = relations(continuityContainers, ({ one }) => ({ - identity: one(identities, { - fields: [continuityContainers.identityId], - references: [identities.id], - }), - network: one(networks, { - fields: [continuityContainers.nid], - references: [networks.id], - }), -})); - -export const sessionsRelations = relations(sessions, ({ one, many }) => ({ - identity: one(identities, { - fields: [sessions.identityId], - references: [identities.id], - }), - network: one(networks, { - fields: [sessions.nid], - references: [networks.id], - }), - sessionDevices: many(sessionDevices), -})); - -export const identityRecoveryAddressesRelations = relations(identityRecoveryAddresses, ({ one, many }) => ({ - identity: one(identities, { - fields: [identityRecoveryAddresses.identityId], - references: [identities.id], - }), - network: one(networks, { - fields: [identityRecoveryAddresses.nid], - references: [networks.id], - }), - identityRecoveryTokens: many(identityRecoveryTokens), - identityRecoveryCodes: many(identityRecoveryCodes), -})); - -export const identityVerificationTokensRelations = relations(identityVerificationTokens, ({ one }) => ({ - identityVerifiableAddress: one(identityVerifiableAddresses, { - fields: [identityVerificationTokens.identityVerifiableAddressId], - references: [identityVerifiableAddresses.id], - }), - selfserviceVerificationFlow: one(selfserviceVerificationFlows, { - fields: [identityVerificationTokens.selfserviceVerificationFlowId], - references: [selfserviceVerificationFlows.id], - }), - network: one(networks, { - fields: [identityVerificationTokens.nid], - references: [networks.id], - }), -})); - -export const selfserviceRecoveryFlowsRelations = relations(selfserviceRecoveryFlows, ({ one, many }) => ({ - identity: one(identities, { - fields: [selfserviceRecoveryFlows.recoveredIdentityId], - references: [identities.id], - }), - network: one(networks, { - fields: [selfserviceRecoveryFlows.nid], - references: [networks.id], - }), - identityRecoveryTokens: many(identityRecoveryTokens), - identityRecoveryCodes: many(identityRecoveryCodes), -})); - -export const identityRecoveryTokensRelations = relations(identityRecoveryTokens, ({ one }) => ({ - selfserviceRecoveryFlow: one(selfserviceRecoveryFlows, { - fields: [identityRecoveryTokens.selfserviceRecoveryFlowId], - references: [selfserviceRecoveryFlows.id], - }), - network: one(networks, { - fields: [identityRecoveryTokens.nid], - references: [networks.id], - }), - identityRecoveryAddress: one(identityRecoveryAddresses, { - fields: [identityRecoveryTokens.identityRecoveryAddressId], - references: [identityRecoveryAddresses.id], - }), - identity: one(identities, { - fields: [identityRecoveryTokens.identityId], - references: [identities.id], - }), -})); - -export const identityRecoveryCodesRelations = relations(identityRecoveryCodes, ({ one }) => ({ - identityRecoveryAddress: one(identityRecoveryAddresses, { - fields: [identityRecoveryCodes.identityRecoveryAddressId], - references: [identityRecoveryAddresses.id], - }), - selfserviceRecoveryFlow: one(selfserviceRecoveryFlows, { - fields: [identityRecoveryCodes.selfserviceRecoveryFlowId], - references: [selfserviceRecoveryFlows.id], - }), - identity: one(identities, { - fields: [identityRecoveryCodes.identityId], - references: [identities.id], - }), - network: one(networks, { - fields: [identityRecoveryCodes.nid], - references: [networks.id], - }), -})); - -export const sessionDevicesRelations = relations(sessionDevices, ({ one }) => ({ - session: one(sessions, { - fields: [sessionDevices.sessionId], - references: [sessions.id], - }), - network: one(networks, { - fields: [sessionDevices.nid], - references: [networks.id], - }), -})); - -export const identityVerificationCodesRelations = relations(identityVerificationCodes, ({ one }) => ({ - identityVerifiableAddress: one(identityVerifiableAddresses, { - fields: [identityVerificationCodes.identityVerifiableAddressId], - references: [identityVerifiableAddresses.id], - }), - selfserviceVerificationFlow: one(selfserviceVerificationFlows, { - fields: [identityVerificationCodes.selfserviceVerificationFlowId], - references: [selfserviceVerificationFlows.id], - }), - network: one(networks, { - fields: [identityVerificationCodes.nid], - references: [networks.id], - }), -})); - -export const courierMessageDispatchesRelations = relations(courierMessageDispatches, ({ one }) => ({ - courierMessage: one(courierMessages, { - fields: [courierMessageDispatches.messageId], - references: [courierMessages.id], - }), - network: one(networks, { - fields: [courierMessageDispatches.nid], - references: [networks.id], - }), -})); - -export const identityLoginCodesRelations = relations(identityLoginCodes, ({ one }) => ({ - selfserviceLoginFlow: one(selfserviceLoginFlows, { - fields: [identityLoginCodes.selfserviceLoginFlowId], - references: [selfserviceLoginFlows.id], - }), - network: one(networks, { - fields: [identityLoginCodes.nid], - references: [networks.id], - }), - identity: one(identities, { - fields: [identityLoginCodes.identityId], - references: [identities.id], - }), -})); - -export const identityRegistrationCodesRelations = relations(identityRegistrationCodes, ({ one }) => ({ - selfserviceRegistrationFlow: one(selfserviceRegistrationFlows, { - fields: [identityRegistrationCodes.selfserviceRegistrationFlowId], - references: [selfserviceRegistrationFlows.id], - }), - network: one(networks, { - fields: [identityRegistrationCodes.nid], - references: [networks.id], - }), -})); \ No newline at end of file diff --git a/dashboard/drizzle/schema.ts b/dashboard/drizzle/schema.ts deleted file mode 100644 index 4bd317b..0000000 --- a/dashboard/drizzle/schema.ts +++ /dev/null @@ -1,714 +0,0 @@ -import { - boolean, - char, - check, - foreignKey, - index, - integer, - json, - jsonb, - pgTable, - text, - timestamp, - unique, - uniqueIndex, - uuid, - varchar, -} from 'drizzle-orm/pg-core'; -import { sql } from 'drizzle-orm'; - -export const schema_migration = pgTable('schema_migration', { - version: varchar({ length: 48 }).notNull(), - version_self: integer('version_self').default(0).notNull(), -}, (table) => [ - uniqueIndex('schema_migration_version_idx').using('btree', table.version.asc().nullsLast().op('text_ops')), - index('schema_migration_version_self_idx').using('btree', table.version_self.asc().nullsLast().op('int4_ops')), -]); - -export const identity_credentials = pgTable('identity_credentials', { - id: uuid().primaryKey().notNull(), - config: jsonb().notNull(), - identity_credential_type_id: uuid('identity_credential_type_id').notNull(), - identity_id: uuid('identity_id').notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - nid: uuid(), - version: integer().default(0).notNull(), -}, (table) => [ - index('identity_credentials_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('identity_credentials_nid_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.id.asc().nullsLast().op('uuid_ops')), - index('identity_credentials_nid_identity_id_idx').using('btree', table.identity_id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.identity_id], - foreignColumns: [identities.id], - name: 'identity_credentials_identity_id_fkey', - }).onDelete('cascade'), - foreignKey({ - columns: [table.identity_credential_type_id], - foreignColumns: [identity_credential_types.id], - name: 'identity_credentials_identity_credential_type_id_fkey', - }).onDelete('cascade'), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'identity_credentials_nid_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const identity_credential_types = pgTable('identity_credential_types', { - id: uuid().primaryKey().notNull(), - name: varchar({ length: 32 }).notNull(), -}, (table) => [ - uniqueIndex('identity_credential_types_name_idx').using('btree', table.name.asc().nullsLast().op('text_ops')), -]); - -export const selfservice_login_flows = pgTable('selfservice_login_flows', { - id: uuid().primaryKey().notNull(), - request_url: text('request_url').notNull(), - issued_at: timestamp('issued_at', { mode: 'string' }).default(sql`current_timestamp`).notNull(), - expires_at: timestamp('expires_at', { mode: 'string' }).notNull(), - active_method: varchar('active_method', { length: 32 }).notNull(), - csrf_token: varchar('csrf_token', { length: 255 }).notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - forced: boolean().default(false).notNull(), - type: varchar({ length: 16 }).default('browser').notNull(), - ui: jsonb(), - nid: uuid(), - requested_aal: varchar('requested_aal', { length: 4 }).default('aal1').notNull(), - internal_context: jsonb('internal_context').notNull(), - oauth2login_challenge: uuid('oauth2_login_challenge'), - oauth2login_challenge_data: text('oauth2_login_challenge_data'), - state: varchar({ length: 255 }), - submit_count: integer('submit_count').default(0).notNull(), - organization_id: uuid('organization_id'), -}, (table) => [ - index('selfservice_login_flows_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('selfservice_login_flows_nid_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.id.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'selfservice_login_flows_nid_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const networks = pgTable('networks', { - id: uuid().primaryKey().notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), -}); - -export const selfservice_registration_flows = pgTable('selfservice_registration_flows', { - id: uuid().primaryKey().notNull(), - request_url: text('request_url').notNull(), - issued_at: timestamp('issued_at', { mode: 'string' }).default(sql`current_timestamp`).notNull(), - expires_at: timestamp('expires_at', { mode: 'string' }).notNull(), - active_method: varchar('active_method', { length: 32 }).notNull(), - csrf_token: varchar('csrf_token', { length: 255 }).notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - type: varchar({ length: 16 }).default('browser').notNull(), - ui: jsonb(), - nid: uuid(), - internal_context: jsonb('internal_context').notNull(), - oauth2login_challenge: uuid('oauth2_login_challenge'), - oauth2login_challenge_data: text('oauth2_login_challenge_data'), - state: varchar({ length: 255 }), - submit_count: integer('submit_count').default(0).notNull(), - organization_id: uuid('organization_id'), -}, (table) => [ - index('selfservice_registration_flows_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('selfservice_registration_flows_nid_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.id.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'selfservice_registration_flows_nid_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const identities = pgTable('identities', { - id: uuid().primaryKey().notNull(), - schema_id: varchar('schema_id', { length: 2048 }).notNull(), - traits: jsonb().notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - nid: uuid(), - state: varchar({ length: 255 }).default('active').notNull(), - state_changed_at: timestamp('state_changed_at', { mode: 'string' }), - metadata_public: jsonb('metadata_public'), - metadata_admin: jsonb('metadata_admin'), - available_aal: varchar('available_aal', { length: 4 }), - organization_id: uuid('organization_id'), -}, (table) => [ - index('identities_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('identities_nid_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.id.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'identities_nid_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const identity_credential_identifiers = pgTable('identity_credential_identifiers', { - id: uuid().primaryKey().notNull(), - identifier: varchar({ length: 255 }).notNull(), - identity_credential_id: uuid('identity_credential_id').notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - nid: uuid(), - identity_credential_type_id: uuid('identity_credential_type_id').notNull(), -}, (table) => [ - index('identity_credential_identifiers_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - uniqueIndex('identity_credential_identifiers_identifier_nid_type_uq_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.identity_credential_type_id.asc().nullsLast().op('uuid_ops'), table.identifier.asc().nullsLast().op('uuid_ops')), - index('identity_credential_identifiers_nid_i_ici_idx').using('btree', table.nid.asc().nullsLast().op('text_ops'), table.identifier.asc().nullsLast().op('text_ops'), table.identity_credential_id.asc().nullsLast().op('text_ops')), - index('identity_credential_identifiers_nid_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.id.asc().nullsLast().op('uuid_ops')), - index('identity_credential_identifiers_nid_identity_credential_id_idx').using('btree', table.identity_credential_id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.identity_credential_id], - foreignColumns: [identity_credentials.id], - name: 'identity_credential_identifiers_identity_credential_id_fkey', - }).onDelete('cascade'), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'identity_credential_identifiers_nid_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), - foreignKey({ - columns: [table.identity_credential_type_id], - foreignColumns: [identity_credential_types.id], - name: 'identity_credential_identifiers_type_id_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const identity_verifiable_addresses = pgTable('identity_verifiable_addresses', { - id: uuid().primaryKey().notNull(), - status: varchar({ length: 16 }).notNull(), - via: varchar({ length: 16 }).notNull(), - verified: boolean().notNull(), - value: varchar({ length: 400 }).notNull(), - verified_at: timestamp('verified_at', { mode: 'string' }), - identity_id: uuid('identity_id').notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - nid: uuid(), -}, (table) => [ - index('identity_verifiable_addresses_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('identity_verifiable_addresses_nid_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.id.asc().nullsLast().op('uuid_ops')), - index('identity_verifiable_addresses_nid_identity_id_idx').using('btree', table.identity_id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('identity_verifiable_addresses_status_via_idx').using('btree', table.nid.asc().nullsLast().op('text_ops'), table.via.asc().nullsLast().op('text_ops'), table.value.asc().nullsLast().op('text_ops')), - uniqueIndex('identity_verifiable_addresses_status_via_uq_idx').using('btree', table.nid.asc().nullsLast().op('text_ops'), table.via.asc().nullsLast().op('text_ops'), table.value.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.identity_id], - foreignColumns: [identities.id], - name: 'identity_verifiable_addresses_identity_id_fkey', - }).onDelete('cascade'), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'identity_verifiable_addresses_nid_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const courier_messages = pgTable('courier_messages', { - id: uuid().primaryKey().notNull(), - type: integer().notNull(), - status: integer().notNull(), - body: text().notNull(), - subject: varchar({ length: 255 }).notNull(), - recipient: varchar({ length: 255 }).notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - template_type: varchar('template_type', { length: 255 }).default('').notNull(), - // todo: failed to parse database type 'bytea' - template_data: varchar('template_data'), - nid: uuid(), - send_count: integer('send_count').default(0).notNull(), - channel: varchar({ length: 32 }), -}, (table) => [ - index('courier_messages_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('courier_messages_nid_created_at_id_idx').using('btree', table.nid.asc().nullsLast().op('timestamp_ops'), table.created_at.desc().nullsFirst().op('uuid_ops')), - index('courier_messages_nid_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.id.asc().nullsLast().op('uuid_ops')), - index('courier_messages_nid_recipient_created_at_id_idx').using('btree', table.nid.asc().nullsLast().op('timestamp_ops'), table.recipient.asc().nullsLast().op('text_ops'), table.created_at.desc().nullsFirst().op('uuid_ops')), - index('courier_messages_nid_status_created_at_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.status.asc().nullsLast().op('timestamp_ops'), table.created_at.desc().nullsFirst().op('uuid_ops')), - index('courier_messages_status_idx').using('btree', table.status.asc().nullsLast().op('int4_ops')), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'courier_messages_nid_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const selfservice_errors = pgTable('selfservice_errors', { - id: uuid().primaryKey().notNull(), - errors: jsonb().notNull(), - seen_at: timestamp('seen_at', { mode: 'string' }), - was_seen: boolean('was_seen').notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - csrf_token: varchar('csrf_token', { length: 255 }).default('').notNull(), - nid: uuid(), -}, (table) => [ - index('selfservice_errors_errors_nid_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.id.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'selfservice_errors_nid_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const selfservice_verification_flows = pgTable('selfservice_verification_flows', { - id: uuid().primaryKey().notNull(), - request_url: text('request_url').notNull(), - issued_at: timestamp('issued_at', { mode: 'string' }).default(sql`current_timestamp`).notNull(), - expires_at: timestamp('expires_at', { mode: 'string' }).notNull(), - csrf_token: varchar('csrf_token', { length: 255 }).notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - type: varchar({ length: 16 }).default('browser').notNull(), - state: varchar({ length: 255 }).default('show_form').notNull(), - active_method: varchar('active_method', { length: 32 }), - ui: jsonb(), - nid: uuid(), - submit_count: integer('submit_count').default(0).notNull(), - oauth2login_challenge: text('oauth2_login_challenge'), - session_id: uuid('session_id'), - identity_id: uuid('identity_id'), - authentication_methods: json('authentication_methods'), -}, (table) => [ - index('selfservice_verification_flows_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('selfservice_verification_flows_nid_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.id.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'selfservice_verification_flows_nid_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const selfservice_settings_flows = pgTable('selfservice_settings_flows', { - id: uuid().primaryKey().notNull(), - request_url: text('request_url').notNull(), - issued_at: timestamp('issued_at', { mode: 'string' }).default(sql`current_timestamp`).notNull(), - expires_at: timestamp('expires_at', { mode: 'string' }).notNull(), - identity_id: uuid('identity_id').notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - active_method: varchar('active_method', { length: 32 }), - state: varchar({ length: 255 }).default('show_form').notNull(), - type: varchar({ length: 16 }).default('browser').notNull(), - ui: jsonb(), - nid: uuid(), - internal_context: jsonb('internal_context').notNull(), -}, (table) => [ - index('selfservice_settings_flows_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('selfservice_settings_flows_identity_id_nid_idx').using('btree', table.identity_id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('selfservice_settings_flows_nid_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.id.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.identity_id], - foreignColumns: [identities.id], - name: 'selfservice_profile_management_requests_identity_id_fkey', - }).onDelete('cascade'), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'selfservice_settings_flows_nid_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const continuity_containers = pgTable('continuity_containers', { - id: uuid().primaryKey().notNull(), - identity_id: uuid('identity_id'), - name: varchar({ length: 255 }).notNull(), - payload: jsonb(), - expires_at: timestamp('expires_at', { mode: 'string' }).notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - nid: uuid(), -}, (table) => [ - index('continuity_containers_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('continuity_containers_identity_id_nid_idx').using('btree', table.identity_id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('continuity_containers_nid_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.id.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.identity_id], - foreignColumns: [identities.id], - name: 'continuity_containers_identity_id_fkey', - }).onDelete('cascade'), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'continuity_containers_nid_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const sessions = pgTable('sessions', { - id: uuid().primaryKey().notNull(), - issued_at: timestamp('issued_at', { mode: 'string' }).default(sql`current_timestamp`).notNull(), - expires_at: timestamp('expires_at', { mode: 'string' }).notNull(), - authenticated_at: timestamp('authenticated_at', { mode: 'string' }).notNull(), - identity_id: uuid('identity_id').notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - token: varchar({ length: 39 }), - active: boolean().default(false), - nid: uuid(), - logout_token: varchar('logout_token', { length: 39 }), - aal: varchar({ length: 4 }).default('aal1').notNull(), - authentication_methods: jsonb('authentication_methods').notNull(), -}, (table) => [ - index('sessions_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('sessions_identity_id_nid_sorted_idx').using('btree', table.identity_id.asc().nullsLast().op('timestamp_ops'), table.nid.asc().nullsLast().op('timestamp_ops'), table.authenticated_at.desc().nullsFirst().op('uuid_ops')), - uniqueIndex('sessions_logout_token_uq_idx').using('btree', table.logout_token.asc().nullsLast().op('text_ops')), - index('sessions_nid_created_at_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.created_at.desc().nullsFirst().op('uuid_ops'), table.id.asc().nullsLast().op('uuid_ops')), - index('sessions_nid_id_identity_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.identity_id.asc().nullsLast().op('uuid_ops'), table.id.asc().nullsLast().op('uuid_ops')), - index('sessions_token_nid_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.token.asc().nullsLast().op('text_ops')), - uniqueIndex('sessions_token_uq_idx').using('btree', table.token.asc().nullsLast().op('text_ops')), - foreignKey({ - columns: [table.identity_id], - foreignColumns: [identities.id], - name: 'sessions_identity_id_fkey', - }).onDelete('cascade'), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'sessions_nid_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const identity_recovery_addresses = pgTable('identity_recovery_addresses', { - id: uuid().primaryKey().notNull(), - via: varchar({ length: 16 }).notNull(), - value: varchar({ length: 400 }).notNull(), - identity_id: uuid('identity_id').notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - nid: uuid(), -}, (table) => [ - index('identity_recovery_addresses_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('identity_recovery_addresses_nid_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.id.asc().nullsLast().op('uuid_ops')), - index('identity_recovery_addresses_nid_identity_id_idx').using('btree', table.identity_id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('identity_recovery_addresses_status_via_idx').using('btree', table.nid.asc().nullsLast().op('text_ops'), table.via.asc().nullsLast().op('text_ops'), table.value.asc().nullsLast().op('text_ops')), - uniqueIndex('identity_recovery_addresses_status_via_uq_idx').using('btree', table.nid.asc().nullsLast().op('text_ops'), table.via.asc().nullsLast().op('text_ops'), table.value.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.identity_id], - foreignColumns: [identities.id], - name: 'identity_recovery_addresses_identity_id_fkey', - }).onDelete('cascade'), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'identity_recovery_addresses_nid_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const identity_verification_tokens = pgTable('identity_verification_tokens', { - id: uuid().primaryKey().notNull(), - token: varchar({ length: 64 }).notNull(), - used: boolean().default(false).notNull(), - used_at: timestamp('used_at', { mode: 'string' }), - expires_at: timestamp('expires_at', { mode: 'string' }).notNull(), - issued_at: timestamp('issued_at', { mode: 'string' }).notNull(), - identity_verifiable_address_id: uuid('identity_verifiable_address_id').notNull(), - selfservice_verification_flow_id: uuid('selfservice_verification_flow_id').notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - nid: uuid(), -}, (table) => [ - index('identity_verification_tokens_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('identity_verification_tokens_nid_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.id.asc().nullsLast().op('uuid_ops')), - index('identity_verification_tokens_token_nid_used_flow_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.token.asc().nullsLast().op('bool_ops'), table.used.asc().nullsLast().op('text_ops'), table.selfservice_verification_flow_id.asc().nullsLast().op('uuid_ops')), - uniqueIndex('identity_verification_tokens_token_uq_idx').using('btree', table.token.asc().nullsLast().op('text_ops')), - index('identity_verification_tokens_verifiable_address_id_idx').using('btree', table.identity_verifiable_address_id.asc().nullsLast().op('uuid_ops')), - index('identity_verification_tokens_verification_flow_id_idx').using('btree', table.selfservice_verification_flow_id.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.identity_verifiable_address_id], - foreignColumns: [identity_verifiable_addresses.id], - name: 'identity_verification_tokens_identity_verifiable_address_i_fkey', - }).onDelete('cascade'), - foreignKey({ - columns: [table.selfservice_verification_flow_id], - foreignColumns: [selfservice_verification_flows.id], - name: 'identity_verification_tokens_selfservice_verification_flow_fkey', - }).onDelete('cascade'), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'identity_verification_tokens_nid_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const selfservice_recovery_flows = pgTable('selfservice_recovery_flows', { - id: uuid().primaryKey().notNull(), - request_url: text('request_url').notNull(), - issued_at: timestamp('issued_at', { mode: 'string' }).default(sql`current_timestamp`).notNull(), - expires_at: timestamp('expires_at', { mode: 'string' }).notNull(), - active_method: varchar('active_method', { length: 32 }), - csrf_token: varchar('csrf_token', { length: 255 }).notNull(), - state: varchar({ length: 32 }).notNull(), - recovered_identity_id: uuid('recovered_identity_id'), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - type: varchar({ length: 16 }).default('browser').notNull(), - ui: jsonb(), - nid: uuid(), - submit_count: integer('submit_count').default(0).notNull(), - skip_csrf_check: boolean('skip_csrf_check').default(false).notNull(), -}, (table) => [ - index('selfservice_recovery_flows_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('selfservice_recovery_flows_nid_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.id.asc().nullsLast().op('uuid_ops')), - index('selfservice_recovery_flows_recovered_identity_id_nid_idx').using('btree', table.recovered_identity_id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.recovered_identity_id], - foreignColumns: [identities.id], - name: 'selfservice_recovery_requests_recovered_identity_id_fkey', - }).onDelete('cascade'), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'selfservice_recovery_flows_nid_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const identity_recovery_tokens = pgTable('identity_recovery_tokens', { - id: uuid().primaryKey().notNull(), - token: varchar({ length: 64 }).notNull(), - used: boolean().default(false).notNull(), - used_at: timestamp('used_at', { mode: 'string' }), - identity_recovery_address_id: uuid('identity_recovery_address_id'), - selfservice_recovery_flow_id: uuid('selfservice_recovery_flow_id'), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - expires_at: timestamp('expires_at', { mode: 'string' }).default('2000-01-01 00:00:00').notNull(), - issued_at: timestamp('issued_at', { mode: 'string' }).default('2000-01-01 00:00:00').notNull(), - nid: uuid(), - identity_id: uuid('identity_id').notNull(), - token_type: integer('token_type').default(0).notNull(), -}, (table) => [ - uniqueIndex('identity_recovery_addresses_code_uq_idx').using('btree', table.token.asc().nullsLast().op('text_ops')), - index('identity_recovery_tokens_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('identity_recovery_tokens_identity_id_nid_idx').using('btree', table.identity_id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('identity_recovery_tokens_identity_recovery_address_id_idx').using('btree', table.identity_recovery_address_id.asc().nullsLast().op('uuid_ops')), - index('identity_recovery_tokens_nid_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.id.asc().nullsLast().op('uuid_ops')), - index('identity_recovery_tokens_selfservice_recovery_flow_id_idx').using('btree', table.selfservice_recovery_flow_id.asc().nullsLast().op('uuid_ops')), - index('identity_recovery_tokens_token_nid_used_idx').using('btree', table.nid.asc().nullsLast().op('bool_ops'), table.token.asc().nullsLast().op('text_ops'), table.used.asc().nullsLast().op('bool_ops')), - foreignKey({ - columns: [table.selfservice_recovery_flow_id], - foreignColumns: [selfservice_recovery_flows.id], - name: 'identity_recovery_tokens_selfservice_recovery_request_id_fkey', - }).onDelete('cascade'), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'identity_recovery_tokens_nid_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), - foreignKey({ - columns: [table.identity_recovery_address_id], - foreignColumns: [identity_recovery_addresses.id], - name: 'identity_recovery_tokens_identity_recovery_address_id_fkey', - }).onDelete('cascade'), - foreignKey({ - columns: [table.identity_id], - foreignColumns: [identities.id], - name: 'identity_recovery_tokens_identity_id_fk_idx', - }).onUpdate('restrict').onDelete('cascade'), - check('identity_recovery_tokens_token_type_ck', sql`(token_type = 1) - or - (token_type = 2)`), -]); - -export const identity_recovery_codes = pgTable('identity_recovery_codes', { - id: uuid().primaryKey().notNull(), - code: varchar({ length: 64 }).notNull(), - used_at: timestamp('used_at', { mode: 'string' }), - identity_recovery_address_id: uuid('identity_recovery_address_id'), - code_type: integer('code_type').notNull(), - expires_at: timestamp('expires_at', { mode: 'string' }).default('2000-01-01 00:00:00').notNull(), - issued_at: timestamp('issued_at', { mode: 'string' }).default('2000-01-01 00:00:00').notNull(), - selfservice_recovery_flow_id: uuid('selfservice_recovery_flow_id').notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - nid: uuid().notNull(), - identity_id: uuid('identity_id').notNull(), -}, (table) => [ - index('identity_recovery_codes_flow_id_idx').using('btree', table.selfservice_recovery_flow_id.asc().nullsLast().op('uuid_ops')), - index('identity_recovery_codes_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('identity_recovery_codes_identity_id_nid_idx').using('btree', table.identity_id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('identity_recovery_codes_identity_recovery_address_id_nid_idx').using('btree', table.identity_recovery_address_id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('identity_recovery_codes_nid_flow_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.selfservice_recovery_flow_id.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.identity_recovery_address_id], - foreignColumns: [identity_recovery_addresses.id], - name: 'identity_recovery_codes_identity_recovery_addresses_id_fk', - }).onDelete('cascade'), - foreignKey({ - columns: [table.selfservice_recovery_flow_id], - foreignColumns: [selfservice_recovery_flows.id], - name: 'identity_recovery_codes_selfservice_recovery_flows_id_fk', - }).onDelete('cascade'), - foreignKey({ - columns: [table.identity_id], - foreignColumns: [identities.id], - name: 'identity_recovery_codes_identity_id_fk', - }).onUpdate('restrict').onDelete('cascade'), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'identity_recovery_codes_networks_id_fk', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const session_devices = pgTable('session_devices', { - id: uuid().primaryKey().notNull(), - ip_address: varchar('ip_address', { length: 50 }).default(''), - user_agent: varchar('user_agent', { length: 512 }).default(''), - location: varchar({ length: 512 }).default(''), - nid: uuid().notNull(), - session_id: uuid('session_id').notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), -}, (table) => [ - index('session_devices_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('session_devices_session_id_nid_idx').using('btree', table.session_id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.session_id], - foreignColumns: [sessions.id], - name: 'session_metadata_sessions_id_fk', - }).onDelete('cascade'), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'session_metadata_nid_fk', - }).onDelete('cascade'), - unique('unique_session_device').on(table.ip_address, table.user_agent, table.nid, table.session_id), -]); - -export const identity_verification_codes = pgTable('identity_verification_codes', { - id: uuid().primaryKey().notNull(), - code_hmac: varchar('code_hmac', { length: 64 }).notNull(), - used_at: timestamp('used_at', { mode: 'string' }), - identity_verifiable_address_id: uuid('identity_verifiable_address_id'), - expires_at: timestamp('expires_at', { mode: 'string' }).default('2000-01-01 00:00:00').notNull(), - issued_at: timestamp('issued_at', { mode: 'string' }).default('2000-01-01 00:00:00').notNull(), - selfservice_verification_flow_id: uuid('selfservice_verification_flow_id').notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), - nid: uuid().notNull(), -}, (table) => [ - index('identity_verification_codes_flow_id_idx').using('btree', table.selfservice_verification_flow_id.asc().nullsLast().op('uuid_ops')), - index('identity_verification_codes_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('identity_verification_codes_nid_flow_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.selfservice_verification_flow_id.asc().nullsLast().op('uuid_ops')), - index('identity_verification_codes_verifiable_address_nid_idx').using('btree', table.identity_verifiable_address_id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.identity_verifiable_address_id], - foreignColumns: [identity_verifiable_addresses.id], - name: 'identity_verification_codes_identity_verifiable_addresses_id_fk', - }).onDelete('cascade'), - foreignKey({ - columns: [table.selfservice_verification_flow_id], - foreignColumns: [selfservice_verification_flows.id], - name: 'identity_verification_codes_selfservice_verification_flows_id_f', - }).onDelete('cascade'), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'identity_verification_codes_networks_id_fk', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const courier_message_dispatches = pgTable('courier_message_dispatches', { - id: uuid().primaryKey().notNull(), - message_id: uuid('message_id').notNull(), - status: varchar({ length: 7 }).notNull(), - error: json(), - nid: uuid().notNull(), - created_at: timestamp('created_at', { mode: 'string' }).default(sql`current_timestamp`).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).default(sql`current_timestamp`).notNull(), -}, (table) => [ - index('courier_message_dispatches_message_id_idx').using('btree', table.message_id.asc().nullsLast().op('timestamp_ops'), table.created_at.desc().nullsFirst().op('timestamp_ops')), - index('courier_message_dispatches_nid_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.message_id], - foreignColumns: [courier_messages.id], - name: 'courier_message_dispatches_message_id_fk', - }).onDelete('cascade'), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'courier_message_dispatches_nid_fk', - }).onDelete('cascade'), -]); - -export const session_token_exchanges = pgTable('session_token_exchanges', { - id: uuid().primaryKey().notNull(), - nid: uuid().notNull(), - flow_id: uuid('flow_id').notNull(), - session_id: uuid('session_id'), - init_code: varchar('init_code', { length: 64 }).notNull(), - return_to_code: varchar('return_to_code', { length: 64 }).notNull(), - created_at: timestamp('created_at', { mode: 'string' }).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).notNull(), -}, (table) => [ - index('session_token_exchanges_nid_code_idx').using('btree', table.init_code.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('text_ops')), - index('session_token_exchanges_nid_flow_id_idx').using('btree', table.flow_id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), -]); - -export const identity_login_codes = pgTable('identity_login_codes', { - id: uuid().primaryKey().notNull(), - code: varchar({ length: 64 }).notNull(), - address: varchar({ length: 255 }).notNull(), - address_type: char('address_type', { length: 36 }).notNull(), - used_at: timestamp('used_at', { mode: 'string' }), - expires_at: timestamp('expires_at', { mode: 'string' }).default('2000-01-01 00:00:00').notNull(), - issued_at: timestamp('issued_at', { mode: 'string' }).default('2000-01-01 00:00:00').notNull(), - selfservice_login_flow_id: uuid('selfservice_login_flow_id').notNull(), - identity_id: uuid('identity_id').notNull(), - created_at: timestamp('created_at', { mode: 'string' }).default(sql`current_timestamp`).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).default(sql`current_timestamp`).notNull(), - nid: uuid().notNull(), -}, (table) => [ - index('identity_login_codes_flow_id_idx').using('btree', table.selfservice_login_flow_id.asc().nullsLast().op('uuid_ops')), - index('identity_login_codes_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('identity_login_codes_identity_id_idx').using('btree', table.identity_id.asc().nullsLast().op('uuid_ops')), - index('identity_login_codes_nid_flow_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.selfservice_login_flow_id.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.selfservice_login_flow_id], - foreignColumns: [selfservice_login_flows.id], - name: 'identity_login_codes_selfservice_login_flows_id_fk', - }).onDelete('cascade'), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'identity_login_codes_networks_id_fk', - }).onUpdate('restrict').onDelete('cascade'), - foreignKey({ - columns: [table.identity_id], - foreignColumns: [identities.id], - name: 'identity_login_codes_identity_id_fk', - }).onUpdate('restrict').onDelete('cascade'), -]); - -export const identity_registration_codes = pgTable('identity_registration_codes', { - id: uuid().primaryKey().notNull(), - code: varchar({ length: 64 }).notNull(), - address: varchar({ length: 255 }).notNull(), - address_type: char('address_type', { length: 36 }).notNull(), - used_at: timestamp('used_at', { mode: 'string' }), - expires_at: timestamp('expires_at', { mode: 'string' }).default('2000-01-01 00:00:00').notNull(), - issued_at: timestamp('issued_at', { mode: 'string' }).default('2000-01-01 00:00:00').notNull(), - selfservice_registration_flow_id: uuid('selfservice_registration_flow_id').notNull(), - created_at: timestamp('created_at', { mode: 'string' }).default(sql`current_timestamp`).notNull(), - updated_at: timestamp('updated_at', { mode: 'string' }).default(sql`current_timestamp`).notNull(), - nid: uuid().notNull(), -}, (table) => [ - index('identity_registration_codes_flow_id_idx').using('btree', table.selfservice_registration_flow_id.asc().nullsLast().op('uuid_ops')), - index('identity_registration_codes_id_nid_idx').using('btree', table.id.asc().nullsLast().op('uuid_ops'), table.nid.asc().nullsLast().op('uuid_ops')), - index('identity_registration_codes_nid_flow_id_idx').using('btree', table.nid.asc().nullsLast().op('uuid_ops'), table.selfservice_registration_flow_id.asc().nullsLast().op('uuid_ops')), - foreignKey({ - columns: [table.selfservice_registration_flow_id], - foreignColumns: [selfservice_registration_flows.id], - name: 'identity_registration_codes_selfservice_registration_flows_id_f', - }).onDelete('cascade'), - foreignKey({ - columns: [table.nid], - foreignColumns: [networks.id], - name: 'identity_registration_codes_networks_id_fk', - }).onUpdate('restrict').onDelete('cascade'), -]); diff --git a/dashboard/package.json b/dashboard/package.json index 9641b8b..569f906 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -20,7 +20,7 @@ "@radix-ui/react-label": "^2.0.2", "@radix-ui/react-scroll-area": "^1.0.5", "@radix-ui/react-separator": "^1.1.0", - "@radix-ui/react-slot": "^1.1.1", + "@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-tabs": "^1.1.1", "@radix-ui/react-tooltip": "^1.1.4", "@serwist/next": "^9.0.0-preview.21", @@ -30,13 +30,10 @@ "@tanstack/react-table": "^8.20.5", "class-variance-authority": "^0.7.1", "clsx": "^2.1.0", - "dotenv": "^16.4.7", - "drizzle-orm": "^0.38.3", "lucide-react": "^0.462.0", "next": "15.0.3", "next-themes": "^0.4.3", "oslo": "^1.1.3", - "pg": "^8.13.1", "react": "19.0.0-rc-66855b96-20241106", "react-dom": "19.0.0-rc-66855b96-20241106", "react-hook-form": "^7.51.0", @@ -46,22 +43,18 @@ "tailwindcss-animate": "^1.0.7", "ua-parser-js": "^2.0.0", "usehooks-ts": "^3.1.0", - "zod": "^3.22.4", - "zod_utilz": "^0.8.3" + "zod": "^3.22.4" }, "devDependencies": { "@types/node": "^22.9.3", - "@types/pg": "^8.11.10", "@types/react": "npm:types-react@19.0.0-rc.1", "@types/react-dom": "npm:types-react-dom@19.0.0-rc.1", "autoprefixer": "^10.0.1", - "drizzle-kit": "^0.30.1", "eslint": "^8", "eslint-config-next": "15.0.3", "postcss": "^8", "tailwindcss": "^3.3.0", "ts-node": "^10.9.2", - "tsx": "^4.19.2", "typescript": "^5.4.2" }, "overrides": { diff --git a/dashboard/src/app/(inside)/analytics/page.tsx b/dashboard/src/app/(inside)/analytics/page.tsx deleted file mode 100644 index 998087c..0000000 --- a/dashboard/src/app/(inside)/analytics/page.tsx +++ /dev/null @@ -1,12 +0,0 @@ -export default async function AnalyticsPage() { - return ( -
-
-

Analytics

-

- Part of milestone v0.5.0 -

-
-
- ); -} diff --git a/dashboard/src/app/(inside)/application/page.tsx b/dashboard/src/app/(inside)/application/page.tsx new file mode 100644 index 0000000..eda2025 --- /dev/null +++ b/dashboard/src/app/(inside)/application/page.tsx @@ -0,0 +1,3 @@ +export default async function ApplicationPage() { + return <>; +} diff --git a/dashboard/src/app/(inside)/client/data-table.tsx b/dashboard/src/app/(inside)/client/data-table.tsx deleted file mode 100644 index 2e347db..0000000 --- a/dashboard/src/app/(inside)/client/data-table.tsx +++ /dev/null @@ -1,105 +0,0 @@ -'use client'; - -import { ColumnDef } from '@tanstack/react-table'; -import { OAuth2Client } from '@ory/client'; -import { DataTable } from '@/components/ui/data-table'; -import { useEffect, useRef, useState } from 'react'; -import { Spinner } from '@/components/ui/spinner'; -import { FetchClientPageProps } from '@/app/(inside)/client/page'; - -interface ClientDataTableProps { - data: OAuth2Client[]; - pageSize: number; - pageToken: string | undefined; - fetchClientPage: (props: FetchClientPageProps) => Promise<{ - data: OAuth2Client[], - tokens: Map - }>; -} - -export function ClientDataTable( - { - data, - pageSize, - pageToken, - fetchClientPage, - }: ClientDataTableProps, -) { - - console.log('OAuth2 client', data); - - const columns: ColumnDef[] = [ - { - id: 'client_id', - accessorKey: 'client_id', - header: 'Client ID', - }, - { - id: 'client_name', - accessorKey: 'client_name', - header: 'Client Name', - }, - { - id: 'owner', - accessorKey: 'owner', - header: 'Owner', - }, - ]; - - const [items, setItems] = useState(data); - const [nextToken, setNextToken] = useState(pageToken); - - // react on changes from ssr (query params) - useEffect(() => { - setItems(data); - setNextToken(pageToken); - }, [data, pageSize, pageToken]); - - // infinite scroll handling - const infiniteScrollSensor = useRef(null); - useEffect(() => { - const observer = new IntersectionObserver( - (entries) => { - if (entries[0].isIntersecting) { - fetchMore(); - } - }, - { threshold: 0.5 }, // Adjust threshold as needed - ); - - if (infiniteScrollSensor.current) { - observer.observe(infiniteScrollSensor.current); - } - - return () => { - if (infiniteScrollSensor.current) { - observer.unobserve(infiniteScrollSensor.current); - } - }; - }, [items]); - - const fetchMore = async () => { - if (!nextToken) return; - - const response = await fetchClientPage({ - pageSize: pageSize, - pageToken: nextToken, - }); - - setItems([...items, ...response.data]); - setNextToken(response.tokens.get('next') ?? undefined); - }; - - return ( - <> - - { - nextToken && ( -
- -
- ) - } - - ); -} diff --git a/dashboard/src/app/(inside)/client/page.tsx b/dashboard/src/app/(inside)/client/page.tsx deleted file mode 100644 index 0d3f5a3..0000000 --- a/dashboard/src/app/(inside)/client/page.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { getOAuth2Api } from '@/ory/sdk/server'; -import { ClientDataTable } from '@/app/(inside)/client/data-table'; - -export interface FetchClientPageProps { - pageSize: number; - pageToken: string; -} - -function parseTokens(link: string) { - - const parsed = link.split(',').map((it) => { - const startRel = it.lastIndexOf('rel="'); - const endRel = it.lastIndexOf('"'); - const rel = it.slice(startRel, endRel); - - const startToken = it.lastIndexOf('page_token='); - const endToken = it.lastIndexOf('&'); - const token = it.slice(startToken, endToken); - - return [rel, token]; - }); - - return new Map(parsed.map(obj => [ - obj[0].replace('rel="', ''), - obj[1].replace('page_token=', ''), - ])); -} - -async function fetchClientPage({ pageSize, pageToken }: FetchClientPageProps) { - 'use server'; - - const oAuth2Api = await getOAuth2Api(); - const response = await oAuth2Api.listOAuth2Clients({ - pageSize: pageSize, - pageToken: pageToken, - }); - - return { - data: response.data, - tokens: parseTokens(response.headers.link), - }; -} - -export default async function ListClientPage() { - - let pageSize = 100; - let pageToken: string = '00000000-0000-0000-0000-000000000000'; - - const initialFetch = await fetchClientPage({ pageSize, pageToken }); - - return ( -
-
-

OAuth2 Clients

-

- See and manage all OAuth2 clients registered with your Ory Hydra instance -

-
- -
- ); -} diff --git a/dashboard/src/app/(inside)/layout.tsx b/dashboard/src/app/(inside)/layout.tsx index d7f42e7..5c8f890 100644 --- a/dashboard/src/app/(inside)/layout.tsx +++ b/dashboard/src/app/(inside)/layout.tsx @@ -10,8 +10,8 @@ export default function InsideLayout({ children }: Readonly<{ children: React.Re return ( - -
+ +
{ @@ -27,7 +27,7 @@ export default function InsideLayout({ children }: Readonly<{ children: React.Re
-
+
{children}
diff --git a/dashboard/src/app/(inside)/page.tsx b/dashboard/src/app/(inside)/page.tsx index 604a7e2..cf379ab 100644 --- a/dashboard/src/app/(inside)/page.tsx +++ b/dashboard/src/app/(inside)/page.tsx @@ -1,40 +1,49 @@ import { getHydraMetadataApi, getKetoMetadataApi, getKratosMetadataApi } from '@/ory/sdk/server'; -import { MetadataApiReady, StatusCard } from '@/components/status-card'; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; +import { Badge } from '@/components/ui/badge'; export default async function RootPage() { const kratosMetadataApi = await getKratosMetadataApi(); - const kratosVersion = await kratosMetadataApi.getVersion() + + const kratosVersion = await kratosMetadataApi + .getVersion() .then(res => res.data.version) - .catch(() => undefined); - const kratosStatus = await fetch(process.env.ORY_KRATOS_ADMIN_URL + '/health/ready') - .then((response) => response.json() as MetadataApiReady) - .catch(() => { - return { errors: ['No instance running'] } as MetadataApiReady; - }); + .catch(() => ''); + + const kratosStatusData = await fetch(process.env.ORY_KRATOS_ADMIN_URL + '/health/alive'); + const kratosStatus = await kratosStatusData.json() as { status: string }; + + const kratosDBStatusData = await fetch(process.env.ORY_KRATOS_ADMIN_URL + '/health/ready'); + const kratosDBStatus = await kratosDBStatusData.json() as { status: string }; const hydraMetadataApi = await getHydraMetadataApi(); - const hydraVersion = await hydraMetadataApi.getVersion() + + const hydraVersion = await hydraMetadataApi + .getVersion() .then(res => res.data.version) - .catch(() => undefined); - const hydraStatus = await fetch(process.env.ORY_HYDRA_ADMIN_URL + '/health/ready') - .then((response) => response.json() as MetadataApiReady) - .catch(() => { - return { errors: ['No instance running'] } as MetadataApiReady; - }); + .catch(() => ''); + + const hydraStatusData = await fetch(process.env.ORY_KRATOS_ADMIN_URL + '/health/alive'); + const hydraStatus = await hydraStatusData.json() as { status: string }; + + const hydraDBStatusData = await fetch(process.env.ORY_KRATOS_ADMIN_URL + '/health/ready'); + const hydraDBStatus = await hydraDBStatusData.json() as { status: string }; const ketoMetadataApi = await getKetoMetadataApi(); - const ketoVersion = await ketoMetadataApi.getVersion() - .then(res => res.data.version) - .catch(() => undefined); - const ketoStatus = await fetch(process.env.ORY_KETO_ADMIN_URL + '/health/ready') - .then((response) => response.json() as MetadataApiReady) - .catch(() => { - return { errors: ['No instance running'] } as MetadataApiReady; - }); + const ketoVersion = await ketoMetadataApi + .getVersion() + .then(res => res.data.version) + .catch(() => ''); + + const ketoStatusData = await fetch(process.env.ORY_KETO_ADMIN_URL + '/health/alive'); + const ketoStatus = await ketoStatusData.json() as { status: string }; + + const ketoDBStatusData = await fetch(process.env.ORY_KETO_ADMIN_URL + '/health/ready'); + const ketoDBStatus = await ketoDBStatusData.json() as { status: string }; return (
@@ -43,25 +52,61 @@ export default async function RootPage() {

See the list of all applications in your stack

- - - -
+ + + + Ory Kratos + + + Version {kratosVersion} + + + + + Kratos {kratosStatus.status.toUpperCase()} + + + Database {kratosDBStatus.status.toUpperCase()} + + + + + + + Ory Hydra + + + Version {hydraVersion} + + + + + Hydra {hydraStatus.status.toUpperCase()} + + + Database {hydraDBStatus.status.toUpperCase()} + + + + + + + Ory Keto + + + Version {ketoVersion} + + + + + Keto {ketoStatus.status.toUpperCase()} + + + Database {ketoDBStatus.status.toUpperCase()} + + + +
); diff --git a/dashboard/src/app/(inside)/relation/page.tsx b/dashboard/src/app/(inside)/relation/page.tsx deleted file mode 100644 index e6754a9..0000000 --- a/dashboard/src/app/(inside)/relation/page.tsx +++ /dev/null @@ -1,12 +0,0 @@ -export default async function ListRelationPage() { - return ( -
-
-

Relations

-

- Part of milestone v0.4.0 -

-
-
- ); -} diff --git a/dashboard/src/app/(inside)/user/[id]/page.tsx b/dashboard/src/app/(inside)/user/[id]/page.tsx index 83cc3b3..44806a3 100644 --- a/dashboard/src/app/(inside)/user/[id]/page.tsx +++ b/dashboard/src/app/(inside)/user/[id]/page.tsx @@ -2,15 +2,13 @@ import React from 'react'; import { getIdentityApi } from '@/ory/sdk/server'; import { ErrorDisplay } from '@/components/error'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; -import { IdentityTraits } from '@/components/identity/identity-traits'; +import { IdentityTraitForm } from '@/components/forms/IdentityTraitForm'; import { KratosSchema } from '@/lib/forms/identity-form'; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'; import { UAParser } from 'ua-parser-js'; import { RecoveryIdentityAddress, VerifiableIdentityAddress } from '@ory/client'; import { Badge } from '@/components/ui/badge'; import { Check, X } from 'lucide-react'; -import { IdentityActions } from '@/components/identity/identity-actions'; -import { IdentityCredentials } from '@/components/identity/identity-credentials'; interface MergedAddress { recovery_id?: string; @@ -89,7 +87,10 @@ export default async function UserDetailsPage({ params }: { params: Promise<{ id }); const sessions = await identityApi.listIdentitySessions({ id: identityId }) - .then((response) => response.data) + .then((response) => { + console.log('sessions', response.data); + return response.data; + }) .catch(() => { console.log('No sessions found'); }); @@ -121,23 +122,14 @@ export default async function UserDetailsPage({ params }: { params: Promise<{ id

{addresses[0].value}

{identity.id}

-
- +
+ Traits All identity properties specified in the identity schema - - - - - - Actions - Quick actions to manage the identity - - - + @@ -191,7 +183,26 @@ export default async function UserDetailsPage({ params }: { params: Promise<{ id All authentication mechanisms registered with this identity - + + + + Type + Value + + + + { + Object.entries(identity.credentials!).map(([key, value]) => { + return ( + + {key} + {value.identifiers![0]} + + ); + }) + } + +
diff --git a/dashboard/src/app/(inside)/user/action.ts b/dashboard/src/app/(inside)/user/action.ts new file mode 100644 index 0000000..4c393cc --- /dev/null +++ b/dashboard/src/app/(inside)/user/action.ts @@ -0,0 +1,66 @@ +'use server'; + +import { getIdentityApi } from '@/ory/sdk/server'; +import { revalidatePath } from 'next/cache'; + +interface IdentityIdProps { + id: string; +} + +export async function deleteIdentitySessions({ id }: IdentityIdProps) { + + const identityApi = await getIdentityApi(); + const { data } = await identityApi.deleteIdentitySessions({ id }); + + console.log('Deleted identity\'s sessions', data); + + return data; +} + +export async function blockIdentity({ id }: IdentityIdProps) { + + const identityApi = await getIdentityApi(); + const { data } = await identityApi.patchIdentity({ + id, + jsonPatch: [ + { + op: 'replace', + path: '/state', + value: 'inactive', + }, + ], + }); + + console.log('Blocked identity', data); + + revalidatePath('/user'); +} + +export async function unblockIdentity({ id }: IdentityIdProps) { + + const identityApi = await getIdentityApi(); + const { data } = await identityApi.patchIdentity({ + id, + jsonPatch: [ + { + op: 'replace', + path: '/state', + value: 'active', + }, + ], + }); + + console.log('Unblocked identity', data); + + revalidatePath('/user'); +} + +export async function deleteIdentity({ id }: IdentityIdProps) { + + const identityApi = await getIdentityApi(); + const { data } = await identityApi.deleteIdentity({ id }); + + console.log('Deleted identity', data); + + revalidatePath('/user'); +} diff --git a/dashboard/src/app/(inside)/user/data-table.tsx b/dashboard/src/app/(inside)/user/data-table.tsx index 510ee6c..6476d7f 100644 --- a/dashboard/src/app/(inside)/user/data-table.tsx +++ b/dashboard/src/app/(inside)/user/data-table.tsx @@ -4,7 +4,10 @@ import { ColumnDef } from '@tanstack/react-table'; import { Identity } from '@ory/client'; import { DataTable } from '@/components/ui/data-table'; import { CircleCheck, CircleX, Copy, MoreHorizontal, Trash, UserCheck, UserMinus, UserPen, UserX } from 'lucide-react'; -import React, { useEffect, useState } from 'react'; +import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card'; +import React, { useEffect, useRef, useState } from 'react'; +import { FetchIdentityPageProps } from '@/app/(inside)/user/page'; +import { Spinner } from '@/components/ui/spinner'; import { DropdownMenu, DropdownMenuContent, @@ -13,7 +16,7 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; -import { Button, buttonVariants } from '@/components/ui/button'; +import { Button } from '@/components/ui/button'; import Link from 'next/link'; import { toast } from 'sonner'; import { @@ -26,16 +29,17 @@ import { AlertDialogHeader, AlertDialogTitle, } from '@/components/ui/alert-dialog'; -import { blockIdentity, deleteIdentity, deleteIdentitySessions, unblockIdentity } from '@/lib/action/identity'; -import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'; +import { blockIdentity, deleteIdentity, deleteIdentitySessions, unblockIdentity } from '@/app/(inside)/user/action'; interface IdentityDataTableProps { data: Identity[]; - page: number; + pageSize: number; + pageToken: string | undefined; query: string; + fetchIdentityPage: (props: FetchIdentityPageProps) => Promise<{ data: Identity[], tokens: Map }>; } -export function IdentityDataTable({ data, page, query }: IdentityDataTableProps) { +export function IdentityDataTable({ data, pageSize, pageToken, query, fetchIdentityPage }: IdentityDataTableProps) { const columns: ColumnDef[] = [ { @@ -77,24 +81,27 @@ export function IdentityDataTable({ data, page, query }: IdentityDataTableProps) return (
{email.value} - - - { - email.verified ? : - } - - - { - email.verified ? - <> - This email was confirmed at - {new Date(email.verified_at!!).toLocaleString()} - - : -

This email is not confirmed yet

- } -
-
+ { + email.verified ? + + + + + + This email was confirmed at + {new Date(email.verified_at!!).toLocaleString()} + + + : + + + + + + This email is not confirmed yet + + + }
); } @@ -182,10 +189,49 @@ export function IdentityDataTable({ data, page, query }: IdentityDataTableProps) ]; const [items, setItems] = useState(data); + const [nextToken, setNextToken] = useState(pageToken); + // react on changes from ssr (query params) useEffect(() => { setItems(data); - }, [data]); + setNextToken(pageToken); + }, [data, pageSize, pageToken, query]); + + // infinite scroll handling + const infiniteScrollSensor = useRef(null); + useEffect(() => { + const observer = new IntersectionObserver( + (entries) => { + if (entries[0].isIntersecting) { + fetchMore(); + } + }, + { threshold: 0.5 }, // Adjust threshold as needed + ); + + if (infiniteScrollSensor.current) { + observer.observe(infiniteScrollSensor.current); + } + + return () => { + if (infiniteScrollSensor.current) { + observer.unobserve(infiniteScrollSensor.current); + } + }; + }, [items]); + + const fetchMore = async () => { + if (!nextToken) return; + + const response = await fetchIdentityPage({ + pageSize: pageSize, + pageToken: nextToken, + query: query, + }); + + setItems([...items, ...response.data]); + setNextToken(response.tokens.get('next') ?? undefined); + }; // quick actions const [currentIdentity, setCurrentIdentity] = useState(undefined); @@ -213,14 +259,12 @@ export function IdentityDataTable({ data, page, query }: IdentityDataTableProps) + deleteIdentitySessions({ id: currentIdentity.id })}> + Invalidate sessions + Cancel - deleteIdentitySessions(currentIdentity.id)}> - Invalidate sessions - @@ -236,13 +280,13 @@ export function IdentityDataTable({ data, page, query }: IdentityDataTableProps) + blockIdentity({ id: currentIdentity.id })}> + Block identity + Cancel - blockIdentity(currentIdentity.id)}> - Block identity - @@ -258,13 +302,13 @@ export function IdentityDataTable({ data, page, query }: IdentityDataTableProps) + unblockIdentity({ id: currentIdentity.id })}> + Unblock identity + Cancel - unblockIdentity(currentIdentity.id)}> - Unblock identity - @@ -281,20 +325,26 @@ export function IdentityDataTable({ data, page, query }: IdentityDataTableProps) + deleteIdentity({ id: currentIdentity.id })}> + Delete identity + Cancel - deleteIdentity(currentIdentity.id)}> - Delete identity - ) } + { + nextToken && ( +
+ +
+ ) + } ); } diff --git a/dashboard/src/app/(inside)/user/page.tsx b/dashboard/src/app/(inside)/user/page.tsx index efb1095..f02c636 100644 --- a/dashboard/src/app/(inside)/user/page.tsx +++ b/dashboard/src/app/(inside)/user/page.tsx @@ -1,8 +1,49 @@ import React from 'react'; import { IdentityDataTable } from '@/app/(inside)/user/data-table'; +import { getIdentityApi } from '@/ory/sdk/server'; import { SearchInput } from '@/components/search-input'; -import { queryIdentities } from '@/lib/action/identity'; -import { IdentityPagination } from '@/components/pagination'; + +export interface FetchIdentityPageProps { + pageSize: number; + pageToken: string; + query: string; +} + +async function fetchIdentityPage({ pageSize, pageToken, query }: FetchIdentityPageProps) { + 'use server'; + + const identityApi = await getIdentityApi(); + const response = await identityApi.listIdentities({ + pageSize: pageSize, + pageToken: pageToken, + previewCredentialsIdentifierSimilar: query, + }); + + return { + data: response.data, + tokens: parseTokens(response.headers.link), + }; +} + +function parseTokens(link: string) { + + const parsed = link.split(',').map((it) => { + const startRel = it.lastIndexOf('rel="'); + const endRel = it.lastIndexOf('"'); + const rel = it.slice(startRel, endRel); + + const startToken = it.lastIndexOf('page_token='); + const endToken = it.lastIndexOf('&'); + const token = it.slice(startToken, endToken); + + return [rel, token]; + }); + + return new Map(parsed.map(obj => [ + obj[0].replace('rel="', ''), + obj[1].replace('page_token=', ''), + ])); +} export default async function UserPage( { @@ -13,14 +54,12 @@ export default async function UserPage( ) { const params = await searchParams; - - const page = params.page ? Number(params.page) : 1; const query = params.query ? params.query as string : ''; - let pageSize = 50; - let paginationRange = 11; + let pageSize = 250; + let pageToken: string = '00000000-0000-0000-0000-000000000000'; - const { data, itemCount, pageCount } = await queryIdentities({ page, pageSize, query }); + const initialFetch = await fetchIdentityPage({ pageSize, pageToken, query: query }); return (
@@ -31,23 +70,13 @@ export default async function UserPage(

- -
-

{itemCount} item{itemCount && itemCount > 1 ? 's' : ''} found

- -
- + +
); diff --git a/dashboard/src/app/service-worker.ts b/dashboard/src/app/service-worker.ts index b9741f4..0538ba3 100644 --- a/dashboard/src/app/service-worker.ts +++ b/dashboard/src/app/service-worker.ts @@ -1,24 +1,18 @@ +import type { PrecacheEntry } from '@serwist/precaching'; +import { installSerwist } from '@serwist/sw'; import { defaultCache } from '@serwist/next/worker'; -import type { PrecacheEntry, SerwistGlobalConfig } from 'serwist'; -import { Serwist } from 'serwist'; -declare const self: ServiceWorkerGlobalScope; +declare const self: ServiceWorkerGlobalScope & { + // Change this attribute's name to your `injectionPoint`. + // `injectionPoint` is an InjectManifest option. + // See https://serwist.pages.dev/docs/build/inject-manifest/configuring + __SW_MANIFEST: (PrecacheEntry | string)[] | undefined; +}; -declare global { - interface WorkerGlobalScope extends SerwistGlobalConfig { - // Change this attribute's name to your `injectionPoint`. - // `injectionPoint` is an InjectManifest option. - // See https://serwist.pages.dev/docs/build/configuring - __SW_MANIFEST: (PrecacheEntry | string)[] | undefined; - } -} - -const serwist = new Serwist({ +installSerwist({ precacheEntries: self.__SW_MANIFEST, skipWaiting: true, clientsClaim: true, navigationPreload: true, runtimeCaching: defaultCache, }); - -serwist.addEventListeners(); diff --git a/dashboard/src/components/app-sidebar.tsx b/dashboard/src/components/app-sidebar.tsx index ff21f4d..7039c7f 100644 --- a/dashboard/src/components/app-sidebar.tsx +++ b/dashboard/src/components/app-sidebar.tsx @@ -5,13 +5,14 @@ import { SidebarContent, SidebarFooter, SidebarGroup, + SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, - useSidebar, } from '@/components/ui/sidebar'; -import { AppWindow, ChartLine, FileLock2, Home, LogOut, LucideIcon, Moon, Sun, Users } from 'lucide-react'; +import { AppWindow, Home, LogOut, Moon, Sun, Users } from 'lucide-react'; +import React from 'react'; import { DropdownMenu, DropdownMenuContent, @@ -20,126 +21,50 @@ import { } from '@/components/ui/dropdown-menu'; import { useTheme } from 'next-themes'; import { LogoutLink } from '@/ory'; -import React from 'react'; import Link from 'next/link'; -import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'; - -interface SidebarGroup { - type: 'group'; - label: string; - items: SidebarItem[]; -} - -interface SidebarItem { - type: 'item'; - label: string; - path: string; - icon: LucideIcon; -} - -type SidebarContent = SidebarItem | SidebarGroup - -function renderSidebarMenuItem(item: SidebarItem, key: number, collapsed: boolean) { - return ( - - - - - - - {item.label} - - - - - - {item.label} - - - ); -} export function AppSidebar({ ...props }: React.ComponentProps) { const { setTheme } = useTheme(); - const { state } = useSidebar(); - - const items: SidebarContent[] = [ + const items = [ { - label: 'Application', - type: 'group', - items: [ - { - type: 'item', - label: 'Home', - path: '/', - icon: Home, - }, - { - type: 'item', - label: 'Analytics', - path: '/analytics', - icon: ChartLine, - }, - ], + title: 'Home', + url: '/', + icon: Home, }, { - label: 'Ory Kratos', - type: 'group', - items: [ - { - type: 'item', - label: 'Users', - path: '/user', - icon: Users, - }, - ], + title: 'Users', + url: '/user', + icon: Users, }, { - label: 'Ory Hydra', - type: 'group', - items: [ - { - type: 'item', - label: 'Clients', - path: '/client', - icon: AppWindow, - }, - ], - }, - { - label: 'Ory Keto', - type: 'group', - items: [ - { - type: 'item', - label: 'Relations', - path: '/relation', - icon: FileLock2, - }, - ], + title: 'Applications', + url: '/application', + icon: AppWindow, }, ]; return ( - - {items.map((item, index) => { - switch (item.type) { - case 'item': - return renderSidebarMenuItem(item, index, state === 'collapsed'); - case 'group': - return ( - - {item.label} - {item.items.map((subItem, subIndex) => renderSidebarMenuItem(subItem, subIndex, state === 'collapsed'))} - - ); - } - })} - + + Application + + + {items.map((item) => ( + + + + + {item.title} + + + + ))} + + + diff --git a/dashboard/src/components/confirmation-dialog-wrapper.tsx b/dashboard/src/components/confirmation-dialog-wrapper.tsx deleted file mode 100644 index 2d40093..0000000 --- a/dashboard/src/components/confirmation-dialog-wrapper.tsx +++ /dev/null @@ -1,74 +0,0 @@ -'use client'; - -import { ButtonProps, buttonVariants } from '@/components/ui/button'; -import { - AlertDialog, - AlertDialogAction, - AlertDialogCancel, - AlertDialogContent, - AlertDialogDescription, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogTitle, - AlertDialogTrigger, -} from '@/components/ui/alert-dialog'; -import { ReactNode } from 'react'; -import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'; -import type { VariantProps } from 'class-variance-authority'; - -interface ButtonWithConfirmDialogProps { - buttonProps?: ButtonProps; - onCancel?: () => any; - onSubmit: () => any; - tooltipContent?: string; - dialogTitle: string; - dialogDescription: string; - dialogButtonCancel?: string; - dialogButtonSubmit?: string; - dialogButtonSubmitProps?: VariantProps; - children: ReactNode; -} - -export function ConfirmationDialogWrapper( - { - onCancel, - onSubmit, - tooltipContent, - dialogTitle, - dialogDescription, - dialogButtonCancel, - dialogButtonSubmit, - dialogButtonSubmitProps, - children, - }: ButtonWithConfirmDialogProps) { - return ( - - - {tooltipContent} - - - - - {children} - - - - - {dialogTitle} - {dialogDescription} - - - - {dialogButtonCancel ?? 'Cancel'} - - - {dialogButtonSubmit ?? 'Confirm'} - - - - - - ); -} \ No newline at end of file diff --git a/dashboard/src/components/dynamic-form.tsx b/dashboard/src/components/dynamic-form.tsx deleted file mode 100644 index 9020d46..0000000 --- a/dashboard/src/components/dynamic-form.tsx +++ /dev/null @@ -1,99 +0,0 @@ -'use client'; - -import { FieldValues, Path, SubmitErrorHandler, SubmitHandler, UseFormReturn } from 'react-hook-form'; -import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel } from '@/components/ui/form'; -import { Input } from '@/components/ui/input'; -import { Button } from '@/components/ui/button'; -import React, { ReactNode } from 'react'; -import { Checkbox } from '@/components/ui/checkbox'; -import { KratosSchemaProperties } from '@/lib/forms/identity-form'; - -interface DynamicFormProps { - children?: ReactNode, - form: UseFormReturn, - properties: KratosSchemaProperties, - onValid: SubmitHandler, - onInvalid: SubmitErrorHandler, - submitLabel?: string, -} - -export function DynamicForm( - { - children, - form, - properties, - onValid, - onInvalid, - submitLabel, - }: DynamicFormProps, -) { - - const generateFormFields = (data: KratosSchemaProperties, prefix = '') => { - return ( - - { - data && Object.entries(data).map(([key, value]) => { - - const fullFieldName = prefix ? `${prefix}.${key}` : key; - - if (value.type === 'object') { - - return generateFormFields(value.properties!, fullFieldName); - - } else if (value.type === 'boolean') { - - return ( - )} - key={fullFieldName} - render={({ field }) => ( - - - {key} - - )} - /> - ); - - } else { - - return ( - )} - key={fullFieldName} - render={({ field }) => ( - - {value.title} - - - - {value.description} - - )} - /> - ); - } - }) - } - - ); - }; - - return ( -
- - {generateFormFields(properties)} - {children} - -
- - ); -} - -export default DynamicForm; diff --git a/dashboard/src/components/forms/IdentityTraitForm.tsx b/dashboard/src/components/forms/IdentityTraitForm.tsx new file mode 100644 index 0000000..8f863d8 --- /dev/null +++ b/dashboard/src/components/forms/IdentityTraitForm.tsx @@ -0,0 +1,82 @@ +'use client'; + +import { Form, FormControl, FormField, FormItem, FormLabel } from '@/components/ui/form'; +import { Input } from '@/components/ui/input'; +import { generateZodSchema, KratosSchema, KratosSchemaProperties } from '@/lib/forms/identity-form'; +import { useForm, UseFormReturn } from 'react-hook-form'; +import { z } from 'zod'; +import { zodResolver } from '@hookform/resolvers/zod'; +import { toast } from 'sonner'; +import { Identity } from '@ory/client'; +import { Checkbox } from '@/components/ui/checkbox'; + +interface IdentityTraitFormProps { + schema: KratosSchema; + identity: Identity; +} + +function renderUiNodes(form: UseFormReturn, properties: KratosSchemaProperties, prefix?: string): any { + + let keyPrefix = prefix ? prefix + '.' : ''; + + return Object.entries(properties).map(([key, value]) => { + if (value.type === 'object') { + return renderUiNodes(form, value.properties!, key); + } else if (value.type === 'boolean') { + return ( + ( + + + {value.title} + + )} + /> + ); + } else { + return ( + ( + + {value.title} + + + + + )} + /> + ); + } + }, + ); +} + +export function IdentityTraitForm({ schema, identity }: IdentityTraitFormProps) { + + const zodIdentitySchema = generateZodSchema(schema); + const form = useForm>({ + defaultValues: identity.traits, + resolver: zodResolver(zodIdentitySchema), + }); + + function onSubmit(values: z.infer) { + toast.message(JSON.stringify(values, null, 4)); + } + + return ( +
+ + { + renderUiNodes(form, schema.properties.traits.properties) + } +
+ + ); +} diff --git a/dashboard/src/components/identity/identity-actions.tsx b/dashboard/src/components/identity/identity-actions.tsx deleted file mode 100644 index 0ddcf32..0000000 --- a/dashboard/src/components/identity/identity-actions.tsx +++ /dev/null @@ -1,223 +0,0 @@ -'use client'; - -import { Identity } from '@ory/client'; -import { Button, buttonVariants } from '@/components/ui/button'; -import { Copy, Key, Link, Trash, UserCheck, UserMinus, UserX } from 'lucide-react'; -import { ConfirmationDialogWrapper } from '@/components/confirmation-dialog-wrapper'; -import { - blockIdentity, - createRecoveryCode, - createRecoveryLink, - deleteIdentity, - deleteIdentitySessions, - unblockIdentity, -} from '@/lib/action/identity'; -import { toast } from 'sonner'; -import { useRouter } from 'next/navigation'; -import { useState } from 'react'; -import { - AlertDialog, - AlertDialogAction, - AlertDialogContent, - AlertDialogDescription, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogTitle, -} from '@/components/ui/alert-dialog'; -import { Input } from '@/components/ui/input'; -import { Label } from '@/components/ui/label'; - -interface IdentityActionProps { - identity: Identity; -} - -export function IdentityActions({ identity }: IdentityActionProps, -) { - - const router = useRouter(); - - const [dialogVisible, setDialogVisible] = useState(false); - const [dialogLink, setDialogLink] = useState(''); - const [dialogCode, setDialogCode] = useState(undefined); - - return ( - <> - setDialogVisible(value)}> - - - Recovery account - - You created a recovery flow. Provide the user with the following information so they can - access their account again. - - -
- -
- - -
-

- { - dialogCode ? - 'The user will need this link to access the recovery flow.' - : - 'This magic link will authenticate the user automatically' - } -

-
- { - dialogCode ? -
- -
- - -
-

- The user will need to enter this code on the recovery page. -

-
- : - <> - } - - - Close - - -
-
- - { - await createRecoveryCode(identity.id) - .then((response) => { - setDialogLink(response.recovery_link); - setDialogCode(response.recovery_code); - setDialogVisible(true); - }) - .catch(() => toast.error('Creating recovery code failed')); - }} - tooltipContent="Create recovery code" - dialogTitle="Create recovery code" - dialogDescription="Are you sure you want to create a recovery code for this identity?" - dialogButtonSubmit="Create code" - > - - - - { - await createRecoveryLink(identity.id) - .then((response) => { - setDialogLink(response.recovery_link); - setDialogCode(undefined); - setDialogVisible(true); - }) - .catch(() => toast.error('Creating recovery link failed. It is likely magic-links are disabled on your Ory Kratos instance.')); - }} - tooltipContent="Create recovery link" - dialogTitle="Create recovery link" - dialogDescription="Are you sure you want to create a recovery link for this identity?" - dialogButtonSubmit="Create link" - > - - - - { - identity.state === 'active' ? - { - await blockIdentity(identity.id) - .then(() => toast.success('Identity deactivated')) - .catch(() => toast.error('Deactivating identity failed')); - }} - tooltipContent="Deactivate identity" - dialogTitle="Deactivate identity" - dialogDescription="Are you sure you want to deactivate this identity? The user will not be able to sign-in or use any active session until re-activation!" - dialogButtonSubmit="Deactivate" - > - - - : - { - await unblockIdentity(identity.id) - .then(() => toast.success('Identity activated')) - .catch(() => toast.error('Activating identity failed')); - }} - tooltipContent="Activate identity" - dialogTitle="Activate identity" - dialogDescription="Are you sure you want to activate this identity?" - dialogButtonSubmit="Activate" - > - - - } - - { - await deleteIdentitySessions(identity.id) - .then(() => toast.success('All sessions invalidated')) - .catch(() => toast.error('Invalidating all sessions failed')); - }} - tooltipContent="Invalidate all sessions" - dialogTitle="Invalidate all sessions" - dialogDescription="Are you sure you want to invalidate and delete ALL session of this identity? This action is irreversible!" - dialogButtonSubmit="Invalidate sessions" - dialogButtonSubmitProps={{ variant: 'destructive' }} - > - - - - { - await deleteIdentity(identity.id) - .then(() => { - toast.success('Identity deleted'); - router.push('/user'); - }) - .catch(() => toast.error('Deleting identity failed')); - }} - tooltipContent="Delete identity" - dialogTitle="Delete identity" - dialogDescription="Are you sure you want to delete this identity? This action is irreversible!" - dialogButtonSubmit="Delete identity" - dialogButtonSubmitProps={{ variant: 'destructive' }} - > - - - - ); -} \ No newline at end of file diff --git a/dashboard/src/components/identity/identity-credentials.tsx b/dashboard/src/components/identity/identity-credentials.tsx deleted file mode 100644 index f362971..0000000 --- a/dashboard/src/components/identity/identity-credentials.tsx +++ /dev/null @@ -1,61 +0,0 @@ -'use client'; - -import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'; -import { ConfirmationDialogWrapper } from '@/components/confirmation-dialog-wrapper'; -import { deleteIdentityCredential } from '@/lib/action/identity'; -import { Button } from '@/components/ui/button'; -import { Trash } from 'lucide-react'; -import { DeleteIdentityCredentialsTypeEnum, Identity } from '@ory/client'; -import { toast } from 'sonner'; - -interface IdentityCredentialsProps { - identity: Identity; -} - -export function IdentityCredentials({ identity }: IdentityCredentialsProps) { - return ( - - - - Type - Value - - - - - { - Object.entries(identity.credentials!).map(([key, value]) => { - return ( - - {key} - {value.identifiers![0]} - - { - Object.values(DeleteIdentityCredentialsTypeEnum).includes(key as DeleteIdentityCredentialsTypeEnum) && - key !== 'password' && key !== 'code' && - ( - { - deleteIdentityCredential({ id: identity.id, type: key as never }) - .then(() => toast.success(`Credential ${key} deleted`)) - .catch(() => toast.error(`Deleting credential ${key} failed`)); - }} - dialogTitle="Delete credential" - dialogDescription={`Are you sure you want to remove the credential of type ${key} from this identity?`} - dialogButtonSubmit={`Delete ${key}`} - dialogButtonSubmitProps={{ variant: 'destructive' }}> - - - ) - } - - - ); - }) - } - -
- ); -} \ No newline at end of file diff --git a/dashboard/src/components/identity/identity-traits.tsx b/dashboard/src/components/identity/identity-traits.tsx deleted file mode 100644 index 1606db4..0000000 --- a/dashboard/src/components/identity/identity-traits.tsx +++ /dev/null @@ -1,110 +0,0 @@ -'use client'; - -import { KratosSchema, kratosSchemaToZod } from '@/lib/forms/identity-form'; -import { useForm } from 'react-hook-form'; -import { z } from 'zod'; -import { zodResolver } from '@hookform/resolvers/zod'; -import { Identity } from '@ory/client'; -import { toast } from 'sonner'; -import DynamicForm from '@/components/dynamic-form'; -import { FormControl, FormDescription, FormField, FormItem, FormLabel } from '@/components/ui/form'; -import { Textarea } from '@/components/ui/textarea'; -import { zu } from 'zod_utilz'; -import { updateIdentity } from '@/lib/action/identity'; -import { useState } from 'react'; - -interface IdentityTraitFormProps { - schema: KratosSchema; - identity: Identity; -} - -export function IdentityTraits({ schema, identity }: IdentityTraitFormProps) { - - const [currentIdentity, setCurrentIdentity] = useState(identity); - - const generated = kratosSchemaToZod(schema); - const metadata = z.object({ - metadata_public: zu.stringToJSON(), - metadata_admin: zu.stringToJSON(), - }); - - const zodIdentitySchema = generated.merge(metadata); - - const form = useForm>({ - resolver: zodResolver(zodIdentitySchema), - defaultValues: { - ...currentIdentity.traits, - metadata_public: currentIdentity.metadata_public ? - JSON.stringify(currentIdentity.metadata_public) : '{}', - metadata_admin: currentIdentity.metadata_admin ? - JSON.stringify(currentIdentity.metadata_admin) : '{}', - }, - }); - - const onValid = (data: z.infer) => { - - const traits = structuredClone(data); - delete traits['metadata_public']; - delete traits['metadata_admin']; - - updateIdentity({ - id: currentIdentity.id, - body: { - schema_id: currentIdentity.schema_id, - state: currentIdentity.state!, - traits: traits, - metadata_public: data.metadata_public, - metadata_admin: data.metadata_admin, - }, - }) - .then((identity) => { - setCurrentIdentity(identity); - toast.success('Identity updated'); - }) - .catch(() => { - toast.error('Updating identity failed'); - }); - }; - - const onInvalid = (data: z.infer) => { - console.log('data', data); - toast.error('Invalid values'); - }; - - return ( - - ( - - Public Metadata - -