--
-- PostgreSQL database cluster dump
--

\restrict KhJaovGhkfeQyL54XuBUKqd1d7wJFriSTzqluCcw9zp1a77Aib8VCft15VxeoqL

SET default_transaction_read_only = off;

SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;

--
-- Roles
--

CREATE ROLE logto;
ALTER ROLE logto WITH SUPERUSER INHERIT CREATEROLE CREATEDB LOGIN REPLICATION BYPASSRLS PASSWORD 'SCRAM-SHA-256$4096:M/CtlKnjhoJTqlX9ORyDIg==$RNFXrEAt2PP3qtPqsbgAALTr1OyFR4yd7ykxeyLyc6I=:KmUDqvvCno997OGvfx/cDVURoJ21S/KG1LR75bD6U/A=';
CREATE ROLE logto_tenant_logto;
ALTER ROLE logto_tenant_logto WITH NOSUPERUSER NOINHERIT NOCREATEROLE NOCREATEDB NOLOGIN NOREPLICATION NOBYPASSRLS;
CREATE ROLE logto_tenant_logto_admin;
ALTER ROLE logto_tenant_logto_admin WITH NOSUPERUSER INHERIT NOCREATEROLE NOCREATEDB LOGIN NOREPLICATION NOBYPASSRLS PASSWORD 'SCRAM-SHA-256$4096:GMCwEzNBYkuebW3Wsq64Gg==$sbB7tnloUKkc/RKnPQlDxlhZ1i/e7J+XHnsyNfmmgX0=:1hk7b6uMp6DCIbyemBNa3O8NMHwW1Ljkl+N8FDQ45UM=';
CREATE ROLE logto_tenant_logto_default;
ALTER ROLE logto_tenant_logto_default WITH NOSUPERUSER INHERIT NOCREATEROLE NOCREATEDB LOGIN NOREPLICATION NOBYPASSRLS PASSWORD 'SCRAM-SHA-256$4096:3CXSOMTVJZgpIVNgQdkOpQ==$SDtMcibYIlILr8QkvoSTYN06DJ8LkYs1uX988wuBm2Y=:oMReEz7eKEnNUX976dwOuJicXjNWt2UwROr5quWQasE=';

--
-- User Configurations
--


--
-- Role memberships
--

GRANT logto_tenant_logto TO logto_tenant_logto_admin GRANTED BY logto;
GRANT logto_tenant_logto TO logto_tenant_logto_default GRANTED BY logto;






\unrestrict KhJaovGhkfeQyL54XuBUKqd1d7wJFriSTzqluCcw9zp1a77Aib8VCft15VxeoqL

--
-- Databases
--

--
-- Database "template1" dump
--

\connect template1

--
-- PostgreSQL database dump
--

\restrict 3Zc0BG86tfo1tEj1iX4R7TK6BSgr94Vu3EhNB6uzEknrfCul4LtXG6mYiY5J12K

-- Dumped from database version 15.15 (Debian 15.15-1.pgdg13+1)
-- Dumped by pg_dump version 15.15 (Debian 15.15-1.pgdg13+1)

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- PostgreSQL database dump complete
--

\unrestrict 3Zc0BG86tfo1tEj1iX4R7TK6BSgr94Vu3EhNB6uzEknrfCul4LtXG6mYiY5J12K

--
-- Database "logto" dump
--

--
-- PostgreSQL database dump
--

\restrict fZpEf5X7Do3LbGuYMrgKqVEjkgqkEU2r42UqasIpZ2AjStCzl7DEoMvfmM4TJxj

-- Dumped from database version 15.15 (Debian 15.15-1.pgdg13+1)
-- Dumped by pg_dump version 15.15 (Debian 15.15-1.pgdg13+1)

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- Name: logto; Type: DATABASE; Schema: -; Owner: logto
--

CREATE DATABASE logto WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'en_US.utf8';


ALTER DATABASE logto OWNER TO logto;

\unrestrict fZpEf5X7Do3LbGuYMrgKqVEjkgqkEU2r42UqasIpZ2AjStCzl7DEoMvfmM4TJxj
\connect logto
\restrict fZpEf5X7Do3LbGuYMrgKqVEjkgqkEU2r42UqasIpZ2AjStCzl7DEoMvfmM4TJxj

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- Name: agree_to_terms_policy; Type: TYPE; Schema: public; Owner: logto
--

CREATE TYPE public.agree_to_terms_policy AS ENUM (
    'Automatic',
    'ManualRegistrationOnly',
    'Manual'
);


ALTER TYPE public.agree_to_terms_policy OWNER TO logto;

--
-- Name: application_type; Type: TYPE; Schema: public; Owner: logto
--

CREATE TYPE public.application_type AS ENUM (
    'Native',
    'SPA',
    'Traditional',
    'MachineToMachine',
    'Protected',
    'SAML'
);


ALTER TYPE public.application_type OWNER TO logto;

--
-- Name: organization_invitation_status; Type: TYPE; Schema: public; Owner: logto
--

CREATE TYPE public.organization_invitation_status AS ENUM (
    'Pending',
    'Accepted',
    'Expired',
    'Revoked'
);


ALTER TYPE public.organization_invitation_status OWNER TO logto;

--
-- Name: role_type; Type: TYPE; Schema: public; Owner: logto
--

CREATE TYPE public.role_type AS ENUM (
    'User',
    'MachineToMachine'
);


ALTER TYPE public.role_type OWNER TO logto;

--
-- Name: sentinel_action_result; Type: TYPE; Schema: public; Owner: logto
--

CREATE TYPE public.sentinel_action_result AS ENUM (
    'Success',
    'Failed'
);


ALTER TYPE public.sentinel_action_result OWNER TO logto;

--
-- Name: sentinel_decision; Type: TYPE; Schema: public; Owner: logto
--

CREATE TYPE public.sentinel_decision AS ENUM (
    'Undecided',
    'Allowed',
    'Blocked',
    'Challenge'
);


ALTER TYPE public.sentinel_decision OWNER TO logto;

--
-- Name: sign_in_mode; Type: TYPE; Schema: public; Owner: logto
--

CREATE TYPE public.sign_in_mode AS ENUM (
    'SignIn',
    'Register',
    'SignInAndRegister'
);


ALTER TYPE public.sign_in_mode OWNER TO logto;

--
-- Name: users_password_encryption_method; Type: TYPE; Schema: public; Owner: logto
--

CREATE TYPE public.users_password_encryption_method AS ENUM (
    'Argon2i',
    'Argon2id',
    'Argon2d',
    'SHA1',
    'SHA256',
    'MD5',
    'Bcrypt',
    'Legacy'
);


ALTER TYPE public.users_password_encryption_method OWNER TO logto;

--
-- Name: check_application_type(character varying, public.application_type[]); Type: FUNCTION; Schema: public; Owner: logto
--

CREATE FUNCTION public.check_application_type(application_id character varying, VARIADIC target_type public.application_type[]) RETURNS boolean
    LANGUAGE plpgsql
    SET search_path TO 'public'
    AS $$ begin return (select type from applications where id = application_id) = any(target_type); end; $$;


ALTER FUNCTION public.check_application_type(application_id character varying, VARIADIC target_type public.application_type[]) OWNER TO logto;

--
-- Name: check_organization_role_type(character varying, public.role_type); Type: FUNCTION; Schema: public; Owner: logto
--

CREATE FUNCTION public.check_organization_role_type(role_id character varying, target_type public.role_type) RETURNS boolean
    LANGUAGE plpgsql
    SET search_path TO 'public'
    AS $$ begin return (select type from organization_roles where id = role_id) = target_type; end; $$;


ALTER FUNCTION public.check_organization_role_type(role_id character varying, target_type public.role_type) OWNER TO logto;

--
-- Name: check_role_type(character varying, public.role_type); Type: FUNCTION; Schema: public; Owner: logto
--

CREATE FUNCTION public.check_role_type(role_id character varying, target_type public.role_type) RETURNS boolean
    LANGUAGE plpgsql
    AS $$ begin return (select type from public.roles where id = role_id) = target_type; end; $$;


ALTER FUNCTION public.check_role_type(role_id character varying, target_type public.role_type) OWNER TO logto;

--
-- Name: custom_profile_fields__increment_sie_order(); Type: FUNCTION; Schema: public; Owner: logto
--

CREATE FUNCTION public.custom_profile_fields__increment_sie_order() RETURNS trigger
    LANGUAGE plpgsql
    AS $$ begin new.sie_order = ( select coalesce(max(sie_order), 0) from custom_profile_fields where tenant_id = ( select id from tenants where db_user = current_user ) ) + 1; return new; end; $$;


ALTER FUNCTION public.custom_profile_fields__increment_sie_order() OWNER TO logto;

--
-- Name: delete_secret_on_sso_identity_delete(); Type: FUNCTION; Schema: public; Owner: logto
--

CREATE FUNCTION public.delete_secret_on_sso_identity_delete() RETURNS trigger
    LANGUAGE plpgsql
    AS $$ begin delete from secrets where id in ( select secret_id from secret_enterprise_sso_connector_relations where tenant_id = old.tenant_id and issuer = old.issuer and identity_id = old.identity_id ) and user_id = old.user_id; return old; end; $$;


ALTER FUNCTION public.delete_secret_on_sso_identity_delete() OWNER TO logto;

--
-- Name: delete_secrets_on_social_connector_delete(); Type: FUNCTION; Schema: public; Owner: logto
--

CREATE FUNCTION public.delete_secrets_on_social_connector_delete() RETURNS trigger
    LANGUAGE plpgsql
    AS $$ begin delete from secrets where id in ( select secret_id from secret_social_connector_relations where tenant_id = old.tenant_id and connector_id = old.id ); return old; end; $$;


ALTER FUNCTION public.delete_secrets_on_social_connector_delete() OWNER TO logto;

--
-- Name: delete_secrets_on_social_identity_delete(); Type: FUNCTION; Schema: public; Owner: logto
--

CREATE FUNCTION public.delete_secrets_on_social_identity_delete() RETURNS trigger
    LANGUAGE plpgsql
    AS $$ declare identity_target text; old_identity jsonb; new_identity jsonb; begin for identity_target in select jsonb_object_keys(old.identities) loop old_identity := old.identities -> identity_target; new_identity := new.identities -> identity_target; if new_identity is null or (new_identity->>'userId') is distinct from (old_identity->>'userId') then delete from secrets using secret_social_connector_relations where secrets.id = secret_social_connector_relations.secret_id and secret_social_connector_relations.target = identity_target and secret_social_connector_relations.identity_id = old_identity->>'userId' and secrets.user_id = old.id; end if; end loop; return new; end; $$;


ALTER FUNCTION public.delete_secrets_on_social_identity_delete() OWNER TO logto;

--
-- Name: delete_secrets_on_sso_connector_delete(); Type: FUNCTION; Schema: public; Owner: logto
--

CREATE FUNCTION public.delete_secrets_on_sso_connector_delete() RETURNS trigger
    LANGUAGE plpgsql
    AS $$ begin delete from secrets where id in ( select secret_id from secret_enterprise_sso_connector_relations where tenant_id = old.tenant_id and sso_connector_id = old.id ); return old; end; $$;


ALTER FUNCTION public.delete_secrets_on_sso_connector_delete() OWNER TO logto;

--
-- Name: set_tenant_id(); Type: FUNCTION; Schema: public; Owner: logto
--

CREATE FUNCTION public.set_tenant_id() RETURNS trigger
    LANGUAGE plpgsql
    AS $$ begin if new.tenant_id is not null then return new; end if; select tenants.id into new.tenant_id from tenants where tenants.db_user = current_user; return new; end; $$;


ALTER FUNCTION public.set_tenant_id() OWNER TO logto;

--
-- Name: set_updated_at(); Type: FUNCTION; Schema: public; Owner: logto
--

CREATE FUNCTION public.set_updated_at() RETURNS trigger
    LANGUAGE plpgsql
    AS $$ begin new.updated_at = now(); return new; end; $$;


ALTER FUNCTION public.set_updated_at() OWNER TO logto;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: account_centers; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.account_centers (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    enabled boolean DEFAULT true NOT NULL,
    fields jsonb DEFAULT '{}'::jsonb NOT NULL,
    webauthn_related_origins jsonb DEFAULT '[]'::jsonb NOT NULL
);


ALTER TABLE public.account_centers OWNER TO logto;

--
-- Name: aggregated_daily_active_users; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.aggregated_daily_active_users (
    tenant_id character varying(21) NOT NULL,
    activity_date date NOT NULL,
    user_id character varying(21) NOT NULL,
    activity_count integer NOT NULL
);


ALTER TABLE public.aggregated_daily_active_users OWNER TO logto;

--
-- Name: application_secrets; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.application_secrets (
    tenant_id character varying(21) NOT NULL,
    application_id character varying(21) NOT NULL,
    name character varying(256) NOT NULL,
    value character varying(64) NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    expires_at timestamp with time zone,
    CONSTRAINT application_type CHECK (public.check_application_type(application_id, VARIADIC ARRAY['MachineToMachine'::public.application_type, 'Traditional'::public.application_type, 'Protected'::public.application_type]))
);


ALTER TABLE public.application_secrets OWNER TO logto;

--
-- Name: application_sign_in_experiences; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.application_sign_in_experiences (
    tenant_id character varying(21) NOT NULL,
    application_id character varying(21) NOT NULL,
    color jsonb DEFAULT '{}'::jsonb NOT NULL,
    branding jsonb DEFAULT '{}'::jsonb NOT NULL,
    custom_css text,
    terms_of_use_url character varying(2048),
    privacy_policy_url character varying(2048),
    display_name character varying(256)
);


ALTER TABLE public.application_sign_in_experiences OWNER TO logto;

--
-- Name: application_user_consent_organization_resource_scopes; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.application_user_consent_organization_resource_scopes (
    tenant_id character varying(21) NOT NULL,
    application_id character varying(21) NOT NULL,
    scope_id character varying(21) NOT NULL
);


ALTER TABLE public.application_user_consent_organization_resource_scopes OWNER TO logto;

--
-- Name: application_user_consent_organization_scopes; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.application_user_consent_organization_scopes (
    tenant_id character varying(21) NOT NULL,
    application_id character varying(21) NOT NULL,
    organization_scope_id character varying(21) NOT NULL
);


ALTER TABLE public.application_user_consent_organization_scopes OWNER TO logto;

--
-- Name: application_user_consent_organizations; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.application_user_consent_organizations (
    tenant_id character varying(21) NOT NULL,
    application_id character varying(21) NOT NULL,
    organization_id character varying(21) NOT NULL,
    user_id character varying(21) NOT NULL
);


ALTER TABLE public.application_user_consent_organizations OWNER TO logto;

--
-- Name: application_user_consent_resource_scopes; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.application_user_consent_resource_scopes (
    tenant_id character varying(21) NOT NULL,
    application_id character varying(21) NOT NULL,
    scope_id character varying(21) NOT NULL
);


ALTER TABLE public.application_user_consent_resource_scopes OWNER TO logto;

--
-- Name: application_user_consent_user_scopes; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.application_user_consent_user_scopes (
    tenant_id character varying(21) NOT NULL,
    application_id character varying(21) NOT NULL,
    user_scope character varying(64) NOT NULL
);


ALTER TABLE public.application_user_consent_user_scopes OWNER TO logto;

--
-- Name: applications; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.applications (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    name character varying(256) NOT NULL,
    secret character varying(64) NOT NULL,
    description text,
    type public.application_type NOT NULL,
    oidc_client_metadata jsonb NOT NULL,
    custom_client_metadata jsonb DEFAULT '{}'::jsonb NOT NULL,
    protected_app_metadata jsonb,
    custom_data jsonb DEFAULT '{}'::jsonb NOT NULL,
    is_third_party boolean DEFAULT false NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.applications OWNER TO logto;

--
-- Name: applications_roles; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.applications_roles (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    application_id character varying(21) NOT NULL,
    role_id character varying(21) NOT NULL,
    CONSTRAINT applications_roles__role_type CHECK (public.check_role_type(role_id, 'MachineToMachine'::public.role_type))
);


ALTER TABLE public.applications_roles OWNER TO logto;

--
-- Name: captcha_providers; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.captcha_providers (
    tenant_id character varying(21) NOT NULL,
    id character varying(128) NOT NULL,
    config jsonb DEFAULT '{}'::jsonb NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.captcha_providers OWNER TO logto;

--
-- Name: connectors; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.connectors (
    tenant_id character varying(21) NOT NULL,
    id character varying(128) NOT NULL,
    sync_profile boolean DEFAULT false NOT NULL,
    enable_token_storage boolean DEFAULT false NOT NULL,
    connector_id character varying(128) NOT NULL,
    config jsonb DEFAULT '{}'::jsonb NOT NULL,
    metadata jsonb DEFAULT '{}'::jsonb NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.connectors OWNER TO logto;

--
-- Name: custom_phrases; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.custom_phrases (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    language_tag character varying(16) NOT NULL,
    translation jsonb NOT NULL
);


ALTER TABLE public.custom_phrases OWNER TO logto;

--
-- Name: custom_profile_fields; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.custom_profile_fields (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    name character varying(128) NOT NULL,
    type character varying(128) NOT NULL,
    label character varying(128) DEFAULT ''::character varying NOT NULL,
    description character varying(256),
    required boolean DEFAULT false NOT NULL,
    config jsonb DEFAULT '{}'::jsonb NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    sie_order smallint DEFAULT 0 NOT NULL
);


ALTER TABLE public.custom_profile_fields OWNER TO logto;

--
-- Name: daily_active_users; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.daily_active_users (
    id character varying(21) NOT NULL,
    tenant_id character varying(21) NOT NULL,
    user_id character varying(21) NOT NULL,
    date timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.daily_active_users OWNER TO logto;

--
-- Name: daily_token_usage; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.daily_token_usage (
    id character varying(21) NOT NULL,
    tenant_id character varying(21) NOT NULL,
    usage bigint DEFAULT 0 NOT NULL,
    user_token_usage bigint DEFAULT 0 NOT NULL,
    m2m_token_usage bigint DEFAULT 0 NOT NULL,
    date timestamp with time zone NOT NULL
);


ALTER TABLE public.daily_token_usage OWNER TO logto;

--
-- Name: domains; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.domains (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    domain character varying(256) NOT NULL,
    status character varying(32) DEFAULT 'PendingVerification'::character varying NOT NULL,
    error_message character varying(1024),
    dns_records jsonb DEFAULT '[]'::jsonb NOT NULL,
    cloudflare_data jsonb,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.domains OWNER TO logto;

--
-- Name: email_templates; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.email_templates (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    language_tag character varying(16) NOT NULL,
    template_type character varying(64) NOT NULL,
    details jsonb NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.email_templates OWNER TO logto;

--
-- Name: hooks; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.hooks (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    name character varying(256) DEFAULT ''::character varying NOT NULL,
    event character varying(128),
    events jsonb DEFAULT '[]'::jsonb NOT NULL,
    config jsonb NOT NULL,
    signing_key character varying(64) DEFAULT ''::character varying NOT NULL,
    enabled boolean DEFAULT true NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.hooks OWNER TO logto;

--
-- Name: idp_initiated_saml_sso_sessions; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.idp_initiated_saml_sso_sessions (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    connector_id character varying(128) NOT NULL,
    assertion_content jsonb DEFAULT '{}'::jsonb NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    expires_at timestamp with time zone NOT NULL
);


ALTER TABLE public.idp_initiated_saml_sso_sessions OWNER TO logto;

--
-- Name: logs; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.logs (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    key character varying(128) NOT NULL,
    payload jsonb DEFAULT '{}'::jsonb NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.logs OWNER TO logto;

--
-- Name: logto_configs; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.logto_configs (
    tenant_id character varying(21) NOT NULL,
    key character varying(256) NOT NULL,
    value jsonb DEFAULT '{}'::jsonb NOT NULL
);


ALTER TABLE public.logto_configs OWNER TO logto;

--
-- Name: oidc_model_instances; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.oidc_model_instances (
    tenant_id character varying(21) NOT NULL,
    model_name character varying(64) NOT NULL,
    id character varying(128) NOT NULL,
    payload jsonb NOT NULL,
    expires_at timestamp with time zone NOT NULL,
    consumed_at timestamp with time zone
);


ALTER TABLE public.oidc_model_instances OWNER TO logto;

--
-- Name: oidc_session_extensions; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.oidc_session_extensions (
    tenant_id character varying(21) NOT NULL,
    session_uid character varying(128) NOT NULL,
    account_id character varying(12) NOT NULL,
    last_submission jsonb DEFAULT '{}'::jsonb NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.oidc_session_extensions OWNER TO logto;

--
-- Name: one_time_tokens; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.one_time_tokens (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    email character varying(128) NOT NULL,
    token character varying(256) NOT NULL,
    context jsonb DEFAULT '{}'::jsonb NOT NULL,
    status character varying(64) DEFAULT 'active'::character varying NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    expires_at timestamp with time zone NOT NULL
);


ALTER TABLE public.one_time_tokens OWNER TO logto;

--
-- Name: organization_application_relations; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.organization_application_relations (
    tenant_id character varying(21) NOT NULL,
    organization_id character varying(21) NOT NULL,
    application_id character varying(21) NOT NULL,
    CONSTRAINT application_type CHECK (public.check_application_type(application_id, VARIADIC ARRAY['MachineToMachine'::public.application_type]))
);


ALTER TABLE public.organization_application_relations OWNER TO logto;

--
-- Name: organization_invitation_role_relations; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.organization_invitation_role_relations (
    tenant_id character varying(21) NOT NULL,
    organization_invitation_id character varying(21) NOT NULL,
    organization_role_id character varying(21) NOT NULL
);


ALTER TABLE public.organization_invitation_role_relations OWNER TO logto;

--
-- Name: organization_invitations; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.organization_invitations (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    inviter_id character varying(21),
    invitee character varying(256) NOT NULL,
    accepted_user_id character varying(21),
    organization_id character varying(21) NOT NULL,
    status public.organization_invitation_status NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    expires_at timestamp with time zone NOT NULL
);


ALTER TABLE public.organization_invitations OWNER TO logto;

--
-- Name: organization_jit_email_domains; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.organization_jit_email_domains (
    tenant_id character varying(21) NOT NULL,
    organization_id character varying(21) NOT NULL,
    email_domain character varying(128) NOT NULL
);


ALTER TABLE public.organization_jit_email_domains OWNER TO logto;

--
-- Name: organization_jit_roles; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.organization_jit_roles (
    tenant_id character varying(21) NOT NULL,
    organization_id character varying(21) NOT NULL,
    organization_role_id character varying(21) NOT NULL
);


ALTER TABLE public.organization_jit_roles OWNER TO logto;

--
-- Name: organization_jit_sso_connectors; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.organization_jit_sso_connectors (
    tenant_id character varying(21) NOT NULL,
    organization_id character varying(21) NOT NULL,
    sso_connector_id character varying(128) NOT NULL
);


ALTER TABLE public.organization_jit_sso_connectors OWNER TO logto;

--
-- Name: organization_role_application_relations; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.organization_role_application_relations (
    tenant_id character varying(21) NOT NULL,
    organization_id character varying(21) NOT NULL,
    organization_role_id character varying(21) NOT NULL,
    application_id character varying(21) NOT NULL,
    CONSTRAINT organization_role_application_relations__role_type CHECK (public.check_organization_role_type(organization_role_id, 'MachineToMachine'::public.role_type))
);


ALTER TABLE public.organization_role_application_relations OWNER TO logto;

--
-- Name: organization_role_resource_scope_relations; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.organization_role_resource_scope_relations (
    tenant_id character varying(21) NOT NULL,
    organization_role_id character varying(21) NOT NULL,
    scope_id character varying(21) NOT NULL
);


ALTER TABLE public.organization_role_resource_scope_relations OWNER TO logto;

--
-- Name: organization_role_scope_relations; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.organization_role_scope_relations (
    tenant_id character varying(21) NOT NULL,
    organization_role_id character varying(21) NOT NULL,
    organization_scope_id character varying(21) NOT NULL
);


ALTER TABLE public.organization_role_scope_relations OWNER TO logto;

--
-- Name: organization_role_user_relations; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.organization_role_user_relations (
    tenant_id character varying(21) NOT NULL,
    organization_id character varying(21) NOT NULL,
    organization_role_id character varying(21) NOT NULL,
    user_id character varying(21) NOT NULL,
    CONSTRAINT organization_role_user_relations__role_type CHECK (public.check_organization_role_type(organization_role_id, 'User'::public.role_type))
);


ALTER TABLE public.organization_role_user_relations OWNER TO logto;

--
-- Name: organization_roles; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.organization_roles (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    name character varying(128) NOT NULL,
    description character varying(256),
    type public.role_type DEFAULT 'User'::public.role_type NOT NULL
);


ALTER TABLE public.organization_roles OWNER TO logto;

--
-- Name: organization_scopes; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.organization_scopes (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    name character varying(128) NOT NULL,
    description character varying(256)
);


ALTER TABLE public.organization_scopes OWNER TO logto;

--
-- Name: organization_user_relations; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.organization_user_relations (
    tenant_id character varying(21) NOT NULL,
    organization_id character varying(21) NOT NULL,
    user_id character varying(21) NOT NULL
);


ALTER TABLE public.organization_user_relations OWNER TO logto;

--
-- Name: organizations; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.organizations (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    name character varying(128) NOT NULL,
    description character varying(256),
    custom_data jsonb DEFAULT '{}'::jsonb NOT NULL,
    is_mfa_required boolean DEFAULT false NOT NULL,
    color jsonb DEFAULT '{}'::jsonb NOT NULL,
    branding jsonb DEFAULT '{}'::jsonb NOT NULL,
    custom_css text,
    created_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.organizations OWNER TO logto;

--
-- Name: passcodes; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.passcodes (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    interaction_jti character varying(128),
    phone character varying(32),
    email character varying(128),
    type character varying(32) NOT NULL,
    code character varying(6) NOT NULL,
    consumed boolean DEFAULT false NOT NULL,
    try_count smallint DEFAULT 0 NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.passcodes OWNER TO logto;

--
-- Name: personal_access_tokens; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.personal_access_tokens (
    tenant_id character varying(21) NOT NULL,
    user_id character varying(21) NOT NULL,
    name character varying(256) NOT NULL,
    value character varying(64) NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    expires_at timestamp with time zone
);


ALTER TABLE public.personal_access_tokens OWNER TO logto;

--
-- Name: resources; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.resources (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    name text NOT NULL,
    indicator text NOT NULL,
    is_default boolean DEFAULT false NOT NULL,
    access_token_ttl bigint DEFAULT 3600 NOT NULL
);


ALTER TABLE public.resources OWNER TO logto;

--
-- Name: roles; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.roles (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    name character varying(128) NOT NULL,
    description character varying(128) NOT NULL,
    type public.role_type DEFAULT 'User'::public.role_type NOT NULL,
    is_default boolean DEFAULT false NOT NULL
);


ALTER TABLE public.roles OWNER TO logto;

--
-- Name: roles_scopes; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.roles_scopes (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    role_id character varying(21) NOT NULL,
    scope_id character varying(21) NOT NULL
);


ALTER TABLE public.roles_scopes OWNER TO logto;

--
-- Name: saml_application_configs; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.saml_application_configs (
    application_id character varying(21) NOT NULL,
    tenant_id character varying(21) NOT NULL,
    attribute_mapping jsonb DEFAULT '{}'::jsonb NOT NULL,
    entity_id character varying(128),
    acs_url jsonb,
    encryption jsonb,
    name_id_format character varying(128) NOT NULL,
    CONSTRAINT saml_application_configs__application_type CHECK (public.check_application_type(application_id, VARIADIC ARRAY['SAML'::public.application_type]))
);


ALTER TABLE public.saml_application_configs OWNER TO logto;

--
-- Name: saml_application_secrets; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.saml_application_secrets (
    id character varying(21) NOT NULL,
    tenant_id character varying(21) NOT NULL,
    application_id character varying(21) NOT NULL,
    private_key text NOT NULL,
    certificate text NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    expires_at timestamp with time zone NOT NULL,
    active boolean NOT NULL,
    CONSTRAINT saml_application_secrets__application_type CHECK (public.check_application_type(application_id, VARIADIC ARRAY['SAML'::public.application_type]))
);


ALTER TABLE public.saml_application_secrets OWNER TO logto;

--
-- Name: saml_application_sessions; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.saml_application_sessions (
    tenant_id character varying(21) NOT NULL,
    id character varying(32) NOT NULL,
    application_id character varying(21) NOT NULL,
    saml_request_id character varying(128) NOT NULL,
    oidc_state character varying(32),
    relay_state character varying(512),
    raw_auth_request text NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    expires_at timestamp with time zone NOT NULL,
    CONSTRAINT saml_application_sessions__application_type CHECK (public.check_application_type(application_id, VARIADIC ARRAY['SAML'::public.application_type]))
);


ALTER TABLE public.saml_application_sessions OWNER TO logto;

--
-- Name: scopes; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.scopes (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    resource_id character varying(21) NOT NULL,
    name character varying(256) NOT NULL,
    description text,
    created_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.scopes OWNER TO logto;

--
-- Name: secret_enterprise_sso_connector_relations; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.secret_enterprise_sso_connector_relations (
    tenant_id character varying(21) NOT NULL,
    secret_id character varying(21) NOT NULL,
    sso_connector_id character varying(128) NOT NULL,
    issuer character varying(256) NOT NULL,
    identity_id character varying(128) NOT NULL
);


ALTER TABLE public.secret_enterprise_sso_connector_relations OWNER TO logto;

--
-- Name: secret_social_connector_relations; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.secret_social_connector_relations (
    tenant_id character varying(21) NOT NULL,
    secret_id character varying(21) NOT NULL,
    connector_id character varying(128) NOT NULL,
    target character varying(256) NOT NULL,
    identity_id character varying(128) NOT NULL
);


ALTER TABLE public.secret_social_connector_relations OWNER TO logto;

--
-- Name: secrets; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.secrets (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    user_id character varying(21) NOT NULL,
    type character varying(256) NOT NULL,
    encrypted_dek bytea NOT NULL,
    iv bytea NOT NULL,
    auth_tag bytea NOT NULL,
    ciphertext bytea NOT NULL,
    metadata jsonb DEFAULT '{}'::jsonb NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.secrets OWNER TO logto;

--
-- Name: sentinel_activities; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.sentinel_activities (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    target_type character varying(32) NOT NULL,
    target_hash character varying(64) NOT NULL,
    action character varying(64) NOT NULL,
    action_result public.sentinel_action_result NOT NULL,
    payload jsonb NOT NULL,
    decision public.sentinel_decision NOT NULL,
    decision_expires_at timestamp with time zone DEFAULT now() NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.sentinel_activities OWNER TO logto;

--
-- Name: service_logs; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.service_logs (
    id character varying(21) NOT NULL,
    tenant_id character varying(21) NOT NULL,
    type character varying(64) NOT NULL,
    payload jsonb DEFAULT '{}'::jsonb NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.service_logs OWNER TO logto;

--
-- Name: sign_in_experiences; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.sign_in_experiences (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    color jsonb NOT NULL,
    branding jsonb NOT NULL,
    hide_logto_branding boolean DEFAULT false NOT NULL,
    language_info jsonb NOT NULL,
    terms_of_use_url character varying(2048),
    privacy_policy_url character varying(2048),
    agree_to_terms_policy public.agree_to_terms_policy DEFAULT 'Automatic'::public.agree_to_terms_policy NOT NULL,
    sign_in jsonb NOT NULL,
    sign_up jsonb NOT NULL,
    social_sign_in jsonb DEFAULT '{}'::jsonb NOT NULL,
    social_sign_in_connector_targets jsonb DEFAULT '[]'::jsonb NOT NULL,
    sign_in_mode public.sign_in_mode DEFAULT 'SignInAndRegister'::public.sign_in_mode NOT NULL,
    custom_css text,
    custom_content jsonb DEFAULT '{}'::jsonb NOT NULL,
    custom_ui_assets jsonb,
    password_policy jsonb DEFAULT '{}'::jsonb NOT NULL,
    mfa jsonb DEFAULT '{}'::jsonb NOT NULL,
    single_sign_on_enabled boolean DEFAULT false NOT NULL,
    support_email text,
    support_website_url text,
    unknown_session_redirect_url text,
    captcha_policy jsonb DEFAULT '{}'::jsonb NOT NULL,
    sentinel_policy jsonb DEFAULT '{}'::jsonb NOT NULL,
    email_blocklist_policy jsonb DEFAULT '{}'::jsonb NOT NULL,
    forgot_password_methods jsonb DEFAULT '[]'::jsonb
);


ALTER TABLE public.sign_in_experiences OWNER TO logto;

--
-- Name: sso_connector_idp_initiated_auth_configs; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.sso_connector_idp_initiated_auth_configs (
    tenant_id character varying(21) NOT NULL,
    connector_id character varying(128) NOT NULL,
    default_application_id character varying(21) NOT NULL,
    redirect_uri text,
    auth_parameters jsonb DEFAULT '{}'::jsonb NOT NULL,
    auto_send_authorization_request boolean DEFAULT false NOT NULL,
    client_idp_initiated_auth_callback_uri text,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    CONSTRAINT application_type CHECK (public.check_application_type(default_application_id, VARIADIC ARRAY['Traditional'::public.application_type, 'SPA'::public.application_type, 'SAML'::public.application_type]))
);


ALTER TABLE public.sso_connector_idp_initiated_auth_configs OWNER TO logto;

--
-- Name: sso_connectors; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.sso_connectors (
    tenant_id character varying(21) NOT NULL,
    id character varying(128) NOT NULL,
    provider_name character varying(128) NOT NULL,
    connector_name character varying(128) NOT NULL,
    config jsonb DEFAULT '{}'::jsonb NOT NULL,
    domains jsonb DEFAULT '[]'::jsonb NOT NULL,
    branding jsonb DEFAULT '{}'::jsonb NOT NULL,
    sync_profile boolean DEFAULT false NOT NULL,
    enable_token_storage boolean DEFAULT false NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.sso_connectors OWNER TO logto;

--
-- Name: subject_tokens; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.subject_tokens (
    tenant_id character varying(21) NOT NULL,
    id character varying(25) NOT NULL,
    context jsonb DEFAULT '{}'::jsonb NOT NULL,
    expires_at timestamp with time zone NOT NULL,
    consumed_at timestamp with time zone,
    user_id character varying(21) NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    creator_id character varying(32) NOT NULL
);


ALTER TABLE public.subject_tokens OWNER TO logto;

--
-- Name: systems; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.systems (
    key character varying(256) NOT NULL,
    value jsonb DEFAULT '{}'::jsonb NOT NULL
);


ALTER TABLE public.systems OWNER TO logto;

--
-- Name: tenants; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.tenants (
    id character varying(21) NOT NULL,
    db_user character varying(128),
    db_user_password character varying(128),
    name character varying(128) DEFAULT 'My Project'::character varying NOT NULL,
    tag character varying(64) DEFAULT 'development'::character varying NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    is_suspended boolean DEFAULT false NOT NULL
);


ALTER TABLE public.tenants OWNER TO logto;

--
-- Name: user_sso_identities; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.user_sso_identities (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    user_id character varying(12) NOT NULL,
    issuer character varying(256) NOT NULL,
    identity_id character varying(128) NOT NULL,
    detail jsonb DEFAULT '{}'::jsonb NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    sso_connector_id character varying(128) NOT NULL
);


ALTER TABLE public.user_sso_identities OWNER TO logto;

--
-- Name: users; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.users (
    tenant_id character varying(21) NOT NULL,
    id character varying(12) NOT NULL,
    username character varying(128),
    primary_email character varying(128),
    primary_phone character varying(128),
    password_encrypted character varying(256),
    password_encryption_method public.users_password_encryption_method,
    name character varying(128),
    avatar character varying(2048),
    profile jsonb DEFAULT '{}'::jsonb NOT NULL,
    application_id character varying(21),
    identities jsonb DEFAULT '{}'::jsonb NOT NULL,
    custom_data jsonb DEFAULT '{}'::jsonb NOT NULL,
    logto_config jsonb DEFAULT '{}'::jsonb NOT NULL,
    mfa_verifications jsonb DEFAULT '[]'::jsonb NOT NULL,
    is_suspended boolean DEFAULT false NOT NULL,
    last_sign_in_at timestamp with time zone,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.users OWNER TO logto;

--
-- Name: users_roles; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.users_roles (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    user_id character varying(21) NOT NULL,
    role_id character varying(21) NOT NULL,
    CONSTRAINT users_roles__role_type CHECK (public.check_role_type(role_id, 'User'::public.role_type))
);


ALTER TABLE public.users_roles OWNER TO logto;

--
-- Name: verification_records; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.verification_records (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    user_id character varying(21),
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    expires_at timestamp with time zone NOT NULL,
    data jsonb DEFAULT '{}'::jsonb NOT NULL
);


ALTER TABLE public.verification_records OWNER TO logto;

--
-- Name: verification_statuses; Type: TABLE; Schema: public; Owner: logto
--

CREATE TABLE public.verification_statuses (
    tenant_id character varying(21) NOT NULL,
    id character varying(21) NOT NULL,
    user_id character varying(21) NOT NULL,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    verified_identifier character varying(255)
);


ALTER TABLE public.verification_statuses OWNER TO logto;

--
-- Data for Name: account_centers; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.account_centers (tenant_id, id, enabled, fields, webauthn_related_origins) FROM stdin;
default	default	f	{}	[]
admin	default	f	{}	[]
\.


--
-- Data for Name: aggregated_daily_active_users; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.aggregated_daily_active_users (tenant_id, activity_date, user_id, activity_count) FROM stdin;
\.


--
-- Data for Name: application_secrets; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.application_secrets (tenant_id, application_id, name, value, created_at, expires_at) FROM stdin;
default	qs2705sv966er3q0fase8	Default secret	JC3BIxZLMZbAwVwpk2XkNngdSOy2dn87	2026-01-19 12:41:29.031285+00	\N
\.


--
-- Data for Name: application_sign_in_experiences; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.application_sign_in_experiences (tenant_id, application_id, color, branding, custom_css, terms_of_use_url, privacy_policy_url, display_name) FROM stdin;
\.


--
-- Data for Name: application_user_consent_organization_resource_scopes; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.application_user_consent_organization_resource_scopes (tenant_id, application_id, scope_id) FROM stdin;
\.


--
-- Data for Name: application_user_consent_organization_scopes; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.application_user_consent_organization_scopes (tenant_id, application_id, organization_scope_id) FROM stdin;
\.


--
-- Data for Name: application_user_consent_organizations; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.application_user_consent_organizations (tenant_id, application_id, organization_id, user_id) FROM stdin;
\.


--
-- Data for Name: application_user_consent_resource_scopes; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.application_user_consent_resource_scopes (tenant_id, application_id, scope_id) FROM stdin;
\.


--
-- Data for Name: application_user_consent_user_scopes; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.application_user_consent_user_scopes (tenant_id, application_id, user_scope) FROM stdin;
\.


--
-- Data for Name: applications; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.applications (tenant_id, id, name, secret, description, type, oidc_client_metadata, custom_client_metadata, protected_app_metadata, custom_data, is_third_party, created_at) FROM stdin;
admin	c6ha3b283fm69tau85rfy	Cloud Service	662dzhS37LYwrwYYrC3yEq0JUfaA933O	Machine to machine application for tenant default	MachineToMachine	{"redirectUris": [], "postLogoutRedirectUris": []}	{"tenantId": "default"}	\N	{}	f	2026-01-19 12:22:25.53527+00
admin	admin-console	Admin Console	nNbVhXq8nTIeT22iq2ipfRQP8mBPbcg2	Logto Admin Console.	SPA	{"redirectUris": [], "postLogoutRedirectUris": []}	{}	\N	{}	f	2026-01-19 12:22:25.53527+00
admin	m-default	Management API access for default	cxXwSsOQqb1vqUzlFDu6EdtsPN0PT0kA	Machine-to-machine app for accessing Management API of tenant 'default'.	MachineToMachine	{"redirectUris": [], "postLogoutRedirectUris": []}	{}	\N	{}	f	2026-01-19 12:22:25.53527+00
admin	m-admin	Management API access for admin	bnS7sRxn2p5TXziOAyPhUrg0DG8vPg4y	Machine-to-machine app for accessing Management API of tenant 'admin'.	MachineToMachine	{"redirectUris": [], "postLogoutRedirectUris": []}	{}	\N	{}	f	2026-01-19 12:22:25.53527+00
default	qs2705sv966er3q0fase8	Hublot	#internal:QDrXHJLLZNvUzDBOHROjGcZiDeS6uDVy	\N	Traditional	{"redirectUris": ["https://app.hublot.local/auth/callback"], "postLogoutRedirectUris": ["https://app.hublot.local"], "backchannelLogoutSessionRequired": false}	{"idTokenTtl": 3600, "corsAllowedOrigins": [], "rotateRefreshToken": true, "refreshTokenTtlInDays": 14, "alwaysIssueRefreshToken": false}	\N	{}	f	2026-01-19 12:41:29.019891+00
\.


--
-- Data for Name: applications_roles; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.applications_roles (tenant_id, id, application_id, role_id) FROM stdin;
admin	ykjr2269dxzuop9we5nzx	c6ha3b283fm69tau85rfy	8hmc4p87kenkvpo6yu38l
admin	dtwu66bp6xsfqkb5jtt1g	m-default	m-default
admin	8d58tgkq0k0wtp4e360ne	m-admin	m-admin
\.


--
-- Data for Name: captcha_providers; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.captcha_providers (tenant_id, id, config, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: connectors; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.connectors (tenant_id, id, sync_profile, enable_token_storage, connector_id, config, metadata, created_at) FROM stdin;
\.


--
-- Data for Name: custom_phrases; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.custom_phrases (tenant_id, id, language_tag, translation) FROM stdin;
\.


--
-- Data for Name: custom_profile_fields; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.custom_profile_fields (tenant_id, id, name, type, label, description, required, config, created_at, sie_order) FROM stdin;
\.


--
-- Data for Name: daily_active_users; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.daily_active_users (id, tenant_id, user_id, date) FROM stdin;
181fopa2u4rnnbz5zt2pd	admin	fdkhlepsssyz	2026-01-19 12:36:33.300156+00
ubzj5ucbl2jdhzbax01ji	admin	fdkhlepsssyz	2026-01-19 12:36:33.35425+00
xh7oof5qsqd45s85x7w87	admin	fdkhlepsssyz	2026-01-19 12:36:33.489912+00
xdak7uevq7ni8r6mtyci2	admin	fdkhlepsssyz	2026-01-19 12:36:37.366153+00
m3coz4thcf3th1np2ez55	default	4blpw0c6cxgn	2026-01-19 13:15:00.505895+00
\.


--
-- Data for Name: daily_token_usage; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.daily_token_usage (id, tenant_id, usage, user_token_usage, m2m_token_usage, date) FROM stdin;
nc7u37zhi94mqej10cu94	admin	4	4	0	2026-01-19 00:00:00+00
oyndi9obekmos78wrv119	default	1	1	0	2026-01-19 00:00:00+00
\.


--
-- Data for Name: domains; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.domains (tenant_id, id, domain, status, error_message, dns_records, cloudflare_data, updated_at, created_at) FROM stdin;
\.


--
-- Data for Name: email_templates; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.email_templates (tenant_id, id, language_tag, template_type, details, created_at) FROM stdin;
\.


--
-- Data for Name: hooks; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.hooks (tenant_id, id, name, event, events, config, signing_key, enabled, created_at) FROM stdin;
\.


--
-- Data for Name: idp_initiated_saml_sso_sessions; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.idp_initiated_saml_sso_sessions (tenant_id, id, connector_id, assertion_content, created_at, expires_at) FROM stdin;
\.


--
-- Data for Name: logs; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.logs (tenant_id, id, key, payload, created_at) FROM stdin;
admin	ectzuq0bc8rx4imemaheq	Interaction.Create	{"ip": "172.19.0.1", "key": "Interaction.Create", "params": {"scope": "openid offline_access profile email identities custom_data urn:logto:scope:organizations urn:logto:scope:organization_roles all", "state": "Gzfyz8c2ysF2XTz05UxxoQINtEMbQvlC5sgzdZoVShdu-WZ9k4u8Prbnlaz8HYnswCb4VXfFtBMR7ZeteHKb2A", "prompt": "login consent", "resource": ["https://default.logto.app/api", "https://admin.logto.app/me", "urn:logto:resource:organizations"], "client_id": "admin-console", "redirect_uri": "https://auth-admin.hublot.local/console/callback", "response_type": "code", "code_challenge": "aa6vGacwYzVF7z7Wg34SOG4lau_0uQScUgwLz9dUgfo", "code_challenge_method": "S256"}, "prompt": {"name": "login", "details": {}, "reasons": ["login_prompt", "no_session"]}, "result": "Success", "sessionId": "ibmbHPBIvyj0xLc2T2GTH", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "applicationId": "admin-console", "interactionId": "-fJ-1WPwczu6IepK0MG2Q"}	2026-01-19 12:36:22.869704+00
admin	b7m7k3izpyw98u53m62vl	Interaction.Register.Create	{"ip": "172.19.0.1", "key": "Interaction.Register.Create", "result": "Success", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "interaction": {"mfa": {}, "captcha": {"skipped": false, "verified": false}, "profile": {}, "interactionEvent": "Register", "verificationRecords": []}, "applicationId": "admin-console"}	2026-01-19 12:36:26.826979+00
admin	ziv4ymlww1mg6wuz4ik86	Interaction.Register.Profile.Update	{"ip": "172.19.0.1", "key": "Interaction.Register.Profile.Update", "result": "Success", "payload": {"type": "username", "value": "admin"}, "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "interaction": {"mfa": {}, "captcha": {"skipped": false, "verified": false}, "profile": {"username": "admin"}, "interactionEvent": "Register", "verificationRecords": []}, "applicationId": "admin-console"}	2026-01-19 12:36:26.840271+00
admin	48z60fg135oz9uy42ljob	Interaction.Register.Profile.Update	{"ip": "172.19.0.1", "key": "Interaction.Register.Profile.Update", "result": "Success", "payload": {"type": "password", "value": "hublotlogto"}, "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "interaction": {"mfa": {}, "captcha": {"skipped": false, "verified": false}, "profile": {"username": "admin", "passwordEncrypted": "$argon2i$v=19$m=8192,t=8,p=1$Db6lK8rARmYKXtM5IzDlEg$EvNV1ymU8a/kxqsYjlDHNGUTCEqismiZ8x0vvleGJJM", "passwordEncryptionMethod": "Argon2i"}, "interactionEvent": "Register", "verificationRecords": []}, "applicationId": "admin-console"}	2026-01-19 12:36:32.955516+00
admin	h6da11ra1u3025lfg3s1t	Interaction.Register.Identifier.Submit	{"ip": "172.19.0.1", "key": "Interaction.Register.Identifier.Submit", "user": {"id": "fdkhlepsssyz", "name": null, "avatar": null, "profile": {}, "tenantId": "admin", "username": "admin", "createdAt": 1768826192972, "updatedAt": 1768826192972, "customData": {}, "identities": {}, "isSuspended": false, "logtoConfig": {}, "lastSignInAt": null, "primaryEmail": null, "primaryPhone": null, "applicationId": null, "mfaVerifications": [], "passwordEncrypted": "$argon2i$v=19$m=8192,t=8,p=1$Db6lK8rARmYKXtM5IzDlEg$EvNV1ymU8a/kxqsYjlDHNGUTCEqismiZ8x0vvleGJJM", "passwordEncryptionMethod": "Argon2i"}, "result": "Success", "userId": "fdkhlepsssyz", "payload": {}, "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "interaction": {"mfa": {}, "userId": "fdkhlepsssyz", "captcha": {"skipped": false, "verified": false}, "profile": {}, "interactionEvent": "Register", "verificationRecords": []}, "applicationId": "admin-console"}	2026-01-19 12:36:32.997682+00
admin	nkkk0zwnu29jespbx8aku	Interaction.Register.Submit	{"ip": "172.19.0.1", "key": "Interaction.Register.Submit", "result": "Success", "userId": "fdkhlepsssyz", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "interaction": {"mfa": {}, "userId": "fdkhlepsssyz", "captcha": {"skipped": false, "verified": false}, "profile": {}, "interactionEvent": "Register", "verificationRecords": []}, "applicationId": "admin-console"}	2026-01-19 12:36:33.012019+00
admin	0tf0qvignxienz7exf90e	Interaction.Create	{"ip": "172.19.0.1", "key": "Interaction.Create", "params": {"scope": "openid offline_access profile email identities custom_data urn:logto:scope:organizations urn:logto:scope:organization_roles all", "state": "Gzfyz8c2ysF2XTz05UxxoQINtEMbQvlC5sgzdZoVShdu-WZ9k4u8Prbnlaz8HYnswCb4VXfFtBMR7ZeteHKb2A", "prompt": "login consent", "resource": ["https://default.logto.app/api", "https://admin.logto.app/me", "urn:logto:resource:organizations"], "client_id": "admin-console", "redirect_uri": "https://auth-admin.hublot.local/console/callback", "response_type": "code", "code_challenge": "aa6vGacwYzVF7z7Wg34SOG4lau_0uQScUgwLz9dUgfo", "code_challenge_method": "S256"}, "prompt": {"name": "consent", "details": {"missingOIDCScope": ["openid", "offline_access", "profile", "email", "identities", "custom_data", "urn:logto:scope:organizations", "urn:logto:scope:organization_roles"], "missingResourceScopes": {"https://admin.logto.app/me": ["all"], "https://default.logto.app/api": ["all"]}}, "reasons": ["consent_prompt", "op_scopes_missing", "rs_scopes_missing"]}, "result": "Success", "userId": "fdkhlepsssyz", "sessionId": "p0B7Ac_fqDLXmOaKECvgE", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "applicationId": "admin-console", "interactionId": "b1xyX--Ilh30R2PyLd1dO"}	2026-01-19 12:36:33.041055+00
admin	r3fqnbucgt9s8stxt9qkm	Interaction.End	{"ip": "172.19.0.1", "key": "Interaction.End", "params": {"scope": "openid offline_access profile email identities custom_data urn:logto:scope:organizations urn:logto:scope:organization_roles all", "state": "Gzfyz8c2ysF2XTz05UxxoQINtEMbQvlC5sgzdZoVShdu-WZ9k4u8Prbnlaz8HYnswCb4VXfFtBMR7ZeteHKb2A", "prompt": "login consent", "resource": ["https://default.logto.app/api", "https://admin.logto.app/me", "urn:logto:resource:organizations"], "client_id": "admin-console", "redirect_uri": "https://auth-admin.hublot.local/console/callback", "response_type": "code", "code_challenge": "aa6vGacwYzVF7z7Wg34SOG4lau_0uQScUgwLz9dUgfo", "code_challenge_method": "S256"}, "result": "Success", "sessionId": "p0B7Ac_fqDLXmOaKECvgE", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "applicationId": "admin-console", "interactionId": "-fJ-1WPwczu6IepK0MG2Q"}	2026-01-19 12:36:33.041016+00
admin	lh02fw2ugpztwhnuj0yk2	Interaction.End	{"ip": "172.19.0.1", "key": "Interaction.End", "params": {"scope": "openid offline_access profile email identities custom_data urn:logto:scope:organizations urn:logto:scope:organization_roles all", "state": "Gzfyz8c2ysF2XTz05UxxoQINtEMbQvlC5sgzdZoVShdu-WZ9k4u8Prbnlaz8HYnswCb4VXfFtBMR7ZeteHKb2A", "prompt": "login consent", "resource": ["https://default.logto.app/api", "https://admin.logto.app/me", "urn:logto:resource:organizations"], "client_id": "admin-console", "redirect_uri": "https://auth-admin.hublot.local/console/callback", "response_type": "code", "code_challenge": "aa6vGacwYzVF7z7Wg34SOG4lau_0uQScUgwLz9dUgfo", "code_challenge_method": "S256"}, "result": "Success", "sessionId": "6S9g5xZGPrA3I5cr56S8m", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "applicationId": "admin-console", "interactionId": "b1xyX--Ilh30R2PyLd1dO"}	2026-01-19 12:36:33.075613+00
admin	7zcx6iv1meekzlb9cnk3z	ExchangeTokenBy.AuthorizationCode	{"ip": "172.19.0.1", "key": "ExchangeTokenBy.AuthorizationCode", "scope": "openid offline_access profile email identities custom_data urn:logto:scope:organizations urn:logto:scope:organization_roles", "params": {"code": "HFNZ1jjLbm10yxXaBdVBYf8Us4Rbh2F1GMj69OCrAS-", "client_id": "admin-console", "grant_type": "authorization_code", "redirect_uri": "https://auth-admin.hublot.local/console/callback", "code_verifier": "8JlPsWZJC08Xwuz4-ZEzmW9SjJvj-5JxzSGbQUfBp_5FmBxHhkZkP-jGVKl9sRevsaq3SgNmJOtX1v7P3dB6Jg"}, "result": "Success", "userId": "fdkhlepsssyz", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "tokenTypes": ["AccessToken", "RefreshToken", "IdToken"], "applicationId": "admin-console"}	2026-01-19 12:36:33.31428+00
admin	9dgulabubxev37mcrhix1	ExchangeTokenBy.RefreshToken	{"ip": "172.19.0.1", "key": "ExchangeTokenBy.RefreshToken", "scope": "all", "params": {"resource": "https://admin.logto.app/me", "client_id": "admin-console", "grant_type": "refresh_token", "refresh_token": "oZlg5rsTuePqlaSfg_7oiOoZ-bjiiA7AkKBezstRl-A"}, "result": "Success", "userId": "fdkhlepsssyz", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "tokenTypes": ["AccessToken", "RefreshToken", "IdToken"], "applicationId": "admin-console"}	2026-01-19 12:36:33.358228+00
admin	ns5no52rmc83svlwzz0yd	ExchangeTokenBy.RefreshToken	{"ip": "172.19.0.1", "key": "ExchangeTokenBy.RefreshToken", "scope": "", "params": {"client_id": "admin-console", "grant_type": "refresh_token", "refresh_token": "I5QHd8qUK6TbTvi51c3aJ4BeMNQODqKordauxeDE-ro", "organization_id": "t-default"}, "result": "Success", "userId": "fdkhlepsssyz", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "tokenTypes": ["AccessToken", "RefreshToken", "IdToken"], "applicationId": "admin-console"}	2026-01-19 12:36:33.497431+00
admin	8zkcgi241xg9dp8a50gg1	ExchangeTokenBy.RefreshToken	{"ip": "172.19.0.1", "key": "ExchangeTokenBy.RefreshToken", "scope": "all", "params": {"resource": "https://default.logto.app/api", "client_id": "admin-console", "grant_type": "refresh_token", "refresh_token": "E3_6l-hGgz4DPCRkUoLoMCPJIBpg5-_sVrkx7lOJBzX"}, "result": "Success", "userId": "fdkhlepsssyz", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "tokenTypes": ["AccessToken", "RefreshToken", "IdToken"], "applicationId": "admin-console"}	2026-01-19 12:36:37.371799+00
default	ctyzb0q2n8gwz0ni9s39h	Interaction.Create	{"ip": "172.19.0.1", "key": "Interaction.Create", "params": {"scope": "openid profile email", "state": "[REDACTED], "client_id": "qs2705sv966er3q0fase8", "redirect_uri": "https://app.hublot.local/auth/callback", "response_type": "code", "code_challenge": "bUt0FIFomTzuGrq9-Fen4qAW7J3uWUX2YK8Sg8qXsJ4", "code_challenge_method": "S256"}, "prompt": {"name": "login", "details": {}, "reasons": ["no_session"]}, "result": "Success", "sessionId": "q5tTe9yORE2di7MCV5srf", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "applicationId": "qs2705sv966er3q0fase8", "interactionId": "8rpW3Fd_L4cso5wnduYJw"}	2026-01-19 12:43:10.328697+00
default	xstfi0u278hklgxxft169	Interaction.Create	{"ip": "172.19.0.1", "key": "Interaction.Create", "params": {"scope": "openid profile email", "state": "[REDACTED], "client_id": "qs2705sv966er3q0fase8", "redirect_uri": "https://app.hublot.local/auth/callback", "response_type": "code", "code_challenge": "lr3W-jG4chDBOJmV0RLDKQ97ivWF3FUfpawnW2Sbw7Y", "code_challenge_method": "S256"}, "prompt": {"name": "login", "details": {}, "reasons": ["no_session"]}, "result": "Success", "sessionId": "WZJOVufALHJkIVSFPMk65", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "applicationId": "qs2705sv966er3q0fase8", "interactionId": "wKE5FTVYcBXHWOLI7p5EX"}	2026-01-19 13:11:24.898109+00
default	dsy2x3ppclrr5b1pwje2e	Interaction.Create	{"ip": "172.19.0.1", "key": "Interaction.Create", "params": {"scope": "openid profile email", "state": "[REDACTED], "client_id": "qs2705sv966er3q0fase8", "redirect_uri": "https://app.hublot.local/auth/callback", "response_type": "code", "code_challenge": "HKJUIRIeesAC9U82uxT7Snfi0GApNEuol-WvWNg8Fsc", "code_challenge_method": "S256"}, "prompt": {"name": "login", "details": {}, "reasons": ["no_session"]}, "result": "Success", "sessionId": "RxQWMo5pUJ6h_6KoCTAnH", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "applicationId": "qs2705sv966er3q0fase8", "interactionId": "gTU4ErCi-ha_nPPqfHkvm"}	2026-01-19 13:11:49.975451+00
default	hov9ay9ao9omlko9bvfns	Interaction.SignIn.Create	{"ip": "172.19.0.1", "key": "Interaction.SignIn.Create", "result": "Success", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "interaction": {"mfa": {}, "captcha": {"skipped": false, "verified": false}, "profile": {}, "interactionEvent": "SignIn", "verificationRecords": []}, "applicationId": "qs2705sv966er3q0fase8"}	2026-01-19 13:15:00.313978+00
default	srrs95mon1gcdzte7gs4v	Interaction.SignIn.Verification.Password.Submit	{"ip": "172.19.0.1", "key": "Interaction.SignIn.Verification.Password.Submit", "result": "Success", "payload": {"password": "******", "identifier": {"type": "username", "value": "demo1"}}, "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "interaction": {"mfa": {}, "captcha": {"skipped": false, "verified": false}, "profile": {}, "interactionEvent": "SignIn", "verificationRecords": [{"id": "wmnrca7ptvrr8rlpoq3dl", "type": "Password", "verified": true, "identifier": {"type": "username", "value": "demo1"}}]}, "applicationId": "qs2705sv966er3q0fase8"}	2026-01-19 13:15:00.391731+00
default	x0wn3fnbkq9q83b312wml	Interaction.SignIn.Identifier.Submit	{"ip": "172.19.0.1", "key": "Interaction.SignIn.Identifier.Submit", "result": "Success", "userId": "4blpw0c6cxgn", "payload": {"verificationId": "wmnrca7ptvrr8rlpoq3dl"}, "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "interaction": {"mfa": {}, "userId": "4blpw0c6cxgn", "captcha": {"skipped": false, "verified": false}, "profile": {}, "interactionEvent": "SignIn", "verificationRecords": [{"id": "wmnrca7ptvrr8rlpoq3dl", "type": "Password", "verified": true, "identifier": {"type": "username", "value": "demo1"}}]}, "verification": {"id": "wmnrca7ptvrr8rlpoq3dl", "type": "Password", "verified": true, "identifier": {"type": "username", "value": "demo1"}}, "applicationId": "qs2705sv966er3q0fase8"}	2026-01-19 13:15:00.411908+00
default	pji3f1v4ajhljaoeemph5	Interaction.SignIn.Submit	{"ip": "172.19.0.1", "key": "Interaction.SignIn.Submit", "result": "Success", "userId": "4blpw0c6cxgn", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "interaction": {"mfa": {}, "userId": "4blpw0c6cxgn", "captcha": {"skipped": false, "verified": false}, "profile": {}, "interactionEvent": "SignIn", "verificationRecords": [{"id": "wmnrca7ptvrr8rlpoq3dl", "type": "Password", "verified": true, "identifier": {"type": "username", "value": "demo1"}}]}, "applicationId": "qs2705sv966er3q0fase8"}	2026-01-19 13:15:00.43525+00
default	q7a7em44lblcig5x321ne	Interaction.Create	{"ip": "172.19.0.1", "key": "Interaction.Create", "params": {"scope": "openid profile email", "state": "[REDACTED], "client_id": "qs2705sv966er3q0fase8", "redirect_uri": "https://app.hublot.local/auth/callback", "response_type": "code", "code_challenge": "HKJUIRIeesAC9U82uxT7Snfi0GApNEuol-WvWNg8Fsc", "code_challenge_method": "S256"}, "prompt": {"name": "consent", "details": {"missingOIDCScope": ["openid", "profile", "email"]}, "reasons": ["op_scopes_missing"]}, "result": "Success", "userId": "4blpw0c6cxgn", "sessionId": "P5yj5jgpADv3MnKNjtxF1", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "applicationId": "qs2705sv966er3q0fase8", "interactionId": "i5KkxxdIVL4YsW-sPG3-O"}	2026-01-19 13:15:00.451706+00
default	3f99wsijjqzitg3hgtfxt	Interaction.End	{"ip": "172.19.0.1", "key": "Interaction.End", "params": {"scope": "openid profile email", "state": "[REDACTED], "client_id": "qs2705sv966er3q0fase8", "redirect_uri": "https://app.hublot.local/auth/callback", "response_type": "code", "code_challenge": "HKJUIRIeesAC9U82uxT7Snfi0GApNEuol-WvWNg8Fsc", "code_challenge_method": "S256"}, "result": "Success", "sessionId": "bzgVqFQip8QUX3rrH_UdQ", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "applicationId": "qs2705sv966er3q0fase8", "interactionId": "i5KkxxdIVL4YsW-sPG3-O"}	2026-01-19 13:15:00.473251+00
default	b71dmmpvq8813lwqas0na	Interaction.End	{"ip": "172.19.0.1", "key": "Interaction.End", "params": {"scope": "openid profile email", "state": "[REDACTED], "client_id": "qs2705sv966er3q0fase8", "redirect_uri": "https://app.hublot.local/auth/callback", "response_type": "code", "code_challenge": "HKJUIRIeesAC9U82uxT7Snfi0GApNEuol-WvWNg8Fsc", "code_challenge_method": "S256"}, "result": "Success", "sessionId": "P5yj5jgpADv3MnKNjtxF1", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "applicationId": "qs2705sv966er3q0fase8", "interactionId": "gTU4ErCi-ha_nPPqfHkvm"}	2026-01-19 13:15:00.451575+00
default	9zdzne4brv3bp61rigng6	ExchangeTokenBy.AuthorizationCode	{"ip": "172.19.0.1", "key": "ExchangeTokenBy.AuthorizationCode", "scope": "openid profile email", "params": {"code": "O6aVImDUpeI47wEgLO_qELZZE-ATxs9cCEb4DoZHhoR", "client_id": "qs2705sv966er3q0fase8", "grant_type": "authorization_code", "redirect_uri": "https://app.hublot.local/auth/callback", "client_secret": "#internal:QDrXHJLLZNvUzDBOHROjGcZiDeS6uDVy", "code_verifier": "wm3Ke5RuecEhcuHri2HKECFSvjuW_zUs2d20uoFQvQc"}, "result": "Success", "userId": "4blpw0c6cxgn", "userAgent": "node", "tokenTypes": ["AccessToken", "IdToken"], "applicationId": "qs2705sv966er3q0fase8", "applicationSecret": {"name": "Default secret"}}	2026-01-19 13:15:00.509144+00
\.


--
-- Data for Name: logto_configs; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.logto_configs (tenant_id, key, value) FROM stdin;
default	oidc.privateKeys	[{"id": "gdvrgpcnnky8zybmf65la", "value": "[REDACTED]\\n", "createdAt": 1768825345}]
default	oidc.cookieKeys	[{"id": "tcfb92fy0fv877bdcdlml", "value": "4PN6IYBuit6igV6q3HhGITqv9bYdMqg2", "createdAt": 1768825345}]
admin	oidc.privateKeys	[{"id": "bz75ajfwu84vslzjnl2vn", "value": "[REDACTED]\\n", "createdAt": 1768825345}]
admin	oidc.cookieKeys	[{"id": "j7nftyrg6i99ykkh054cf", "value": "obUUs0nydx0FhorvYIlPRLofFTnKd4wE", "createdAt": 1768825345}]
default	adminConsole	{"organizationCreated": false, "signInExperienceCustomized": false}
admin	adminConsole	{"organizationCreated": false, "signInExperienceCustomized": false}
default	cloudConnection	{"appId": "c6ha3b283fm69tau85rfy", "resource": "https://cloud.logto.io/api", "appSecret": "662dzhS37LYwrwYYrC3yEq0JUfaA933O"}
\.


--
-- Data for Name: oidc_model_instances; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.oidc_model_instances (tenant_id, model_name, id, payload, expires_at, consumed_at) FROM stdin;
admin	Grant	cIS7ZaVKNB0nTPXhLFrP_hypgtF61eP8R0On_icQivJ	{"exp": 1784378193, "iat": 1768826193, "jti": "cIS7ZaVKNB0nTPXhLFrP_hypgtF61eP8R0On_icQivJ", "kind": "Grant", "openid": {"scope": "openid offline_access profile email identities custom_data urn:logto:scope:organizations urn:logto:scope:organization_roles"}, "clientId": "admin-console", "accountId": "fdkhlepsssyz", "resources": {"https://admin.logto.app/me": "all", "https://default.logto.app/api": "all"}}	2026-07-18 12:36:33.058+00	\N
admin	Session	6S9g5xZGPrA3I5cr56S8m	{"exp": 1770035793, "iat": 1768826193, "jti": "6S9g5xZGPrA3I5cr56S8m", "uid": "BABmHV2BfgehDZGhpXiHF", "kind": "Session", "loginTs": 1768826193, "accountId": "fdkhlepsssyz", "authorizations": {"admin-console": {"sid": "A4XDTNLeLAMBLt74u66y0", "grantId": "cIS7ZaVKNB0nTPXhLFrP_hypgtF61eP8R0On_icQivJ", "persistsLogout": true}}}	2026-02-02 12:36:33.074+00	\N
admin	AuthorizationCode	HFNZ1jjLbm10yxXaBdVBYf8Us4Rbh2F1GMj69OCrAS-	{"exp": 1768826253, "iat": 1768826193, "jti": "HFNZ1jjLbm10yxXaBdVBYf8Us4Rbh2F1GMj69OCrAS-", "kind": "AuthorizationCode", "scope": "openid offline_access profile email identities custom_data urn:logto:scope:organizations urn:logto:scope:organization_roles all", "claims": {"id_token": {"auth_time": {"essential": true}}}, "grantId": "cIS7ZaVKNB0nTPXhLFrP_hypgtF61eP8R0On_icQivJ", "authTime": 1768826193, "clientId": "admin-console", "resource": ["https://default.logto.app/api", "https://admin.logto.app/me", "urn:logto:resource:organizations"], "accountId": "fdkhlepsssyz", "sessionUid": "BABmHV2BfgehDZGhpXiHF", "redirectUri": "https://auth-admin.hublot.local/console/callback", "codeChallenge": "aa6vGacwYzVF7z7Wg34SOG4lau_0uQScUgwLz9dUgfo", "codeChallengeMethod": "S256"}	2026-01-19 12:37:33.073+00	2026-01-19 12:36:33.296+00
admin	AccessToken	TNXfhiFw7-Bm1kTl9fRkmA6Ef0N1DVOH3Jhm3EdCXyD	{"exp": 1768829793, "gty": "authorization_code", "iat": 1768826193, "jti": "TNXfhiFw7-Bm1kTl9fRkmA6Ef0N1DVOH3Jhm3EdCXyD", "kind": "AccessToken", "scope": "openid offline_access profile email identities custom_data urn:logto:scope:organizations urn:logto:scope:organization_roles", "claims": {"id_token": {"auth_time": {"essential": true}}}, "grantId": "cIS7ZaVKNB0nTPXhLFrP_hypgtF61eP8R0On_icQivJ", "clientId": "admin-console", "accountId": "fdkhlepsssyz", "sessionUid": "BABmHV2BfgehDZGhpXiHF"}	2026-01-19 13:36:33.298+00	\N
admin	RefreshToken	oZlg5rsTuePqlaSfg_7oiOoZ-bjiiA7AkKBezstRl-A	{"exp": 1770035793, "gty": "authorization_code", "iat": 1768826193, "jti": "oZlg5rsTuePqlaSfg_7oiOoZ-bjiiA7AkKBezstRl-A", "iiat": 1768826193, "kind": "RefreshToken", "scope": "openid offline_access profile email identities custom_data urn:logto:scope:organizations urn:logto:scope:organization_roles all", "claims": {"id_token": {"auth_time": {"essential": true}}}, "grantId": "cIS7ZaVKNB0nTPXhLFrP_hypgtF61eP8R0On_icQivJ", "authTime": 1768826193, "clientId": "admin-console", "resource": ["https://default.logto.app/api", "https://admin.logto.app/me", "urn:logto:resource:organizations"], "accountId": "fdkhlepsssyz", "rotations": 0, "sessionUid": "BABmHV2BfgehDZGhpXiHF"}	2026-02-02 12:36:33.299+00	2026-01-19 12:36:33.342+00
admin	RefreshToken	I5QHd8qUK6TbTvi51c3aJ4BeMNQODqKordauxeDE-ro	{"exp": 1770035793, "gty": "authorization_code refresh_token", "iat": 1768826193, "jti": "I5QHd8qUK6TbTvi51c3aJ4BeMNQODqKordauxeDE-ro", "iiat": 1768826193, "kind": "RefreshToken", "scope": "openid offline_access profile email identities custom_data urn:logto:scope:organizations urn:logto:scope:organization_roles all", "claims": {"id_token": {"auth_time": {"essential": true}}}, "grantId": "cIS7ZaVKNB0nTPXhLFrP_hypgtF61eP8R0On_icQivJ", "authTime": 1768826193, "clientId": "admin-console", "resource": ["https://default.logto.app/api", "https://admin.logto.app/me", "urn:logto:resource:organizations"], "accountId": "fdkhlepsssyz", "rotations": 1, "sessionUid": "BABmHV2BfgehDZGhpXiHF"}	2026-02-02 12:36:33.343+00	2026-01-19 12:36:33.477+00
admin	RefreshToken	E3_6l-hGgz4DPCRkUoLoMCPJIBpg5-_sVrkx7lOJBzX	{"exp": 1770035793, "gty": "authorization_code refresh_token", "iat": 1768826193, "jti": "E3_6l-hGgz4DPCRkUoLoMCPJIBpg5-_sVrkx7lOJBzX", "iiat": 1768826193, "kind": "RefreshToken", "scope": "openid offline_access profile email identities custom_data urn:logto:scope:organizations urn:logto:scope:organization_roles all", "claims": {"id_token": {"auth_time": {"essential": true}}}, "grantId": "cIS7ZaVKNB0nTPXhLFrP_hypgtF61eP8R0On_icQivJ", "authTime": 1768826193, "clientId": "admin-console", "resource": ["https://default.logto.app/api", "https://admin.logto.app/me", "urn:logto:resource:organizations"], "accountId": "fdkhlepsssyz", "rotations": 2, "sessionUid": "BABmHV2BfgehDZGhpXiHF"}	2026-02-02 12:36:33.479+00	2026-01-19 12:36:37.356+00
admin	RefreshToken	J7O9ywFp4AJxdNeakl9uy1x77SD6SJMfUrUlVB36jiS	{"exp": 1770035793, "gty": "authorization_code refresh_token", "iat": 1768826197, "jti": "J7O9ywFp4AJxdNeakl9uy1x77SD6SJMfUrUlVB36jiS", "iiat": 1768826193, "kind": "RefreshToken", "scope": "openid offline_access profile email identities custom_data urn:logto:scope:organizations urn:logto:scope:organization_roles all", "claims": {"id_token": {"auth_time": {"essential": true}}}, "grantId": "cIS7ZaVKNB0nTPXhLFrP_hypgtF61eP8R0On_icQivJ", "authTime": 1768826193, "clientId": "admin-console", "resource": ["https://default.logto.app/api", "https://admin.logto.app/me", "urn:logto:resource:organizations"], "accountId": "fdkhlepsssyz", "rotations": 3, "sessionUid": "BABmHV2BfgehDZGhpXiHF"}	2026-02-02 12:36:33.357+00	\N
default	Interaction	8rpW3Fd_L4cso5wnduYJw	{"cid": "Wop4uLa2SjtSvUojN_Xl2", "exp": 1768830190, "iat": 1768826590, "jti": "8rpW3Fd_L4cso5wnduYJw", "kind": "Interaction", "params": {"scope": "openid profile email", "state": "[REDACTED], "client_id": "qs2705sv966er3q0fase8", "redirect_uri": "https://app.hublot.local/auth/callback", "response_type": "code", "code_challenge": "bUt0FIFomTzuGrq9-Fen4qAW7J3uWUX2YK8Sg8qXsJ4", "code_challenge_method": "S256"}, "prompt": {"name": "login", "details": {}, "reasons": ["no_session"]}, "returnTo": "https://auth.hublot.local/oidc/auth/8rpW3Fd_L4cso5wnduYJw"}	2026-01-19 13:43:10.32+00	\N
default	Interaction	wKE5FTVYcBXHWOLI7p5EX	{"cid": "UHRvW7lZizV20TTEloAlf", "exp": 1768831884, "iat": 1768828284, "jti": "wKE5FTVYcBXHWOLI7p5EX", "kind": "Interaction", "params": {"scope": "openid profile email", "state": "[REDACTED], "client_id": "qs2705sv966er3q0fase8", "redirect_uri": "https://app.hublot.local/auth/callback", "response_type": "code", "code_challenge": "lr3W-jG4chDBOJmV0RLDKQ97ivWF3FUfpawnW2Sbw7Y", "code_challenge_method": "S256"}, "prompt": {"name": "login", "details": {}, "reasons": ["no_session"]}, "returnTo": "https://auth.hublot.local/oidc/auth/wKE5FTVYcBXHWOLI7p5EX"}	2026-01-19 14:11:24.89+00	\N
default	Grant	4z-aaiUwbLvJLWgF2AHB8EeQ1w3KfcSqwfIswapPdau	{"exp": 1784380500, "iat": 1768828500, "jti": "4z-aaiUwbLvJLWgF2AHB8EeQ1w3KfcSqwfIswapPdau", "kind": "Grant", "openid": {"scope": "openid profile email"}, "clientId": "qs2705sv966er3q0fase8", "accountId": "4blpw0c6cxgn"}	2026-07-18 13:15:00.46+00	\N
default	Session	bzgVqFQip8QUX3rrH_UdQ	{"exp": 1770038100, "iat": 1768828500, "jti": "bzgVqFQip8QUX3rrH_UdQ", "uid": "-v5kd3ALWGhOfNjEBaM_h", "kind": "Session", "loginTs": 1768828500, "accountId": "4blpw0c6cxgn", "authorizations": {"qs2705sv966er3q0fase8": {"sid": "qIg-amHeWQPgQi8Wn2euC", "grantId": "4z-aaiUwbLvJLWgF2AHB8EeQ1w3KfcSqwfIswapPdau"}}}	2026-02-02 13:15:00.472+00	\N
default	AuthorizationCode	O6aVImDUpeI47wEgLO_qELZZE-ATxs9cCEb4DoZHhoR	{"exp": 1768828560, "iat": 1768828500, "jti": "O6aVImDUpeI47wEgLO_qELZZE-ATxs9cCEb4DoZHhoR", "kind": "AuthorizationCode", "scope": "openid profile email", "grantId": "4z-aaiUwbLvJLWgF2AHB8EeQ1w3KfcSqwfIswapPdau", "authTime": 1768828500, "clientId": "qs2705sv966er3q0fase8", "accountId": "4blpw0c6cxgn", "sessionUid": "-v5kd3ALWGhOfNjEBaM_h", "redirectUri": "https://app.hublot.local/auth/callback", "codeChallenge": "HKJUIRIeesAC9U82uxT7Snfi0GApNEuol-WvWNg8Fsc", "expiresWithSession": true, "codeChallengeMethod": "S256"}	2026-01-19 13:16:00.471+00	2026-01-19 13:15:00.501+00
default	AccessToken	PIPGRKkTkYCq2uY6C8DKzvzH5ROdlEMcUO6-PmRxo8a	{"exp": 1768832100, "gty": "authorization_code", "iat": 1768828500, "jti": "PIPGRKkTkYCq2uY6C8DKzvzH5ROdlEMcUO6-PmRxo8a", "kind": "AccessToken", "scope": "openid profile email", "grantId": "4z-aaiUwbLvJLWgF2AHB8EeQ1w3KfcSqwfIswapPdau", "clientId": "qs2705sv966er3q0fase8", "accountId": "4blpw0c6cxgn", "sessionUid": "-v5kd3ALWGhOfNjEBaM_h", "expiresWithSession": true}	2026-01-19 14:15:00.503+00	\N
\.


--
-- Data for Name: oidc_session_extensions; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.oidc_session_extensions (tenant_id, session_uid, account_id, last_submission, created_at, updated_at) FROM stdin;
admin	BABmHV2BfgehDZGhpXiHF	fdkhlepsssyz	{"mfa": {}, "login": {"accountId": "fdkhlepsssyz"}, "userId": "fdkhlepsssyz", "captcha": {"skipped": false, "verified": false}, "profile": {}, "interactionEvent": "Register", "verificationRecords": []}	2026-01-19 12:36:33.056426+00	2026-01-19 12:36:33.056426+00
default	-v5kd3ALWGhOfNjEBaM_h	4blpw0c6cxgn	{"mfa": {}, "login": {"accountId": "4blpw0c6cxgn"}, "userId": "4blpw0c6cxgn", "captcha": {"skipped": false, "verified": false}, "profile": {}, "interactionEvent": "SignIn", "verificationRecords": [{"id": "wmnrca7ptvrr8rlpoq3dl", "type": "Password", "verified": true, "identifier": {"type": "username", "value": "demo1"}}]}	2026-01-19 13:15:00.458578+00	2026-01-19 13:15:00.458578+00
\.


--
-- Data for Name: one_time_tokens; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.one_time_tokens (tenant_id, id, email, token, context, status, created_at, expires_at) FROM stdin;
\.


--
-- Data for Name: organization_application_relations; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.organization_application_relations (tenant_id, organization_id, application_id) FROM stdin;
\.


--
-- Data for Name: organization_invitation_role_relations; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.organization_invitation_role_relations (tenant_id, organization_invitation_id, organization_role_id) FROM stdin;
\.


--
-- Data for Name: organization_invitations; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.organization_invitations (tenant_id, id, inviter_id, invitee, accepted_user_id, organization_id, status, created_at, updated_at, expires_at) FROM stdin;
\.


--
-- Data for Name: organization_jit_email_domains; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.organization_jit_email_domains (tenant_id, organization_id, email_domain) FROM stdin;
\.


--
-- Data for Name: organization_jit_roles; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.organization_jit_roles (tenant_id, organization_id, organization_role_id) FROM stdin;
\.


--
-- Data for Name: organization_jit_sso_connectors; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.organization_jit_sso_connectors (tenant_id, organization_id, sso_connector_id) FROM stdin;
\.


--
-- Data for Name: organization_role_application_relations; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.organization_role_application_relations (tenant_id, organization_id, organization_role_id, application_id) FROM stdin;
\.


--
-- Data for Name: organization_role_resource_scope_relations; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.organization_role_resource_scope_relations (tenant_id, organization_role_id, scope_id) FROM stdin;
\.


--
-- Data for Name: organization_role_scope_relations; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.organization_role_scope_relations (tenant_id, organization_role_id, organization_scope_id) FROM stdin;
admin	admin	read-data
admin	admin	write-data
admin	admin	delete-data
admin	admin	read-member
admin	admin	invite-member
admin	admin	remove-member
admin	admin	update-member-role
admin	admin	manage-tenant
admin	collaborator	read-data
admin	collaborator	write-data
admin	collaborator	delete-data
admin	collaborator	read-member
\.


--
-- Data for Name: organization_role_user_relations; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.organization_role_user_relations (tenant_id, organization_id, organization_role_id, user_id) FROM stdin;
admin	t-default	admin	fdkhlepsssyz
\.


--
-- Data for Name: organization_roles; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.organization_roles (tenant_id, id, name, description, type) FROM stdin;
admin	admin	admin	Admin of the tenant, who has all permissions.	User
admin	collaborator	collaborator	Collaborator of the tenant, who has permissions to operate the tenant data, but not the tenant settings.	User
\.


--
-- Data for Name: organization_scopes; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.organization_scopes (tenant_id, id, name, description) FROM stdin;
admin	read-data	read:data	Read the tenant data.
admin	write-data	write:data	Write the tenant data, including creating and updating the tenant.
admin	delete-data	delete:data	Delete data of the tenant.
admin	read-member	read:member	Read members of the tenant.
admin	invite-member	invite:member	Invite members to the tenant.
admin	remove-member	remove:member	Remove members from the tenant.
admin	update-member-role	update:member:role	Update the role of a member in the tenant.
admin	manage-tenant	manage:tenant	Manage the tenant settings, including name, billing, etc.
\.


--
-- Data for Name: organization_user_relations; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.organization_user_relations (tenant_id, organization_id, user_id) FROM stdin;
admin	t-default	fdkhlepsssyz
\.


--
-- Data for Name: organizations; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.organizations (tenant_id, id, name, description, custom_data, is_mfa_required, color, branding, custom_css, created_at) FROM stdin;
admin	t-default	Tenant default	\N	{}	f	{}	{}	\N	2026-01-19 12:22:25.53527+00
admin	t-admin	Tenant admin	\N	{}	f	{}	{}	\N	2026-01-19 12:22:25.53527+00
\.


--
-- Data for Name: passcodes; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.passcodes (tenant_id, id, interaction_jti, phone, email, type, code, consumed, try_count, created_at) FROM stdin;
\.


--
-- Data for Name: personal_access_tokens; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.personal_access_tokens (tenant_id, user_id, name, value, created_at, expires_at) FROM stdin;
\.


--
-- Data for Name: resources; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.resources (tenant_id, id, name, indicator, is_default, access_token_ttl) FROM stdin;
default	management-api	Logto Management API	https://default.logto.app/api	f	3600
admin	o0rcbyfheznbkyvz63r1n	Logto Management API for tenant default	https://default.logto.app/api	f	3600
admin	4y8l149tgppwx9acutgm4	Logto Management API for tenant admin	https://admin.logto.app/api	f	3600
admin	f0tksl3juphnconfmg5fr	Logto Me API	https://admin.logto.app/me	f	3600
admin	a92pu0h3chmsv5s53lbhu	Logto Cloud API	https://cloud.logto.io/api	f	3600
\.


--
-- Data for Name: roles; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.roles (tenant_id, id, name, description, type, is_default) FROM stdin;
default	admin-role	#internal:admin	Internal admin role for Logto tenant default.	MachineToMachine	f
default	2ai5xfyv7mh80fapu90wq	Logto Management API access	This default role grants access to the Logto management API.	MachineToMachine	f
admin	m-default	machine:mapi:default	Machine-to-machine role for accessing Management API of tenant 'default'.	MachineToMachine	f
admin	m-admin	machine:mapi:admin	Machine-to-machine role for accessing Management API of tenant 'admin'.	MachineToMachine	f
admin	l03ly29m7pn67e6sl3mnl	user	Default role for admin tenant.	User	f
admin	8hmc4p87kenkvpo6yu38l	tenantApplication	The role for M2M applications that represent a user tenant and send requests to Logto Cloud.	MachineToMachine	f
admin	nabh1sanwew4lvh8hm1hp	default:admin	Legacy user role for accessing default Management API. Used in OSS only.	User	f
\.


--
-- Data for Name: roles_scopes; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.roles_scopes (tenant_id, id, role_id, scope_id) FROM stdin;
default	b8xnvtx3smpjanzsniza6	admin-role	management-api-all
default	rw8m46y2vj9p26pqgh608	2ai5xfyv7mh80fapu90wq	management-api-all
admin	i8h820dy1en2xqlwk3zb3	m-default	rclojs8dlgd0yklecxsa3
admin	tsaerb7ppl0gmyojb849b	m-admin	zmydj7g874a5ww5j77d0m
admin	ve95uzaqh6iw6pge4jyw2	l03ly29m7pn67e6sl3mnl	brked4l4jje0x3i7r0g8r
admin	g3mzl6h8vy5art5ht0vt0	l03ly29m7pn67e6sl3mnl	jgn0fnfc59fvvi02kpqwa
admin	zaj95idz9chn0v7rzdhm0	l03ly29m7pn67e6sl3mnl	9ceao8e4megnyeu50onkj
admin	r8ioenetprry4sot8lflw	8hmc4p87kenkvpo6yu38l	dujc23uowmqsqae8mwkwi
admin	cwiy0suwuwbmpdf9tdspa	8hmc4p87kenkvpo6yu38l	iqx22ck16fed248sejpeq
admin	afx9tcaxhebao1opzr7kw	8hmc4p87kenkvpo6yu38l	7jzlwv70jdgal9dsrbku2
admin	p7conwzwcchfxbslk1qbv	8hmc4p87kenkvpo6yu38l	khgom705wy994h4v54qt4
admin	5acjavzwbbt5t1m28izj2	nabh1sanwew4lvh8hm1hp	rclojs8dlgd0yklecxsa3
\.


--
-- Data for Name: saml_application_configs; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.saml_application_configs (application_id, tenant_id, attribute_mapping, entity_id, acs_url, encryption, name_id_format) FROM stdin;
\.


--
-- Data for Name: saml_application_secrets; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.saml_application_secrets (id, tenant_id, application_id, private_key, certificate, created_at, expires_at, active) FROM stdin;
\.


--
-- Data for Name: saml_application_sessions; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.saml_application_sessions (tenant_id, id, application_id, saml_request_id, oidc_state, relay_state, raw_auth_request, created_at, expires_at) FROM stdin;
\.


--
-- Data for Name: scopes; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.scopes (tenant_id, id, resource_id, name, description, created_at) FROM stdin;
default	management-api-all	management-api	all	Default scope for Management API, allows all permissions.	2026-01-19 12:22:25.53527+00
admin	rclojs8dlgd0yklecxsa3	o0rcbyfheznbkyvz63r1n	all	Default scope for Management API, allows all permissions.	2026-01-19 12:22:25.53527+00
admin	zmydj7g874a5ww5j77d0m	4y8l149tgppwx9acutgm4	all	Default scope for Management API, allows all permissions.	2026-01-19 12:22:25.53527+00
admin	brked4l4jje0x3i7r0g8r	f0tksl3juphnconfmg5fr	all	Default scope for Me API, allows all permissions.	2026-01-19 12:22:25.53527+00
admin	jgn0fnfc59fvvi02kpqwa	a92pu0h3chmsv5s53lbhu	create:tenant	Allow creating new tenants.	2026-01-19 12:22:25.53527+00
admin	9ceao8e4megnyeu50onkj	a92pu0h3chmsv5s53lbhu	manage:tenant:self	Allow managing tenant itself, including update and delete.	2026-01-19 12:22:25.53527+00
admin	dujc23uowmqsqae8mwkwi	a92pu0h3chmsv5s53lbhu	send:email	Allow sending emails. This scope is only available to M2M application.	2026-01-19 12:22:25.53527+00
admin	iqx22ck16fed248sejpeq	a92pu0h3chmsv5s53lbhu	send:sms	Allow sending SMS. This scope is only available to M2M application.	2026-01-19 12:22:25.53527+00
admin	7jzlwv70jdgal9dsrbku2	a92pu0h3chmsv5s53lbhu	fetch:custom:jwt	Allow accessing external resource to execute JWT payload customizer script and fetch the parsed token payload.	2026-01-19 12:22:25.53527+00
admin	khgom705wy994h4v54qt4	a92pu0h3chmsv5s53lbhu	report:subscription:updates	Allow reporting changes on Stripe subscription to Logto Cloud.	2026-01-19 12:22:25.53527+00
admin	r1isr882xfexorpzs4b98	a92pu0h3chmsv5s53lbhu	create:affiliate	Allow creating new affiliates and logs.	2026-01-19 12:22:25.53527+00
admin	cdc1vjpboghwc0n1raqbs	a92pu0h3chmsv5s53lbhu	manage:affiliate	Allow managing affiliates, including create, update, and delete.	2026-01-19 12:22:25.53527+00
\.


--
-- Data for Name: secret_enterprise_sso_connector_relations; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.secret_enterprise_sso_connector_relations (tenant_id, secret_id, sso_connector_id, issuer, identity_id) FROM stdin;
\.


--
-- Data for Name: secret_social_connector_relations; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.secret_social_connector_relations (tenant_id, secret_id, connector_id, target, identity_id) FROM stdin;
\.


--
-- Data for Name: secrets; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.secrets (tenant_id, id, user_id, type, encrypted_dek, iv, auth_tag, ciphertext, metadata, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: sentinel_activities; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.sentinel_activities (tenant_id, id, target_type, target_hash, action, action_result, payload, decision, decision_expires_at, created_at) FROM stdin;
default	o39ek5yhp8kdbtsiq8ahd	User	61ea51136a1eb39db39c889c9c53ebd21e5ce9e78721a6c2c40f8e16b782a879	Password	Success	{"event": "SignIn", "verificationId": "wmnrca7ptvrr8rlpoq3dl"}	Allowed	2026-01-19 13:15:00.376+00	2026-01-19 13:15:00.376265+00
\.


--
-- Data for Name: service_logs; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.service_logs (id, tenant_id, type, payload, created_at) FROM stdin;
\.


--
-- Data for Name: sign_in_experiences; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.sign_in_experiences (tenant_id, id, color, branding, hide_logto_branding, language_info, terms_of_use_url, privacy_policy_url, agree_to_terms_policy, sign_in, sign_up, social_sign_in, social_sign_in_connector_targets, sign_in_mode, custom_css, custom_content, custom_ui_assets, password_policy, mfa, single_sign_on_enabled, support_email, support_website_url, unknown_session_redirect_url, captcha_policy, sentinel_policy, email_blocklist_policy, forgot_password_methods) FROM stdin;
default	default	{"primaryColor": "#6139F6", "darkPrimaryColor": "#8768F8", "isDarkModeEnabled": false}	{"logoUrl": "https://logto.io/logo.svg", "darkLogoUrl": "https://logto.io/logo-dark.svg"}	f	{"autoDetect": true, "fallbackLanguage": "en"}	\N	\N	Automatic	{"methods": [{"password": [REDACTED] "identifier": "username", "verificationCode": false, "isPasswordPrimary": true}]}	{"verify": false, "password": [REDACTED] "identifiers": ["username"]}	{}	[]	SignInAndRegister	\N	{}	\N	{}	{"policy": "UserControlled", "factors": []}	f	\N	\N	\N	{}	{}	{}	[]
admin	default	{"primaryColor": "#6139F6", "darkPrimaryColor": "#8768F8", "isDarkModeEnabled": true}	{"logoUrl": "https://logto.io/logo.svg", "darkLogoUrl": "https://logto.io/logo-dark.svg"}	f	{"autoDetect": true, "fallbackLanguage": "en"}	\N	\N	Automatic	{"methods": [{"password": [REDACTED] "identifier": "username", "verificationCode": false, "isPasswordPrimary": true}]}	{"verify": false, "password": [REDACTED] "identifiers": ["username"]}	{}	[]	SignIn	\N	{}	\N	{}	{"policy": "UserControlled", "factors": []}	f	\N	\N	\N	{}	{}	{}	[]
\.


--
-- Data for Name: sso_connector_idp_initiated_auth_configs; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.sso_connector_idp_initiated_auth_configs (tenant_id, connector_id, default_application_id, redirect_uri, auth_parameters, auto_send_authorization_request, client_idp_initiated_auth_callback_uri, created_at) FROM stdin;
\.


--
-- Data for Name: sso_connectors; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.sso_connectors (tenant_id, id, provider_name, connector_name, config, domains, branding, sync_profile, enable_token_storage, created_at) FROM stdin;
\.


--
-- Data for Name: subject_tokens; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.subject_tokens (tenant_id, id, context, expires_at, consumed_at, user_id, created_at, creator_id) FROM stdin;
\.


--
-- Data for Name: systems; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.systems (key, value) FROM stdin;
alterationState	{"timestamp": 1766028646, "updatedAt": "2026-01-19T12:22:25.797Z"}
\.


--
-- Data for Name: tenants; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.tenants (id, db_user, db_user_password, name, tag, created_at, is_suspended) FROM stdin;
default	logto_tenant_logto_default	gea7sjgk6uzazn6gxin5cpil6o1ujntl	My Project	development	2026-01-19 12:22:25.53527+00	f
admin	logto_tenant_logto_admin	1sq7i33s2ejx02oxn9ead3l7iwidqwa1	My Project	development	2026-01-19 12:22:25.53527+00	f
\.


--
-- Data for Name: user_sso_identities; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.user_sso_identities (tenant_id, id, user_id, issuer, identity_id, detail, created_at, updated_at, sso_connector_id) FROM stdin;
\.


--
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.users (tenant_id, id, username, primary_email, primary_phone, password_encrypted, password_encryption_method, name, avatar, profile, application_id, identities, custom_data, logto_config, mfa_verifications, is_suspended, last_sign_in_at, created_at, updated_at) FROM stdin;
admin	fdkhlepsssyz	admin	\N	\N	$argon2i$v=19$m=8192,t=8,p=1$Db6lK8rARmYKXtM5IzDlEg$EvNV1ymU8a/kxqsYjlDHNGUTCEqismiZ8x0vvleGJJM	Argon2i	\N	\N	{}	admin-console	{}	{}	{}	[]	f	2026-01-19 12:36:33.008+00	2026-01-19 12:36:32.972305+00	2026-01-19 12:36:33.056653+00
default	oihz2vzdn8sp	demo2	demo2@hublot.cloud	\N	$argon2i$v=19$m=8192,t=8,p=1$TEB7PIaidPoAcD8PWiyPBw$hYY8IghDqKOTSTIcqExmJ5q+8taZUUjOg7hHT+n6feM	Argon2i	\N	\N	{"givenName": "Jane", "familyName": "Schmit", "middleName": ""}	\N	{}	{}	{}	[]	f	\N	2026-01-19 13:13:53.731816+00	2026-01-19 13:14:38.567537+00
default	4blpw0c6cxgn	demo1	demo1@hublot.cloud	\N	$argon2i$v=19$m=8192,t=8,p=1$93vEd35z9mD9Am2laer8Ng$o6wifdWOKziHsNVGCVSG8ji5TDIwcjdI6/TKALYfNus	Argon2i	\N	\N	{"givenName": "John", "familyName": "Doe", "middleName": ""}	qs2705sv966er3q0fase8	{}	{}	{}	[]	f	2026-01-19 13:15:00.432+00	2026-01-19 13:12:41.390272+00	2026-01-19 13:15:00.459459+00
\.


--
-- Data for Name: users_roles; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.users_roles (tenant_id, id, user_id, role_id) FROM stdin;
admin	2jsk1ll0mdkg2uxq7aurn	fdkhlepsssyz	l03ly29m7pn67e6sl3mnl
admin	a28d7d45x5gryyiaaua9o	fdkhlepsssyz	nabh1sanwew4lvh8hm1hp
\.


--
-- Data for Name: verification_records; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.verification_records (tenant_id, id, user_id, created_at, expires_at, data) FROM stdin;
\.


--
-- Data for Name: verification_statuses; Type: TABLE DATA; Schema: public; Owner: logto
--

COPY public.verification_statuses (tenant_id, id, user_id, created_at, verified_identifier) FROM stdin;
\.


--
-- Name: account_centers account_centers_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.account_centers
    ADD CONSTRAINT account_centers_pkey PRIMARY KEY (tenant_id, id);


--
-- Name: aggregated_daily_active_users aggregated_daily_active_users_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.aggregated_daily_active_users
    ADD CONSTRAINT aggregated_daily_active_users_pkey PRIMARY KEY (tenant_id, activity_date, user_id);


--
-- Name: application_secrets application_secrets_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_secrets
    ADD CONSTRAINT application_secrets_pkey PRIMARY KEY (tenant_id, application_id, name);


--
-- Name: application_sign_in_experiences application_sign_in_experiences_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_sign_in_experiences
    ADD CONSTRAINT application_sign_in_experiences_pkey PRIMARY KEY (tenant_id, application_id);


--
-- Name: application_user_consent_organization_resource_scopes application_user_consent_organization_resource_scopes_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_organization_resource_scopes
    ADD CONSTRAINT application_user_consent_organization_resource_scopes_pkey PRIMARY KEY (application_id, scope_id);


--
-- Name: application_user_consent_organization_scopes application_user_consent_organization_scopes_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_organization_scopes
    ADD CONSTRAINT application_user_consent_organization_scopes_pkey PRIMARY KEY (application_id, organization_scope_id);


--
-- Name: application_user_consent_organizations application_user_consent_organizations_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_organizations
    ADD CONSTRAINT application_user_consent_organizations_pkey PRIMARY KEY (tenant_id, application_id, organization_id, user_id);


--
-- Name: application_user_consent_resource_scopes application_user_consent_resource_scopes_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_resource_scopes
    ADD CONSTRAINT application_user_consent_resource_scopes_pkey PRIMARY KEY (application_id, scope_id);


--
-- Name: application_user_consent_user_scopes application_user_consent_user_scopes_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_user_scopes
    ADD CONSTRAINT application_user_consent_user_scopes_pkey PRIMARY KEY (application_id, user_scope);


--
-- Name: applications applications_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.applications
    ADD CONSTRAINT applications_pkey PRIMARY KEY (id);


--
-- Name: applications_roles applications_roles__application_id_role_id; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.applications_roles
    ADD CONSTRAINT applications_roles__application_id_role_id UNIQUE (tenant_id, application_id, role_id);


--
-- Name: applications_roles applications_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.applications_roles
    ADD CONSTRAINT applications_roles_pkey PRIMARY KEY (id);


--
-- Name: captcha_providers captcha_providers_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.captcha_providers
    ADD CONSTRAINT captcha_providers_pkey PRIMARY KEY (id);


--
-- Name: captcha_providers captcha_providers_tenant_id_key; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.captcha_providers
    ADD CONSTRAINT captcha_providers_tenant_id_key UNIQUE (tenant_id);


--
-- Name: connectors connectors_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.connectors
    ADD CONSTRAINT connectors_pkey PRIMARY KEY (id);


--
-- Name: custom_phrases custom_phrases__language_tag; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.custom_phrases
    ADD CONSTRAINT custom_phrases__language_tag UNIQUE (tenant_id, language_tag);


--
-- Name: custom_phrases custom_phrases_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.custom_phrases
    ADD CONSTRAINT custom_phrases_pkey PRIMARY KEY (id);


--
-- Name: custom_profile_fields custom_profile_fields__name; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.custom_profile_fields
    ADD CONSTRAINT custom_profile_fields__name UNIQUE (tenant_id, name);


--
-- Name: custom_profile_fields custom_profile_fields_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.custom_profile_fields
    ADD CONSTRAINT custom_profile_fields_pkey PRIMARY KEY (id);


--
-- Name: daily_active_users daily_active_users__user_id_date; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.daily_active_users
    ADD CONSTRAINT daily_active_users__user_id_date UNIQUE (user_id, date);


--
-- Name: daily_active_users daily_active_users_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.daily_active_users
    ADD CONSTRAINT daily_active_users_pkey PRIMARY KEY (id);


--
-- Name: daily_token_usage daily_token_usage_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.daily_token_usage
    ADD CONSTRAINT daily_token_usage_pkey PRIMARY KEY (id);


--
-- Name: domains domains__domain; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.domains
    ADD CONSTRAINT domains__domain UNIQUE (tenant_id, domain);


--
-- Name: domains domains_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.domains
    ADD CONSTRAINT domains_pkey PRIMARY KEY (id);


--
-- Name: email_templates email_templates__tenant_id__language_tag__template_type; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.email_templates
    ADD CONSTRAINT email_templates__tenant_id__language_tag__template_type UNIQUE (tenant_id, language_tag, template_type);


--
-- Name: email_templates email_templates_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.email_templates
    ADD CONSTRAINT email_templates_pkey PRIMARY KEY (tenant_id, id);


--
-- Name: hooks hooks_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.hooks
    ADD CONSTRAINT hooks_pkey PRIMARY KEY (id);


--
-- Name: idp_initiated_saml_sso_sessions idp_initiated_saml_sso_sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.idp_initiated_saml_sso_sessions
    ADD CONSTRAINT idp_initiated_saml_sso_sessions_pkey PRIMARY KEY (tenant_id, id);


--
-- Name: logs logs_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.logs
    ADD CONSTRAINT logs_pkey PRIMARY KEY (id);


--
-- Name: logto_configs logto_configs_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.logto_configs
    ADD CONSTRAINT logto_configs_pkey PRIMARY KEY (tenant_id, key);


--
-- Name: oidc_model_instances oidc_model_instances__model_name_id; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.oidc_model_instances
    ADD CONSTRAINT oidc_model_instances__model_name_id UNIQUE (tenant_id, model_name, id);


--
-- Name: oidc_model_instances oidc_model_instances_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.oidc_model_instances
    ADD CONSTRAINT oidc_model_instances_pkey PRIMARY KEY (id);


--
-- Name: oidc_session_extensions oidc_session_extensions_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.oidc_session_extensions
    ADD CONSTRAINT oidc_session_extensions_pkey PRIMARY KEY (tenant_id, session_uid);


--
-- Name: one_time_tokens one_time_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.one_time_tokens
    ADD CONSTRAINT one_time_tokens_pkey PRIMARY KEY (id);


--
-- Name: organization_application_relations organization_application_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_application_relations
    ADD CONSTRAINT organization_application_relations_pkey PRIMARY KEY (tenant_id, organization_id, application_id);


--
-- Name: organization_invitation_role_relations organization_invitation_role_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_invitation_role_relations
    ADD CONSTRAINT organization_invitation_role_relations_pkey PRIMARY KEY (tenant_id, organization_invitation_id, organization_role_id);


--
-- Name: organization_invitations organization_invitations_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_invitations
    ADD CONSTRAINT organization_invitations_pkey PRIMARY KEY (id);


--
-- Name: organization_jit_email_domains organization_jit_email_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_jit_email_domains
    ADD CONSTRAINT organization_jit_email_domains_pkey PRIMARY KEY (tenant_id, organization_id, email_domain);


--
-- Name: organization_jit_roles organization_jit_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_jit_roles
    ADD CONSTRAINT organization_jit_roles_pkey PRIMARY KEY (tenant_id, organization_id, organization_role_id);


--
-- Name: organization_jit_sso_connectors organization_jit_sso_connectors_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_jit_sso_connectors
    ADD CONSTRAINT organization_jit_sso_connectors_pkey PRIMARY KEY (tenant_id, organization_id, sso_connector_id);


--
-- Name: organization_role_application_relations organization_role_application_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_role_application_relations
    ADD CONSTRAINT organization_role_application_relations_pkey PRIMARY KEY (tenant_id, organization_id, organization_role_id, application_id);


--
-- Name: organization_role_resource_scope_relations organization_role_resource_scope_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_role_resource_scope_relations
    ADD CONSTRAINT organization_role_resource_scope_relations_pkey PRIMARY KEY (tenant_id, organization_role_id, scope_id);


--
-- Name: organization_role_scope_relations organization_role_scope_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_role_scope_relations
    ADD CONSTRAINT organization_role_scope_relations_pkey PRIMARY KEY (tenant_id, organization_role_id, organization_scope_id);


--
-- Name: organization_role_user_relations organization_role_user_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_role_user_relations
    ADD CONSTRAINT organization_role_user_relations_pkey PRIMARY KEY (tenant_id, organization_id, organization_role_id, user_id);


--
-- Name: organization_roles organization_roles__name; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_roles
    ADD CONSTRAINT organization_roles__name UNIQUE (tenant_id, name);


--
-- Name: organization_roles organization_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_roles
    ADD CONSTRAINT organization_roles_pkey PRIMARY KEY (id);


--
-- Name: organization_scopes organization_scopes__name; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_scopes
    ADD CONSTRAINT organization_scopes__name UNIQUE (tenant_id, name);


--
-- Name: organization_scopes organization_scopes_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_scopes
    ADD CONSTRAINT organization_scopes_pkey PRIMARY KEY (id);


--
-- Name: organization_user_relations organization_user_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_user_relations
    ADD CONSTRAINT organization_user_relations_pkey PRIMARY KEY (tenant_id, organization_id, user_id);


--
-- Name: organizations organizations_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organizations
    ADD CONSTRAINT organizations_pkey PRIMARY KEY (id);


--
-- Name: passcodes passcodes_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.passcodes
    ADD CONSTRAINT passcodes_pkey PRIMARY KEY (id);


--
-- Name: personal_access_tokens personal_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.personal_access_tokens
    ADD CONSTRAINT personal_access_tokens_pkey PRIMARY KEY (tenant_id, user_id, name);


--
-- Name: resources resources__indicator; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.resources
    ADD CONSTRAINT resources__indicator UNIQUE (tenant_id, indicator);


--
-- Name: resources resources_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.resources
    ADD CONSTRAINT resources_pkey PRIMARY KEY (id);


--
-- Name: roles roles__name; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.roles
    ADD CONSTRAINT roles__name UNIQUE (tenant_id, name);


--
-- Name: roles roles_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.roles
    ADD CONSTRAINT roles_pkey PRIMARY KEY (id);


--
-- Name: roles_scopes roles_scopes__role_id_scope_id; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.roles_scopes
    ADD CONSTRAINT roles_scopes__role_id_scope_id UNIQUE (tenant_id, role_id, scope_id);


--
-- Name: roles_scopes roles_scopes_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.roles_scopes
    ADD CONSTRAINT roles_scopes_pkey PRIMARY KEY (id);


--
-- Name: saml_application_configs saml_application_configs_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.saml_application_configs
    ADD CONSTRAINT saml_application_configs_pkey PRIMARY KEY (tenant_id, application_id);


--
-- Name: saml_application_secrets saml_application_secrets_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.saml_application_secrets
    ADD CONSTRAINT saml_application_secrets_pkey PRIMARY KEY (tenant_id, application_id, id);


--
-- Name: saml_application_sessions saml_application_sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.saml_application_sessions
    ADD CONSTRAINT saml_application_sessions_pkey PRIMARY KEY (tenant_id, id);


--
-- Name: scopes scopes__resource_id_name; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.scopes
    ADD CONSTRAINT scopes__resource_id_name UNIQUE (tenant_id, resource_id, name);


--
-- Name: scopes scopes_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.scopes
    ADD CONSTRAINT scopes_pkey PRIMARY KEY (id);


--
-- Name: secret_enterprise_sso_connector_relations secret_enterprise_sso_connector_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.secret_enterprise_sso_connector_relations
    ADD CONSTRAINT secret_enterprise_sso_connector_relations_pkey PRIMARY KEY (tenant_id, secret_id);


--
-- Name: secret_social_connector_relations secret_social_connector_relations__target__identity_id; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.secret_social_connector_relations
    ADD CONSTRAINT secret_social_connector_relations__target__identity_id UNIQUE (tenant_id, target, identity_id);


--
-- Name: secret_social_connector_relations secret_social_connector_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.secret_social_connector_relations
    ADD CONSTRAINT secret_social_connector_relations_pkey PRIMARY KEY (tenant_id, secret_id);


--
-- Name: secrets secrets_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.secrets
    ADD CONSTRAINT secrets_pkey PRIMARY KEY (id);


--
-- Name: sentinel_activities sentinel_activities_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.sentinel_activities
    ADD CONSTRAINT sentinel_activities_pkey PRIMARY KEY (id);


--
-- Name: service_logs service_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.service_logs
    ADD CONSTRAINT service_logs_pkey PRIMARY KEY (id);


--
-- Name: sign_in_experiences sign_in_experiences_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.sign_in_experiences
    ADD CONSTRAINT sign_in_experiences_pkey PRIMARY KEY (tenant_id, id);


--
-- Name: sso_connector_idp_initiated_auth_configs sso_connector_idp_initiated_auth_configs_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.sso_connector_idp_initiated_auth_configs
    ADD CONSTRAINT sso_connector_idp_initiated_auth_configs_pkey PRIMARY KEY (tenant_id, connector_id);


--
-- Name: sso_connectors sso_connectors__connector_name__unique; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.sso_connectors
    ADD CONSTRAINT sso_connectors__connector_name__unique UNIQUE (tenant_id, connector_name);


--
-- Name: sso_connectors sso_connectors_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.sso_connectors
    ADD CONSTRAINT sso_connectors_pkey PRIMARY KEY (id);


--
-- Name: subject_tokens subject_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.subject_tokens
    ADD CONSTRAINT subject_tokens_pkey PRIMARY KEY (id);


--
-- Name: systems systems_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.systems
    ADD CONSTRAINT systems_pkey PRIMARY KEY (key);


--
-- Name: tenants tenants__db_user; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.tenants
    ADD CONSTRAINT tenants__db_user UNIQUE (db_user);


--
-- Name: tenants tenants_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.tenants
    ADD CONSTRAINT tenants_pkey PRIMARY KEY (id);


--
-- Name: user_sso_identities user_sso_identities__issuer__identity_id; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.user_sso_identities
    ADD CONSTRAINT user_sso_identities__issuer__identity_id UNIQUE (tenant_id, issuer, identity_id);


--
-- Name: user_sso_identities user_sso_identities_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.user_sso_identities
    ADD CONSTRAINT user_sso_identities_pkey PRIMARY KEY (id);


--
-- Name: users users__primary_email; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.users
    ADD CONSTRAINT users__primary_email UNIQUE (tenant_id, primary_email);


--
-- Name: users users__primary_phone; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.users
    ADD CONSTRAINT users__primary_phone UNIQUE (tenant_id, primary_phone);


--
-- Name: users users__username; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.users
    ADD CONSTRAINT users__username UNIQUE (tenant_id, username);


--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.users
    ADD CONSTRAINT users_pkey PRIMARY KEY (id);


--
-- Name: users_roles users_roles__user_id_role_id; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.users_roles
    ADD CONSTRAINT users_roles__user_id_role_id UNIQUE (tenant_id, user_id, role_id);


--
-- Name: users_roles users_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.users_roles
    ADD CONSTRAINT users_roles_pkey PRIMARY KEY (id);


--
-- Name: verification_records verification_records_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.verification_records
    ADD CONSTRAINT verification_records_pkey PRIMARY KEY (id);


--
-- Name: verification_statuses verification_statuses_pkey; Type: CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.verification_statuses
    ADD CONSTRAINT verification_statuses_pkey PRIMARY KEY (id);


--
-- Name: aggregated_daily_active_users__tenant_date; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX aggregated_daily_active_users__tenant_date ON public.aggregated_daily_active_users USING btree (tenant_id, activity_date);


--
-- Name: aggregated_daily_active_users__tenant_user_date; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX aggregated_daily_active_users__tenant_user_date ON public.aggregated_daily_active_users USING btree (tenant_id, user_id, activity_date DESC);


--
-- Name: applications__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX applications__id ON public.applications USING btree (tenant_id, id);


--
-- Name: applications__is_third_party; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX applications__is_third_party ON public.applications USING btree (tenant_id, is_third_party);


--
-- Name: applications__protected_app_metadata_custom_domain; Type: INDEX; Schema: public; Owner: logto
--

CREATE UNIQUE INDEX applications__protected_app_metadata_custom_domain ON public.applications USING btree (((((protected_app_metadata -> 'customDomains'::text) -> 0) ->> 'domain'::text)));


--
-- Name: applications__protected_app_metadata_host; Type: INDEX; Schema: public; Owner: logto
--

CREATE UNIQUE INDEX applications__protected_app_metadata_host ON public.applications USING btree (((protected_app_metadata ->> 'host'::text)));


--
-- Name: applications__type; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX applications__type ON public.applications USING btree (tenant_id, type);


--
-- Name: applications_roles__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX applications_roles__id ON public.applications_roles USING btree (tenant_id, id);


--
-- Name: captcha_providers__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX captcha_providers__id ON public.captcha_providers USING btree (tenant_id, id);


--
-- Name: connectors__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX connectors__id ON public.connectors USING btree (tenant_id, id);


--
-- Name: custom_phrases__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX custom_phrases__id ON public.custom_phrases USING btree (tenant_id, id);


--
-- Name: daily_active_users__date; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX daily_active_users__date ON public.daily_active_users USING btree (tenant_id, date);


--
-- Name: daily_active_users__date_brin; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX daily_active_users__date_brin ON public.daily_active_users USING brin (date);


--
-- Name: daily_active_users__tenant_date_user; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX daily_active_users__tenant_date_user ON public.daily_active_users USING btree (tenant_id, date, user_id);


--
-- Name: daily_token_usage__date; Type: INDEX; Schema: public; Owner: logto
--

CREATE UNIQUE INDEX daily_token_usage__date ON public.daily_token_usage USING btree (tenant_id, date);


--
-- Name: domains__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX domains__id ON public.domains USING btree (tenant_id, id);


--
-- Name: email_templates__tenant_id__language_tag; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX email_templates__tenant_id__language_tag ON public.email_templates USING btree (tenant_id, language_tag);


--
-- Name: email_templates__tenant_id__template_type; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX email_templates__tenant_id__template_type ON public.email_templates USING btree (tenant_id, template_type);


--
-- Name: hooks__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX hooks__id ON public.hooks USING btree (tenant_id, id);


--
-- Name: logs__application_id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX logs__application_id ON public.logs USING btree (tenant_id, ((payload ->> 'applicationId'::text)));


--
-- Name: logs__created_at_id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX logs__created_at_id ON public.logs USING btree (tenant_id, created_at, id);


--
-- Name: logs__hook_id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX logs__hook_id ON public.logs USING btree (tenant_id, ((payload ->> 'hookId'::text)));


--
-- Name: logs__key; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX logs__key ON public.logs USING btree (tenant_id, key);


--
-- Name: logs__user_id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX logs__user_id ON public.logs USING btree (tenant_id, ((payload ->> 'userId'::text)));


--
-- Name: oidc_model_instances__model_name_payload_grant_id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX oidc_model_instances__model_name_payload_grant_id ON public.oidc_model_instances USING btree (tenant_id, model_name, ((payload ->> 'grantId'::text)));


--
-- Name: oidc_model_instances__model_name_payload_uid; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX oidc_model_instances__model_name_payload_uid ON public.oidc_model_instances USING btree (tenant_id, model_name, ((payload ->> 'uid'::text)));


--
-- Name: oidc_model_instances__model_name_payload_user_code; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX oidc_model_instances__model_name_payload_user_code ON public.oidc_model_instances USING btree (tenant_id, model_name, ((payload ->> 'userCode'::text)));


--
-- Name: one_time_token__email_status; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX one_time_token__email_status ON public.one_time_tokens USING btree (tenant_id, email, status);


--
-- Name: one_time_token__token; Type: INDEX; Schema: public; Owner: logto
--

CREATE UNIQUE INDEX one_time_token__token ON public.one_time_tokens USING btree (tenant_id, token);


--
-- Name: organization_invitations__invitee_organization_id; Type: INDEX; Schema: public; Owner: logto
--

CREATE UNIQUE INDEX organization_invitations__invitee_organization_id ON public.organization_invitations USING btree (tenant_id, invitee, organization_id) WHERE (status = 'Pending'::public.organization_invitation_status);


--
-- Name: organization_roles__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX organization_roles__id ON public.organization_roles USING btree (tenant_id, id);


--
-- Name: organization_roles__type; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX organization_roles__type ON public.organization_roles USING btree (tenant_id, type);


--
-- Name: organization_scopes__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX organization_scopes__id ON public.organization_scopes USING btree (tenant_id, id);


--
-- Name: organizations__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX organizations__id ON public.organizations USING btree (tenant_id, id);


--
-- Name: passcodes__email_type; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX passcodes__email_type ON public.passcodes USING btree (tenant_id, email, type);


--
-- Name: passcodes__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX passcodes__id ON public.passcodes USING btree (tenant_id, id);


--
-- Name: passcodes__interaction_jti_type; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX passcodes__interaction_jti_type ON public.passcodes USING btree (tenant_id, interaction_jti, type);


--
-- Name: passcodes__phone_type; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX passcodes__phone_type ON public.passcodes USING btree (tenant_id, phone, type);


--
-- Name: personal_access_token__value; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX personal_access_token__value ON public.personal_access_tokens USING btree (tenant_id, value);


--
-- Name: resources__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX resources__id ON public.resources USING btree (tenant_id, id);


--
-- Name: resources__is_default_true; Type: INDEX; Schema: public; Owner: logto
--

CREATE UNIQUE INDEX resources__is_default_true ON public.resources USING btree (tenant_id) WHERE (is_default = true);


--
-- Name: roles__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX roles__id ON public.roles USING btree (tenant_id, id);


--
-- Name: roles__type; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX roles__type ON public.roles USING btree (tenant_id, type);


--
-- Name: roles_scopes__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX roles_scopes__id ON public.roles_scopes USING btree (tenant_id, id);


--
-- Name: saml_application_secrets__unique_active_secret; Type: INDEX; Schema: public; Owner: logto
--

CREATE UNIQUE INDEX saml_application_secrets__unique_active_secret ON public.saml_application_secrets USING btree (tenant_id, application_id, active) WHERE active;


--
-- Name: scopes__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX scopes__id ON public.scopes USING btree (tenant_id, id);


--
-- Name: sentinel_activities__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX sentinel_activities__id ON public.sentinel_activities USING btree (tenant_id, id);


--
-- Name: sentinel_activities__target_type_target_hash; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX sentinel_activities__target_type_target_hash ON public.sentinel_activities USING btree (tenant_id, target_type, target_hash);


--
-- Name: sentinel_activities__target_type_target_hash_action_action_resu; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX sentinel_activities__target_type_target_hash_action_action_resu ON public.sentinel_activities USING btree (tenant_id, target_type, target_hash, action, action_result, decision);


--
-- Name: service_logs__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX service_logs__id ON public.service_logs USING btree (id);


--
-- Name: service_logs__tenant_id__type; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX service_logs__tenant_id__type ON public.service_logs USING btree (tenant_id, type);


--
-- Name: sso_connectors__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX sso_connectors__id ON public.sso_connectors USING btree (tenant_id, id);


--
-- Name: sso_connectors__id__provider_name; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX sso_connectors__id__provider_name ON public.sso_connectors USING btree (tenant_id, id, provider_name);


--
-- Name: subject_token__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX subject_token__id ON public.subject_tokens USING btree (tenant_id, id);


--
-- Name: users__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE UNIQUE INDEX users__id ON public.users USING btree (tenant_id, id);


--
-- Name: users__name; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX users__name ON public.users USING btree (tenant_id, name);


--
-- Name: users_roles__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX users_roles__id ON public.users_roles USING btree (tenant_id, id);


--
-- Name: verification_records__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX verification_records__id ON public.verification_records USING btree (tenant_id, id);


--
-- Name: verification_statuses__id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX verification_statuses__id ON public.verification_statuses USING btree (tenant_id, id);


--
-- Name: verification_statuses__user_id; Type: INDEX; Schema: public; Owner: logto
--

CREATE INDEX verification_statuses__user_id ON public.verification_statuses USING btree (tenant_id, user_id);


--
-- Name: custom_profile_fields custom_profile_fields__increment_sie_order; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER custom_profile_fields__increment_sie_order BEFORE INSERT ON public.custom_profile_fields FOR EACH ROW EXECUTE FUNCTION public.custom_profile_fields__increment_sie_order();


--
-- Name: user_sso_identities delete_secret_before_sso_identity_delete; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER delete_secret_before_sso_identity_delete BEFORE DELETE ON public.user_sso_identities FOR EACH ROW EXECUTE FUNCTION public.delete_secret_on_sso_identity_delete();


--
-- Name: connectors delete_secrets_before_social_connector_delete; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER delete_secrets_before_social_connector_delete BEFORE DELETE ON public.connectors FOR EACH ROW EXECUTE FUNCTION public.delete_secrets_on_social_connector_delete();


--
-- Name: users delete_secrets_before_social_identity_delete; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER delete_secrets_before_social_identity_delete BEFORE UPDATE OF identities ON public.users FOR EACH ROW EXECUTE FUNCTION public.delete_secrets_on_social_identity_delete();


--
-- Name: sso_connectors delete_secrets_before_sso_connector_delete; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER delete_secrets_before_sso_connector_delete BEFORE DELETE ON public.sso_connectors FOR EACH ROW EXECUTE FUNCTION public.delete_secrets_on_sso_connector_delete();


--
-- Name: account_centers set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.account_centers FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: aggregated_daily_active_users set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.aggregated_daily_active_users FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: application_secrets set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.application_secrets FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: application_sign_in_experiences set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.application_sign_in_experiences FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: application_user_consent_organization_resource_scopes set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.application_user_consent_organization_resource_scopes FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: application_user_consent_organization_scopes set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.application_user_consent_organization_scopes FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: application_user_consent_organizations set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.application_user_consent_organizations FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: application_user_consent_resource_scopes set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.application_user_consent_resource_scopes FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: application_user_consent_user_scopes set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.application_user_consent_user_scopes FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: applications set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.applications FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: applications_roles set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.applications_roles FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: captcha_providers set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.captcha_providers FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: connectors set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.connectors FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: custom_phrases set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.custom_phrases FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: custom_profile_fields set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.custom_profile_fields FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: daily_active_users set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.daily_active_users FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: daily_token_usage set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.daily_token_usage FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: domains set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.domains FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: email_templates set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.email_templates FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: hooks set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.hooks FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: idp_initiated_saml_sso_sessions set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.idp_initiated_saml_sso_sessions FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: logs set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.logs FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: logto_configs set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.logto_configs FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: oidc_model_instances set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.oidc_model_instances FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: oidc_session_extensions set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.oidc_session_extensions FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: one_time_tokens set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.one_time_tokens FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: organization_application_relations set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.organization_application_relations FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: organization_invitation_role_relations set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.organization_invitation_role_relations FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: organization_invitations set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.organization_invitations FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: organization_jit_email_domains set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.organization_jit_email_domains FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: organization_jit_roles set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.organization_jit_roles FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: organization_jit_sso_connectors set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.organization_jit_sso_connectors FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: organization_role_application_relations set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.organization_role_application_relations FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: organization_role_resource_scope_relations set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.organization_role_resource_scope_relations FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: organization_role_scope_relations set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.organization_role_scope_relations FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: organization_role_user_relations set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.organization_role_user_relations FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: organization_roles set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.organization_roles FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: organization_scopes set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.organization_scopes FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: organization_user_relations set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.organization_user_relations FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: organizations set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.organizations FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: passcodes set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.passcodes FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: personal_access_tokens set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.personal_access_tokens FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: resources set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.resources FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: roles set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.roles FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: roles_scopes set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.roles_scopes FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: saml_application_configs set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.saml_application_configs FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: saml_application_secrets set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.saml_application_secrets FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: saml_application_sessions set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.saml_application_sessions FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: scopes set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.scopes FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: secret_enterprise_sso_connector_relations set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.secret_enterprise_sso_connector_relations FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: secret_social_connector_relations set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.secret_social_connector_relations FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: secrets set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.secrets FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: sentinel_activities set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.sentinel_activities FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: sign_in_experiences set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.sign_in_experiences FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: sso_connector_idp_initiated_auth_configs set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.sso_connector_idp_initiated_auth_configs FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: sso_connectors set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.sso_connectors FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: subject_tokens set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.subject_tokens FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: user_sso_identities set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.user_sso_identities FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: users set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.users FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: users_roles set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.users_roles FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: verification_records set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.verification_records FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: verification_statuses set_tenant_id; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_tenant_id BEFORE INSERT ON public.verification_statuses FOR EACH ROW EXECUTE FUNCTION public.set_tenant_id();


--
-- Name: oidc_session_extensions set_updated_at; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_updated_at BEFORE UPDATE ON public.oidc_session_extensions FOR EACH ROW EXECUTE FUNCTION public.set_updated_at();


--
-- Name: secrets set_updated_at; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_updated_at BEFORE UPDATE ON public.secrets FOR EACH ROW EXECUTE FUNCTION public.set_updated_at();


--
-- Name: user_sso_identities set_updated_at; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_updated_at BEFORE UPDATE ON public.user_sso_identities FOR EACH ROW EXECUTE FUNCTION public.set_updated_at();


--
-- Name: users set_updated_at; Type: TRIGGER; Schema: public; Owner: logto
--

CREATE TRIGGER set_updated_at BEFORE UPDATE ON public.users FOR EACH ROW EXECUTE FUNCTION public.set_updated_at();


--
-- Name: account_centers account_centers_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.account_centers
    ADD CONSTRAINT account_centers_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_secrets application_secrets_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_secrets
    ADD CONSTRAINT application_secrets_application_id_fkey FOREIGN KEY (application_id) REFERENCES public.applications(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_secrets application_secrets_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_secrets
    ADD CONSTRAINT application_secrets_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_sign_in_experiences application_sign_in_experiences_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_sign_in_experiences
    ADD CONSTRAINT application_sign_in_experiences_application_id_fkey FOREIGN KEY (application_id) REFERENCES public.applications(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_sign_in_experiences application_sign_in_experiences_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_sign_in_experiences
    ADD CONSTRAINT application_sign_in_experiences_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_user_consent_organizations application_user_consent_orga_tenant_id_organization_id_us_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_organizations
    ADD CONSTRAINT application_user_consent_orga_tenant_id_organization_id_us_fkey FOREIGN KEY (tenant_id, organization_id, user_id) REFERENCES public.organization_user_relations(tenant_id, organization_id, user_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_user_consent_organization_scopes application_user_consent_organizatio_organization_scope_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_organization_scopes
    ADD CONSTRAINT application_user_consent_organizatio_organization_scope_id_fkey FOREIGN KEY (organization_scope_id) REFERENCES public.organization_scopes(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_user_consent_organization_resource_scopes application_user_consent_organization_resou_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_organization_resource_scopes
    ADD CONSTRAINT application_user_consent_organization_resou_application_id_fkey FOREIGN KEY (application_id) REFERENCES public.applications(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_user_consent_organization_resource_scopes application_user_consent_organization_resource_s_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_organization_resource_scopes
    ADD CONSTRAINT application_user_consent_organization_resource_s_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_user_consent_organization_resource_scopes application_user_consent_organization_resource_sc_scope_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_organization_resource_scopes
    ADD CONSTRAINT application_user_consent_organization_resource_sc_scope_id_fkey FOREIGN KEY (scope_id) REFERENCES public.scopes(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_user_consent_organization_scopes application_user_consent_organization_scope_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_organization_scopes
    ADD CONSTRAINT application_user_consent_organization_scope_application_id_fkey FOREIGN KEY (application_id) REFERENCES public.applications(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_user_consent_organization_scopes application_user_consent_organization_scopes_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_organization_scopes
    ADD CONSTRAINT application_user_consent_organization_scopes_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_user_consent_organizations application_user_consent_organizations_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_organizations
    ADD CONSTRAINT application_user_consent_organizations_application_id_fkey FOREIGN KEY (application_id) REFERENCES public.applications(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_user_consent_organizations application_user_consent_organizations_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_organizations
    ADD CONSTRAINT application_user_consent_organizations_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_user_consent_resource_scopes application_user_consent_resource_scopes_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_resource_scopes
    ADD CONSTRAINT application_user_consent_resource_scopes_application_id_fkey FOREIGN KEY (application_id) REFERENCES public.applications(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_user_consent_resource_scopes application_user_consent_resource_scopes_scope_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_resource_scopes
    ADD CONSTRAINT application_user_consent_resource_scopes_scope_id_fkey FOREIGN KEY (scope_id) REFERENCES public.scopes(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_user_consent_resource_scopes application_user_consent_resource_scopes_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_resource_scopes
    ADD CONSTRAINT application_user_consent_resource_scopes_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_user_consent_user_scopes application_user_consent_user_scopes_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_user_scopes
    ADD CONSTRAINT application_user_consent_user_scopes_application_id_fkey FOREIGN KEY (application_id) REFERENCES public.applications(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: application_user_consent_user_scopes application_user_consent_user_scopes_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.application_user_consent_user_scopes
    ADD CONSTRAINT application_user_consent_user_scopes_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: applications_roles applications_roles_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.applications_roles
    ADD CONSTRAINT applications_roles_application_id_fkey FOREIGN KEY (application_id) REFERENCES public.applications(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: applications_roles applications_roles_role_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.applications_roles
    ADD CONSTRAINT applications_roles_role_id_fkey FOREIGN KEY (role_id) REFERENCES public.roles(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: applications_roles applications_roles_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.applications_roles
    ADD CONSTRAINT applications_roles_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: applications applications_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.applications
    ADD CONSTRAINT applications_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: captcha_providers captcha_providers_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.captcha_providers
    ADD CONSTRAINT captcha_providers_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: connectors connectors_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.connectors
    ADD CONSTRAINT connectors_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: custom_phrases custom_phrases_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.custom_phrases
    ADD CONSTRAINT custom_phrases_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: custom_profile_fields custom_profile_fields_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.custom_profile_fields
    ADD CONSTRAINT custom_profile_fields_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: domains domains_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.domains
    ADD CONSTRAINT domains_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: email_templates email_templates_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.email_templates
    ADD CONSTRAINT email_templates_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: hooks hooks_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.hooks
    ADD CONSTRAINT hooks_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: idp_initiated_saml_sso_sessions idp_initiated_saml_sso_sessions_connector_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.idp_initiated_saml_sso_sessions
    ADD CONSTRAINT idp_initiated_saml_sso_sessions_connector_id_fkey FOREIGN KEY (connector_id) REFERENCES public.sso_connectors(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: idp_initiated_saml_sso_sessions idp_initiated_saml_sso_sessions_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.idp_initiated_saml_sso_sessions
    ADD CONSTRAINT idp_initiated_saml_sso_sessions_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: logs logs_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.logs
    ADD CONSTRAINT logs_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: logto_configs logto_configs_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.logto_configs
    ADD CONSTRAINT logto_configs_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: oidc_model_instances oidc_model_instances_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.oidc_model_instances
    ADD CONSTRAINT oidc_model_instances_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: oidc_session_extensions oidc_session_extensions_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.oidc_session_extensions
    ADD CONSTRAINT oidc_session_extensions_account_id_fkey FOREIGN KEY (account_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: oidc_session_extensions oidc_session_extensions_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.oidc_session_extensions
    ADD CONSTRAINT oidc_session_extensions_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: one_time_tokens one_time_tokens_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.one_time_tokens
    ADD CONSTRAINT one_time_tokens_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_application_relations organization_application_relations_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_application_relations
    ADD CONSTRAINT organization_application_relations_application_id_fkey FOREIGN KEY (application_id) REFERENCES public.applications(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_application_relations organization_application_relations_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_application_relations
    ADD CONSTRAINT organization_application_relations_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_application_relations organization_application_relations_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_application_relations
    ADD CONSTRAINT organization_application_relations_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_invitation_role_relations organization_invitation_role_re_organization_invitation_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_invitation_role_relations
    ADD CONSTRAINT organization_invitation_role_re_organization_invitation_id_fkey FOREIGN KEY (organization_invitation_id) REFERENCES public.organization_invitations(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_invitation_role_relations organization_invitation_role_relation_organization_role_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_invitation_role_relations
    ADD CONSTRAINT organization_invitation_role_relation_organization_role_id_fkey FOREIGN KEY (organization_role_id) REFERENCES public.organization_roles(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_invitation_role_relations organization_invitation_role_relations_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_invitation_role_relations
    ADD CONSTRAINT organization_invitation_role_relations_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_invitations organization_invitations_accepted_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_invitations
    ADD CONSTRAINT organization_invitations_accepted_user_id_fkey FOREIGN KEY (accepted_user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_invitations organization_invitations_inviter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_invitations
    ADD CONSTRAINT organization_invitations_inviter_id_fkey FOREIGN KEY (inviter_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_invitations organization_invitations_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_invitations
    ADD CONSTRAINT organization_invitations_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_invitations organization_invitations_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_invitations
    ADD CONSTRAINT organization_invitations_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_jit_email_domains organization_jit_email_domains_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_jit_email_domains
    ADD CONSTRAINT organization_jit_email_domains_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_jit_email_domains organization_jit_email_domains_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_jit_email_domains
    ADD CONSTRAINT organization_jit_email_domains_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_jit_roles organization_jit_roles_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_jit_roles
    ADD CONSTRAINT organization_jit_roles_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_jit_roles organization_jit_roles_organization_role_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_jit_roles
    ADD CONSTRAINT organization_jit_roles_organization_role_id_fkey FOREIGN KEY (organization_role_id) REFERENCES public.organization_roles(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_jit_roles organization_jit_roles_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_jit_roles
    ADD CONSTRAINT organization_jit_roles_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_jit_sso_connectors organization_jit_sso_connectors_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_jit_sso_connectors
    ADD CONSTRAINT organization_jit_sso_connectors_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_jit_sso_connectors organization_jit_sso_connectors_sso_connector_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_jit_sso_connectors
    ADD CONSTRAINT organization_jit_sso_connectors_sso_connector_id_fkey FOREIGN KEY (sso_connector_id) REFERENCES public.sso_connectors(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_jit_sso_connectors organization_jit_sso_connectors_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_jit_sso_connectors
    ADD CONSTRAINT organization_jit_sso_connectors_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_role_application_relations organization_role_application_relatio_organization_role_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_role_application_relations
    ADD CONSTRAINT organization_role_application_relatio_organization_role_id_fkey FOREIGN KEY (organization_role_id) REFERENCES public.organization_roles(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_role_application_relations organization_role_application_relations_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_role_application_relations
    ADD CONSTRAINT organization_role_application_relations_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_role_application_relations organization_role_application_tenant_id_organization_id_ap_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_role_application_relations
    ADD CONSTRAINT organization_role_application_tenant_id_organization_id_ap_fkey FOREIGN KEY (tenant_id, organization_id, application_id) REFERENCES public.organization_application_relations(tenant_id, organization_id, application_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_role_resource_scope_relations organization_role_resource_scope_rela_organization_role_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_role_resource_scope_relations
    ADD CONSTRAINT organization_role_resource_scope_rela_organization_role_id_fkey FOREIGN KEY (organization_role_id) REFERENCES public.organization_roles(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_role_resource_scope_relations organization_role_resource_scope_relations_scope_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_role_resource_scope_relations
    ADD CONSTRAINT organization_role_resource_scope_relations_scope_id_fkey FOREIGN KEY (scope_id) REFERENCES public.scopes(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_role_resource_scope_relations organization_role_resource_scope_relations_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_role_resource_scope_relations
    ADD CONSTRAINT organization_role_resource_scope_relations_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_role_scope_relations organization_role_scope_relations_organization_role_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_role_scope_relations
    ADD CONSTRAINT organization_role_scope_relations_organization_role_id_fkey FOREIGN KEY (organization_role_id) REFERENCES public.organization_roles(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_role_scope_relations organization_role_scope_relations_organization_scope_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_role_scope_relations
    ADD CONSTRAINT organization_role_scope_relations_organization_scope_id_fkey FOREIGN KEY (organization_scope_id) REFERENCES public.organization_scopes(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_role_scope_relations organization_role_scope_relations_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_role_scope_relations
    ADD CONSTRAINT organization_role_scope_relations_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_role_user_relations organization_role_user_relati_tenant_id_organization_id_us_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_role_user_relations
    ADD CONSTRAINT organization_role_user_relati_tenant_id_organization_id_us_fkey FOREIGN KEY (tenant_id, organization_id, user_id) REFERENCES public.organization_user_relations(tenant_id, organization_id, user_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_role_user_relations organization_role_user_relations_organization_role_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_role_user_relations
    ADD CONSTRAINT organization_role_user_relations_organization_role_id_fkey FOREIGN KEY (organization_role_id) REFERENCES public.organization_roles(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_role_user_relations organization_role_user_relations_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_role_user_relations
    ADD CONSTRAINT organization_role_user_relations_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_roles organization_roles_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_roles
    ADD CONSTRAINT organization_roles_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_scopes organization_scopes_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_scopes
    ADD CONSTRAINT organization_scopes_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_user_relations organization_user_relations__user_id__fk; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_user_relations
    ADD CONSTRAINT organization_user_relations__user_id__fk FOREIGN KEY (tenant_id, user_id) REFERENCES public.users(tenant_id, id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_user_relations organization_user_relations_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_user_relations
    ADD CONSTRAINT organization_user_relations_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_user_relations organization_user_relations_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_user_relations
    ADD CONSTRAINT organization_user_relations_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organization_user_relations organization_user_relations_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organization_user_relations
    ADD CONSTRAINT organization_user_relations_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: organizations organizations_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.organizations
    ADD CONSTRAINT organizations_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: passcodes passcodes_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.passcodes
    ADD CONSTRAINT passcodes_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: personal_access_tokens personal_access_tokens_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.personal_access_tokens
    ADD CONSTRAINT personal_access_tokens_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: personal_access_tokens personal_access_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.personal_access_tokens
    ADD CONSTRAINT personal_access_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: resources resources_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.resources
    ADD CONSTRAINT resources_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: roles_scopes roles_scopes_role_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.roles_scopes
    ADD CONSTRAINT roles_scopes_role_id_fkey FOREIGN KEY (role_id) REFERENCES public.roles(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: roles_scopes roles_scopes_scope_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.roles_scopes
    ADD CONSTRAINT roles_scopes_scope_id_fkey FOREIGN KEY (scope_id) REFERENCES public.scopes(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: roles_scopes roles_scopes_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.roles_scopes
    ADD CONSTRAINT roles_scopes_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: roles roles_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.roles
    ADD CONSTRAINT roles_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: saml_application_configs saml_application_configs_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.saml_application_configs
    ADD CONSTRAINT saml_application_configs_application_id_fkey FOREIGN KEY (application_id) REFERENCES public.applications(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: saml_application_configs saml_application_configs_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.saml_application_configs
    ADD CONSTRAINT saml_application_configs_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: saml_application_secrets saml_application_secrets_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.saml_application_secrets
    ADD CONSTRAINT saml_application_secrets_application_id_fkey FOREIGN KEY (application_id) REFERENCES public.applications(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: saml_application_secrets saml_application_secrets_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.saml_application_secrets
    ADD CONSTRAINT saml_application_secrets_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: saml_application_sessions saml_application_sessions_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.saml_application_sessions
    ADD CONSTRAINT saml_application_sessions_application_id_fkey FOREIGN KEY (application_id) REFERENCES public.applications(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: saml_application_sessions saml_application_sessions_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.saml_application_sessions
    ADD CONSTRAINT saml_application_sessions_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: scopes scopes_resource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.scopes
    ADD CONSTRAINT scopes_resource_id_fkey FOREIGN KEY (resource_id) REFERENCES public.resources(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: scopes scopes_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.scopes
    ADD CONSTRAINT scopes_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: secret_enterprise_sso_connector_relations secret_enterprise_sso_connect_tenant_id_issuer_identity_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.secret_enterprise_sso_connector_relations
    ADD CONSTRAINT secret_enterprise_sso_connect_tenant_id_issuer_identity_id_fkey FOREIGN KEY (tenant_id, issuer, identity_id) REFERENCES public.user_sso_identities(tenant_id, issuer, identity_id) ON UPDATE CASCADE;


--
-- Name: secret_enterprise_sso_connector_relations secret_enterprise_sso_connector_relations_secret_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.secret_enterprise_sso_connector_relations
    ADD CONSTRAINT secret_enterprise_sso_connector_relations_secret_id_fkey FOREIGN KEY (secret_id) REFERENCES public.secrets(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: secret_enterprise_sso_connector_relations secret_enterprise_sso_connector_relations_sso_connector_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.secret_enterprise_sso_connector_relations
    ADD CONSTRAINT secret_enterprise_sso_connector_relations_sso_connector_id_fkey FOREIGN KEY (sso_connector_id) REFERENCES public.sso_connectors(id) ON UPDATE CASCADE;


--
-- Name: secret_enterprise_sso_connector_relations secret_enterprise_sso_connector_relations_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.secret_enterprise_sso_connector_relations
    ADD CONSTRAINT secret_enterprise_sso_connector_relations_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: secret_social_connector_relations secret_social_connector_relations_connector_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.secret_social_connector_relations
    ADD CONSTRAINT secret_social_connector_relations_connector_id_fkey FOREIGN KEY (connector_id) REFERENCES public.connectors(id) ON UPDATE CASCADE;


--
-- Name: secret_social_connector_relations secret_social_connector_relations_secret_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.secret_social_connector_relations
    ADD CONSTRAINT secret_social_connector_relations_secret_id_fkey FOREIGN KEY (secret_id) REFERENCES public.secrets(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: secret_social_connector_relations secret_social_connector_relations_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.secret_social_connector_relations
    ADD CONSTRAINT secret_social_connector_relations_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: secrets secrets_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.secrets
    ADD CONSTRAINT secrets_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: secrets secrets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.secrets
    ADD CONSTRAINT secrets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: sentinel_activities sentinel_activities_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.sentinel_activities
    ADD CONSTRAINT sentinel_activities_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: sign_in_experiences sign_in_experiences_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.sign_in_experiences
    ADD CONSTRAINT sign_in_experiences_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: sso_connector_idp_initiated_auth_configs sso_connector_idp_initiated_auth_co_default_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.sso_connector_idp_initiated_auth_configs
    ADD CONSTRAINT sso_connector_idp_initiated_auth_co_default_application_id_fkey FOREIGN KEY (default_application_id) REFERENCES public.applications(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: sso_connector_idp_initiated_auth_configs sso_connector_idp_initiated_auth_configs_connector_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.sso_connector_idp_initiated_auth_configs
    ADD CONSTRAINT sso_connector_idp_initiated_auth_configs_connector_id_fkey FOREIGN KEY (connector_id) REFERENCES public.sso_connectors(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: sso_connector_idp_initiated_auth_configs sso_connector_idp_initiated_auth_configs_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.sso_connector_idp_initiated_auth_configs
    ADD CONSTRAINT sso_connector_idp_initiated_auth_configs_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: sso_connectors sso_connectors_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.sso_connectors
    ADD CONSTRAINT sso_connectors_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: subject_tokens subject_tokens_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.subject_tokens
    ADD CONSTRAINT subject_tokens_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: subject_tokens subject_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.subject_tokens
    ADD CONSTRAINT subject_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: user_sso_identities user_sso_identities_sso_connector_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.user_sso_identities
    ADD CONSTRAINT user_sso_identities_sso_connector_id_fkey FOREIGN KEY (sso_connector_id) REFERENCES public.sso_connectors(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: user_sso_identities user_sso_identities_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.user_sso_identities
    ADD CONSTRAINT user_sso_identities_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: user_sso_identities user_sso_identities_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.user_sso_identities
    ADD CONSTRAINT user_sso_identities_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: users_roles users_roles_role_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.users_roles
    ADD CONSTRAINT users_roles_role_id_fkey FOREIGN KEY (role_id) REFERENCES public.roles(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: users_roles users_roles_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.users_roles
    ADD CONSTRAINT users_roles_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: users_roles users_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.users_roles
    ADD CONSTRAINT users_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: users users_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.users
    ADD CONSTRAINT users_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: verification_records verification_records_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.verification_records
    ADD CONSTRAINT verification_records_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: verification_records verification_records_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.verification_records
    ADD CONSTRAINT verification_records_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: verification_statuses verification_statuses_tenant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.verification_statuses
    ADD CONSTRAINT verification_statuses_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: verification_statuses verification_statuses_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: logto
--

ALTER TABLE ONLY public.verification_statuses
    ADD CONSTRAINT verification_statuses_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: account_centers; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.account_centers ENABLE ROW LEVEL SECURITY;

--
-- Name: account_centers account_centers_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY account_centers_modification ON public.account_centers USING (true);


--
-- Name: account_centers account_centers_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY account_centers_tenant_id ON public.account_centers AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: aggregated_daily_active_users; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.aggregated_daily_active_users ENABLE ROW LEVEL SECURITY;

--
-- Name: aggregated_daily_active_users aggregated_daily_active_users_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY aggregated_daily_active_users_modification ON public.aggregated_daily_active_users USING (true);


--
-- Name: aggregated_daily_active_users aggregated_daily_active_users_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY aggregated_daily_active_users_tenant_id ON public.aggregated_daily_active_users AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: application_secrets; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.application_secrets ENABLE ROW LEVEL SECURITY;

--
-- Name: application_secrets application_secrets_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY application_secrets_modification ON public.application_secrets USING (true);


--
-- Name: application_secrets application_secrets_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY application_secrets_tenant_id ON public.application_secrets AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: application_sign_in_experiences; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.application_sign_in_experiences ENABLE ROW LEVEL SECURITY;

--
-- Name: application_sign_in_experiences application_sign_in_experiences_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY application_sign_in_experiences_modification ON public.application_sign_in_experiences USING (true);


--
-- Name: application_sign_in_experiences application_sign_in_experiences_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY application_sign_in_experiences_tenant_id ON public.application_sign_in_experiences AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: application_user_consent_organization_resource_scopes; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.application_user_consent_organization_resource_scopes ENABLE ROW LEVEL SECURITY;

--
-- Name: application_user_consent_organization_resource_scopes application_user_consent_organization_resource_scopes_modificat; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY application_user_consent_organization_resource_scopes_modificat ON public.application_user_consent_organization_resource_scopes USING (true);


--
-- Name: application_user_consent_organization_resource_scopes application_user_consent_organization_resource_scopes_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY application_user_consent_organization_resource_scopes_tenant_id ON public.application_user_consent_organization_resource_scopes AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: application_user_consent_organization_scopes; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.application_user_consent_organization_scopes ENABLE ROW LEVEL SECURITY;

--
-- Name: application_user_consent_organization_scopes application_user_consent_organization_scopes_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY application_user_consent_organization_scopes_modification ON public.application_user_consent_organization_scopes USING (true);


--
-- Name: application_user_consent_organization_scopes application_user_consent_organization_scopes_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY application_user_consent_organization_scopes_tenant_id ON public.application_user_consent_organization_scopes AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: application_user_consent_organizations; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.application_user_consent_organizations ENABLE ROW LEVEL SECURITY;

--
-- Name: application_user_consent_organizations application_user_consent_organizations_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY application_user_consent_organizations_modification ON public.application_user_consent_organizations USING (true);


--
-- Name: application_user_consent_organizations application_user_consent_organizations_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY application_user_consent_organizations_tenant_id ON public.application_user_consent_organizations AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: application_user_consent_resource_scopes; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.application_user_consent_resource_scopes ENABLE ROW LEVEL SECURITY;

--
-- Name: application_user_consent_resource_scopes application_user_consent_resource_scopes_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY application_user_consent_resource_scopes_modification ON public.application_user_consent_resource_scopes USING (true);


--
-- Name: application_user_consent_resource_scopes application_user_consent_resource_scopes_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY application_user_consent_resource_scopes_tenant_id ON public.application_user_consent_resource_scopes AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: application_user_consent_user_scopes; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.application_user_consent_user_scopes ENABLE ROW LEVEL SECURITY;

--
-- Name: application_user_consent_user_scopes application_user_consent_user_scopes_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY application_user_consent_user_scopes_modification ON public.application_user_consent_user_scopes USING (true);


--
-- Name: application_user_consent_user_scopes application_user_consent_user_scopes_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY application_user_consent_user_scopes_tenant_id ON public.application_user_consent_user_scopes AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: applications; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.applications ENABLE ROW LEVEL SECURITY;

--
-- Name: applications applications_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY applications_modification ON public.applications USING (true);


--
-- Name: applications_roles; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.applications_roles ENABLE ROW LEVEL SECURITY;

--
-- Name: applications_roles applications_roles_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY applications_roles_modification ON public.applications_roles USING (true);


--
-- Name: applications_roles applications_roles_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY applications_roles_tenant_id ON public.applications_roles AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: applications applications_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY applications_tenant_id ON public.applications AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: captcha_providers; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.captcha_providers ENABLE ROW LEVEL SECURITY;

--
-- Name: captcha_providers captcha_providers_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY captcha_providers_modification ON public.captcha_providers USING (true);


--
-- Name: captcha_providers captcha_providers_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY captcha_providers_tenant_id ON public.captcha_providers AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: connectors; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.connectors ENABLE ROW LEVEL SECURITY;

--
-- Name: connectors connectors_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY connectors_modification ON public.connectors USING (true);


--
-- Name: connectors connectors_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY connectors_tenant_id ON public.connectors AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: custom_phrases; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.custom_phrases ENABLE ROW LEVEL SECURITY;

--
-- Name: custom_phrases custom_phrases_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY custom_phrases_modification ON public.custom_phrases USING (true);


--
-- Name: custom_phrases custom_phrases_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY custom_phrases_tenant_id ON public.custom_phrases AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: custom_profile_fields; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.custom_profile_fields ENABLE ROW LEVEL SECURITY;

--
-- Name: custom_profile_fields custom_profile_fields_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY custom_profile_fields_modification ON public.custom_profile_fields USING (true);


--
-- Name: custom_profile_fields custom_profile_fields_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY custom_profile_fields_tenant_id ON public.custom_profile_fields AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: daily_active_users; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.daily_active_users ENABLE ROW LEVEL SECURITY;

--
-- Name: daily_active_users daily_active_users_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY daily_active_users_modification ON public.daily_active_users USING (true);


--
-- Name: daily_active_users daily_active_users_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY daily_active_users_tenant_id ON public.daily_active_users AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: daily_token_usage; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.daily_token_usage ENABLE ROW LEVEL SECURITY;

--
-- Name: daily_token_usage daily_token_usage_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY daily_token_usage_modification ON public.daily_token_usage USING (true);


--
-- Name: daily_token_usage daily_token_usage_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY daily_token_usage_tenant_id ON public.daily_token_usage AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: domains; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.domains ENABLE ROW LEVEL SECURITY;

--
-- Name: domains domains_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY domains_modification ON public.domains USING (true);


--
-- Name: domains domains_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY domains_tenant_id ON public.domains AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: email_templates; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.email_templates ENABLE ROW LEVEL SECURITY;

--
-- Name: email_templates email_templates_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY email_templates_modification ON public.email_templates USING (true);


--
-- Name: email_templates email_templates_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY email_templates_tenant_id ON public.email_templates AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: hooks; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.hooks ENABLE ROW LEVEL SECURITY;

--
-- Name: hooks hooks_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY hooks_modification ON public.hooks USING (true);


--
-- Name: hooks hooks_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY hooks_tenant_id ON public.hooks AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: idp_initiated_saml_sso_sessions; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.idp_initiated_saml_sso_sessions ENABLE ROW LEVEL SECURITY;

--
-- Name: idp_initiated_saml_sso_sessions idp_initiated_saml_sso_sessions_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY idp_initiated_saml_sso_sessions_modification ON public.idp_initiated_saml_sso_sessions USING (true);


--
-- Name: idp_initiated_saml_sso_sessions idp_initiated_saml_sso_sessions_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY idp_initiated_saml_sso_sessions_tenant_id ON public.idp_initiated_saml_sso_sessions AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: logs; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.logs ENABLE ROW LEVEL SECURITY;

--
-- Name: logs logs_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY logs_modification ON public.logs USING (true);


--
-- Name: logs logs_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY logs_tenant_id ON public.logs AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: logto_configs; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.logto_configs ENABLE ROW LEVEL SECURITY;

--
-- Name: logto_configs logto_configs_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY logto_configs_modification ON public.logto_configs USING (true);


--
-- Name: logto_configs logto_configs_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY logto_configs_tenant_id ON public.logto_configs AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: oidc_model_instances; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.oidc_model_instances ENABLE ROW LEVEL SECURITY;

--
-- Name: oidc_model_instances oidc_model_instances_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY oidc_model_instances_modification ON public.oidc_model_instances USING (true);


--
-- Name: oidc_model_instances oidc_model_instances_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY oidc_model_instances_tenant_id ON public.oidc_model_instances AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: oidc_session_extensions; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.oidc_session_extensions ENABLE ROW LEVEL SECURITY;

--
-- Name: oidc_session_extensions oidc_session_extensions_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY oidc_session_extensions_modification ON public.oidc_session_extensions USING (true);


--
-- Name: oidc_session_extensions oidc_session_extensions_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY oidc_session_extensions_tenant_id ON public.oidc_session_extensions AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: one_time_tokens; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.one_time_tokens ENABLE ROW LEVEL SECURITY;

--
-- Name: one_time_tokens one_time_tokens_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY one_time_tokens_modification ON public.one_time_tokens USING (true);


--
-- Name: one_time_tokens one_time_tokens_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY one_time_tokens_tenant_id ON public.one_time_tokens AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: organization_application_relations; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.organization_application_relations ENABLE ROW LEVEL SECURITY;

--
-- Name: organization_application_relations organization_application_relations_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_application_relations_modification ON public.organization_application_relations USING (true);


--
-- Name: organization_application_relations organization_application_relations_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_application_relations_tenant_id ON public.organization_application_relations AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: organization_invitation_role_relations; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.organization_invitation_role_relations ENABLE ROW LEVEL SECURITY;

--
-- Name: organization_invitation_role_relations organization_invitation_role_relations_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_invitation_role_relations_modification ON public.organization_invitation_role_relations USING (true);


--
-- Name: organization_invitation_role_relations organization_invitation_role_relations_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_invitation_role_relations_tenant_id ON public.organization_invitation_role_relations AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: organization_invitations; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.organization_invitations ENABLE ROW LEVEL SECURITY;

--
-- Name: organization_invitations organization_invitations_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_invitations_modification ON public.organization_invitations USING (true);


--
-- Name: organization_invitations organization_invitations_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_invitations_tenant_id ON public.organization_invitations AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: organization_jit_email_domains; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.organization_jit_email_domains ENABLE ROW LEVEL SECURITY;

--
-- Name: organization_jit_email_domains organization_jit_email_domains_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_jit_email_domains_modification ON public.organization_jit_email_domains USING (true);


--
-- Name: organization_jit_email_domains organization_jit_email_domains_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_jit_email_domains_tenant_id ON public.organization_jit_email_domains AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: organization_jit_roles; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.organization_jit_roles ENABLE ROW LEVEL SECURITY;

--
-- Name: organization_jit_roles organization_jit_roles_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_jit_roles_modification ON public.organization_jit_roles USING (true);


--
-- Name: organization_jit_roles organization_jit_roles_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_jit_roles_tenant_id ON public.organization_jit_roles AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: organization_jit_sso_connectors; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.organization_jit_sso_connectors ENABLE ROW LEVEL SECURITY;

--
-- Name: organization_jit_sso_connectors organization_jit_sso_connectors_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_jit_sso_connectors_modification ON public.organization_jit_sso_connectors USING (true);


--
-- Name: organization_jit_sso_connectors organization_jit_sso_connectors_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_jit_sso_connectors_tenant_id ON public.organization_jit_sso_connectors AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: organization_role_application_relations; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.organization_role_application_relations ENABLE ROW LEVEL SECURITY;

--
-- Name: organization_role_application_relations organization_role_application_relations_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_role_application_relations_modification ON public.organization_role_application_relations USING (true);


--
-- Name: organization_role_application_relations organization_role_application_relations_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_role_application_relations_tenant_id ON public.organization_role_application_relations AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: organization_role_resource_scope_relations; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.organization_role_resource_scope_relations ENABLE ROW LEVEL SECURITY;

--
-- Name: organization_role_resource_scope_relations organization_role_resource_scope_relations_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_role_resource_scope_relations_modification ON public.organization_role_resource_scope_relations USING (true);


--
-- Name: organization_role_resource_scope_relations organization_role_resource_scope_relations_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_role_resource_scope_relations_tenant_id ON public.organization_role_resource_scope_relations AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: organization_role_scope_relations; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.organization_role_scope_relations ENABLE ROW LEVEL SECURITY;

--
-- Name: organization_role_scope_relations organization_role_scope_relations_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_role_scope_relations_modification ON public.organization_role_scope_relations USING (true);


--
-- Name: organization_role_scope_relations organization_role_scope_relations_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_role_scope_relations_tenant_id ON public.organization_role_scope_relations AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: organization_role_user_relations; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.organization_role_user_relations ENABLE ROW LEVEL SECURITY;

--
-- Name: organization_role_user_relations organization_role_user_relations_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_role_user_relations_modification ON public.organization_role_user_relations USING (true);


--
-- Name: organization_role_user_relations organization_role_user_relations_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_role_user_relations_tenant_id ON public.organization_role_user_relations AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: organization_roles; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.organization_roles ENABLE ROW LEVEL SECURITY;

--
-- Name: organization_roles organization_roles_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_roles_modification ON public.organization_roles USING (true);


--
-- Name: organization_roles organization_roles_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_roles_tenant_id ON public.organization_roles AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: organization_scopes; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.organization_scopes ENABLE ROW LEVEL SECURITY;

--
-- Name: organization_scopes organization_scopes_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_scopes_modification ON public.organization_scopes USING (true);


--
-- Name: organization_scopes organization_scopes_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_scopes_tenant_id ON public.organization_scopes AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: organization_user_relations; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.organization_user_relations ENABLE ROW LEVEL SECURITY;

--
-- Name: organization_user_relations organization_user_relations_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_user_relations_modification ON public.organization_user_relations USING (true);


--
-- Name: organization_user_relations organization_user_relations_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organization_user_relations_tenant_id ON public.organization_user_relations AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: organizations; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.organizations ENABLE ROW LEVEL SECURITY;

--
-- Name: organizations organizations_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organizations_modification ON public.organizations USING (true);


--
-- Name: organizations organizations_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY organizations_tenant_id ON public.organizations AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: passcodes; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.passcodes ENABLE ROW LEVEL SECURITY;

--
-- Name: passcodes passcodes_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY passcodes_modification ON public.passcodes USING (true);


--
-- Name: passcodes passcodes_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY passcodes_tenant_id ON public.passcodes AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: personal_access_tokens; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.personal_access_tokens ENABLE ROW LEVEL SECURITY;

--
-- Name: personal_access_tokens personal_access_tokens_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY personal_access_tokens_modification ON public.personal_access_tokens USING (true);


--
-- Name: personal_access_tokens personal_access_tokens_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY personal_access_tokens_tenant_id ON public.personal_access_tokens AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: resources; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.resources ENABLE ROW LEVEL SECURITY;

--
-- Name: resources resources_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY resources_modification ON public.resources USING (true);


--
-- Name: resources resources_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY resources_tenant_id ON public.resources AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: roles; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.roles ENABLE ROW LEVEL SECURITY;

--
-- Name: roles roles_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY roles_modification ON public.roles USING (true);


--
-- Name: roles_scopes; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.roles_scopes ENABLE ROW LEVEL SECURITY;

--
-- Name: roles_scopes roles_scopes_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY roles_scopes_modification ON public.roles_scopes USING (true);


--
-- Name: roles_scopes roles_scopes_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY roles_scopes_tenant_id ON public.roles_scopes AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: roles roles_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY roles_tenant_id ON public.roles AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: saml_application_configs; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.saml_application_configs ENABLE ROW LEVEL SECURITY;

--
-- Name: saml_application_configs saml_application_configs_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY saml_application_configs_modification ON public.saml_application_configs USING (true);


--
-- Name: saml_application_configs saml_application_configs_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY saml_application_configs_tenant_id ON public.saml_application_configs AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: saml_application_secrets; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.saml_application_secrets ENABLE ROW LEVEL SECURITY;

--
-- Name: saml_application_secrets saml_application_secrets_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY saml_application_secrets_modification ON public.saml_application_secrets USING (true);


--
-- Name: saml_application_secrets saml_application_secrets_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY saml_application_secrets_tenant_id ON public.saml_application_secrets AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: saml_application_sessions; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.saml_application_sessions ENABLE ROW LEVEL SECURITY;

--
-- Name: saml_application_sessions saml_application_sessions_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY saml_application_sessions_modification ON public.saml_application_sessions USING (true);


--
-- Name: saml_application_sessions saml_application_sessions_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY saml_application_sessions_tenant_id ON public.saml_application_sessions AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: scopes; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.scopes ENABLE ROW LEVEL SECURITY;

--
-- Name: scopes scopes_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY scopes_modification ON public.scopes USING (true);


--
-- Name: scopes scopes_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY scopes_tenant_id ON public.scopes AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: secret_enterprise_sso_connector_relations; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.secret_enterprise_sso_connector_relations ENABLE ROW LEVEL SECURITY;

--
-- Name: secret_enterprise_sso_connector_relations secret_enterprise_sso_connector_relations_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY secret_enterprise_sso_connector_relations_modification ON public.secret_enterprise_sso_connector_relations USING (true);


--
-- Name: secret_enterprise_sso_connector_relations secret_enterprise_sso_connector_relations_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY secret_enterprise_sso_connector_relations_tenant_id ON public.secret_enterprise_sso_connector_relations AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: secret_social_connector_relations; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.secret_social_connector_relations ENABLE ROW LEVEL SECURITY;

--
-- Name: secret_social_connector_relations secret_social_connector_relations_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY secret_social_connector_relations_modification ON public.secret_social_connector_relations USING (true);


--
-- Name: secret_social_connector_relations secret_social_connector_relations_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY secret_social_connector_relations_tenant_id ON public.secret_social_connector_relations AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: secrets; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.secrets ENABLE ROW LEVEL SECURITY;

--
-- Name: secrets secrets_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY secrets_modification ON public.secrets USING (true);


--
-- Name: secrets secrets_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY secrets_tenant_id ON public.secrets AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: sentinel_activities; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.sentinel_activities ENABLE ROW LEVEL SECURITY;

--
-- Name: sentinel_activities sentinel_activities_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY sentinel_activities_modification ON public.sentinel_activities USING (true);


--
-- Name: sentinel_activities sentinel_activities_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY sentinel_activities_tenant_id ON public.sentinel_activities AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: sign_in_experiences; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.sign_in_experiences ENABLE ROW LEVEL SECURITY;

--
-- Name: sign_in_experiences sign_in_experiences_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY sign_in_experiences_modification ON public.sign_in_experiences USING (true);


--
-- Name: sign_in_experiences sign_in_experiences_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY sign_in_experiences_tenant_id ON public.sign_in_experiences AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: sso_connector_idp_initiated_auth_configs; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.sso_connector_idp_initiated_auth_configs ENABLE ROW LEVEL SECURITY;

--
-- Name: sso_connector_idp_initiated_auth_configs sso_connector_idp_initiated_auth_configs_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY sso_connector_idp_initiated_auth_configs_modification ON public.sso_connector_idp_initiated_auth_configs USING (true);


--
-- Name: sso_connector_idp_initiated_auth_configs sso_connector_idp_initiated_auth_configs_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY sso_connector_idp_initiated_auth_configs_tenant_id ON public.sso_connector_idp_initiated_auth_configs AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: sso_connectors; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.sso_connectors ENABLE ROW LEVEL SECURITY;

--
-- Name: sso_connectors sso_connectors_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY sso_connectors_modification ON public.sso_connectors USING (true);


--
-- Name: sso_connectors sso_connectors_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY sso_connectors_tenant_id ON public.sso_connectors AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: subject_tokens; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.subject_tokens ENABLE ROW LEVEL SECURITY;

--
-- Name: subject_tokens subject_tokens_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY subject_tokens_modification ON public.subject_tokens USING (true);


--
-- Name: subject_tokens subject_tokens_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY subject_tokens_tenant_id ON public.subject_tokens AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: tenants; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.tenants ENABLE ROW LEVEL SECURITY;

--
-- Name: tenants tenants_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY tenants_tenant_id ON public.tenants USING (((db_user)::text = CURRENT_USER));


--
-- Name: user_sso_identities; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.user_sso_identities ENABLE ROW LEVEL SECURITY;

--
-- Name: user_sso_identities user_sso_identities_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY user_sso_identities_modification ON public.user_sso_identities USING (true);


--
-- Name: user_sso_identities user_sso_identities_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY user_sso_identities_tenant_id ON public.user_sso_identities AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: users; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.users ENABLE ROW LEVEL SECURITY;

--
-- Name: users users_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY users_modification ON public.users USING (true);


--
-- Name: users_roles; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.users_roles ENABLE ROW LEVEL SECURITY;

--
-- Name: users_roles users_roles_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY users_roles_modification ON public.users_roles USING (true);


--
-- Name: users_roles users_roles_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY users_roles_tenant_id ON public.users_roles AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: users users_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY users_tenant_id ON public.users AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: verification_records; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.verification_records ENABLE ROW LEVEL SECURITY;

--
-- Name: verification_records verification_records_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY verification_records_modification ON public.verification_records USING (true);


--
-- Name: verification_records verification_records_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY verification_records_tenant_id ON public.verification_records AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: verification_statuses; Type: ROW SECURITY; Schema: public; Owner: logto
--

ALTER TABLE public.verification_statuses ENABLE ROW LEVEL SECURITY;

--
-- Name: verification_statuses verification_statuses_modification; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY verification_statuses_modification ON public.verification_statuses USING (true);


--
-- Name: verification_statuses verification_statuses_tenant_id; Type: POLICY; Schema: public; Owner: logto
--

CREATE POLICY verification_statuses_tenant_id ON public.verification_statuses AS RESTRICTIVE USING (((tenant_id)::text = (( SELECT tenants.id
   FROM public.tenants
  WHERE ((tenants.db_user)::text = CURRENT_USER)))::text));


--
-- Name: TABLE account_centers; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.account_centers TO logto_tenant_logto;


--
-- Name: TABLE aggregated_daily_active_users; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.aggregated_daily_active_users TO logto_tenant_logto;


--
-- Name: TABLE application_secrets; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.application_secrets TO logto_tenant_logto;


--
-- Name: TABLE application_sign_in_experiences; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.application_sign_in_experiences TO logto_tenant_logto;


--
-- Name: TABLE application_user_consent_organization_resource_scopes; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.application_user_consent_organization_resource_scopes TO logto_tenant_logto;


--
-- Name: TABLE application_user_consent_organization_scopes; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.application_user_consent_organization_scopes TO logto_tenant_logto;


--
-- Name: TABLE application_user_consent_organizations; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.application_user_consent_organizations TO logto_tenant_logto;


--
-- Name: TABLE application_user_consent_resource_scopes; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.application_user_consent_resource_scopes TO logto_tenant_logto;


--
-- Name: TABLE application_user_consent_user_scopes; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.application_user_consent_user_scopes TO logto_tenant_logto;


--
-- Name: TABLE applications; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.applications TO logto_tenant_logto;


--
-- Name: TABLE applications_roles; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.applications_roles TO logto_tenant_logto;


--
-- Name: TABLE captcha_providers; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.captcha_providers TO logto_tenant_logto;


--
-- Name: TABLE connectors; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.connectors TO logto_tenant_logto;


--
-- Name: TABLE custom_phrases; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.custom_phrases TO logto_tenant_logto;


--
-- Name: TABLE custom_profile_fields; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.custom_profile_fields TO logto_tenant_logto;


--
-- Name: TABLE daily_active_users; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.daily_active_users TO logto_tenant_logto;


--
-- Name: TABLE daily_token_usage; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.daily_token_usage TO logto_tenant_logto;


--
-- Name: TABLE domains; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.domains TO logto_tenant_logto;


--
-- Name: TABLE email_templates; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.email_templates TO logto_tenant_logto;


--
-- Name: TABLE hooks; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.hooks TO logto_tenant_logto;


--
-- Name: TABLE idp_initiated_saml_sso_sessions; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.idp_initiated_saml_sso_sessions TO logto_tenant_logto;


--
-- Name: TABLE logs; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.logs TO logto_tenant_logto;


--
-- Name: TABLE logto_configs; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.logto_configs TO logto_tenant_logto;


--
-- Name: TABLE oidc_model_instances; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.oidc_model_instances TO logto_tenant_logto;


--
-- Name: TABLE oidc_session_extensions; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.oidc_session_extensions TO logto_tenant_logto;


--
-- Name: TABLE one_time_tokens; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.one_time_tokens TO logto_tenant_logto;


--
-- Name: TABLE organization_application_relations; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.organization_application_relations TO logto_tenant_logto;


--
-- Name: TABLE organization_invitation_role_relations; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.organization_invitation_role_relations TO logto_tenant_logto;


--
-- Name: TABLE organization_invitations; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.organization_invitations TO logto_tenant_logto;


--
-- Name: TABLE organization_jit_email_domains; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.organization_jit_email_domains TO logto_tenant_logto;


--
-- Name: TABLE organization_jit_roles; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.organization_jit_roles TO logto_tenant_logto;


--
-- Name: TABLE organization_jit_sso_connectors; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.organization_jit_sso_connectors TO logto_tenant_logto;


--
-- Name: TABLE organization_role_application_relations; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.organization_role_application_relations TO logto_tenant_logto;


--
-- Name: TABLE organization_role_resource_scope_relations; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.organization_role_resource_scope_relations TO logto_tenant_logto;


--
-- Name: TABLE organization_role_scope_relations; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.organization_role_scope_relations TO logto_tenant_logto;


--
-- Name: TABLE organization_role_user_relations; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.organization_role_user_relations TO logto_tenant_logto;


--
-- Name: TABLE organization_roles; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.organization_roles TO logto_tenant_logto;


--
-- Name: TABLE organization_scopes; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.organization_scopes TO logto_tenant_logto;


--
-- Name: TABLE organization_user_relations; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.organization_user_relations TO logto_tenant_logto;


--
-- Name: TABLE organizations; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.organizations TO logto_tenant_logto;


--
-- Name: TABLE passcodes; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.passcodes TO logto_tenant_logto;


--
-- Name: TABLE personal_access_tokens; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.personal_access_tokens TO logto_tenant_logto;


--
-- Name: TABLE resources; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.resources TO logto_tenant_logto;


--
-- Name: TABLE roles; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.roles TO logto_tenant_logto;


--
-- Name: TABLE roles_scopes; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.roles_scopes TO logto_tenant_logto;


--
-- Name: TABLE saml_application_configs; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.saml_application_configs TO logto_tenant_logto;


--
-- Name: TABLE saml_application_secrets; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.saml_application_secrets TO logto_tenant_logto;


--
-- Name: TABLE saml_application_sessions; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.saml_application_sessions TO logto_tenant_logto;


--
-- Name: TABLE scopes; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.scopes TO logto_tenant_logto;


--
-- Name: TABLE secret_enterprise_sso_connector_relations; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.secret_enterprise_sso_connector_relations TO logto_tenant_logto;


--
-- Name: TABLE secret_social_connector_relations; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.secret_social_connector_relations TO logto_tenant_logto;


--
-- Name: TABLE secrets; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.secrets TO logto_tenant_logto;


--
-- Name: TABLE sentinel_activities; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.sentinel_activities TO logto_tenant_logto;


--
-- Name: TABLE sign_in_experiences; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.sign_in_experiences TO logto_tenant_logto;


--
-- Name: TABLE sso_connector_idp_initiated_auth_configs; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.sso_connector_idp_initiated_auth_configs TO logto_tenant_logto;


--
-- Name: TABLE sso_connectors; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.sso_connectors TO logto_tenant_logto;


--
-- Name: TABLE subject_tokens; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.subject_tokens TO logto_tenant_logto;


--
-- Name: COLUMN tenants.id; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT(id) ON TABLE public.tenants TO logto_tenant_logto;


--
-- Name: COLUMN tenants.db_user; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT(db_user) ON TABLE public.tenants TO logto_tenant_logto;


--
-- Name: COLUMN tenants.tag; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT(tag) ON TABLE public.tenants TO logto_tenant_logto;


--
-- Name: COLUMN tenants.is_suspended; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT(is_suspended) ON TABLE public.tenants TO logto_tenant_logto;


--
-- Name: TABLE user_sso_identities; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.user_sso_identities TO logto_tenant_logto;


--
-- Name: TABLE users; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.users TO logto_tenant_logto;


--
-- Name: TABLE users_roles; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.users_roles TO logto_tenant_logto;


--
-- Name: TABLE verification_records; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.verification_records TO logto_tenant_logto;


--
-- Name: TABLE verification_statuses; Type: ACL; Schema: public; Owner: logto
--

GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.verification_statuses TO logto_tenant_logto;


--
-- PostgreSQL database dump complete
--

\unrestrict fZpEf5X7Do3LbGuYMrgKqVEjkgqkEU2r42UqasIpZ2AjStCzl7DEoMvfmM4TJxj

--
-- Database "postgres" dump
--

\connect postgres

--
-- PostgreSQL database dump
--

\restrict GcHKqd1TR0t8kcDXPGjWyzcZFfbbhm1kxaWPdZFCLcc7zUZvu0rFmnlcMCvKK7G

-- Dumped from database version 15.15 (Debian 15.15-1.pgdg13+1)
-- Dumped by pg_dump version 15.15 (Debian 15.15-1.pgdg13+1)

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- PostgreSQL database dump complete
--

\unrestrict GcHKqd1TR0t8kcDXPGjWyzcZFfbbhm1kxaWPdZFCLcc7zUZvu0rFmnlcMCvKK7G

--
-- PostgreSQL database cluster dump complete
--
