--
-- PostgreSQL database dump
--

\restrict dH8fx3AdK64TG7IecPmrgrOWxeiXn3AKobbF7dTmH75S3dVHMMUX0JW7Gkw8UDz

-- Dumped from database version 16.12
-- Dumped by pg_dump version 16.12

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: SCHEMA public; Type: COMMENT; Schema: -; Owner: pg_database_owner
--

COMMENT ON SCHEMA public IS '';


--
-- Name: topology; Type: SCHEMA; Schema: -; Owner: directus
--

CREATE SCHEMA topology;


ALTER SCHEMA topology OWNER TO directus;

--
-- Name: SCHEMA topology; Type: COMMENT; Schema: -; Owner: directus
--

COMMENT ON SCHEMA topology IS 'PostGIS Topology schema';


--
-- Name: hstore; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS hstore WITH SCHEMA public;


--
-- Name: EXTENSION hstore; Type: COMMENT; Schema: -; Owner: 
--

COMMENT ON EXTENSION hstore IS 'data type for storing sets of (key, value) pairs';


--
-- Name: st_asbinary(text); Type: FUNCTION; Schema: public; Owner: directus
--

CREATE FUNCTION public.st_asbinary(text) RETURNS bytea
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$ SELECT ST_AsBinary($1::geometry);$_$;


ALTER FUNCTION public.st_asbinary(text) OWNER TO directus;

--
-- Name: st_astext(bytea); Type: FUNCTION; Schema: public; Owner: directus
--

CREATE FUNCTION public.st_astext(bytea) RETURNS text
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$ SELECT ST_AsText($1::geometry);$_$;


ALTER FUNCTION public.st_astext(bytea) OWNER TO directus;

--
-- Name: gist_geometry_ops; Type: OPERATOR FAMILY; Schema: public; Owner: directus
--

CREATE OPERATOR FAMILY public.gist_geometry_ops USING gist;


ALTER OPERATOR FAMILY public.gist_geometry_ops USING gist OWNER TO directus;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: directus_access; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_access (
    id uuid NOT NULL,
    role uuid,
    "user" uuid,
    policy uuid NOT NULL,
    sort integer
);


ALTER TABLE public.directus_access OWNER TO directus;

--
-- Name: directus_activity; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_activity (
    id integer NOT NULL,
    action character varying(45) NOT NULL,
    "user" uuid,
    "timestamp" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    ip character varying(50),
    user_agent text,
    collection character varying(64) NOT NULL,
    item character varying(255) NOT NULL,
    origin character varying(255)
);


ALTER TABLE public.directus_activity OWNER TO directus;

--
-- Name: directus_activity_id_seq; Type: SEQUENCE; Schema: public; Owner: directus
--

CREATE SEQUENCE public.directus_activity_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.directus_activity_id_seq OWNER TO directus;

--
-- Name: directus_activity_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: directus
--

ALTER SEQUENCE public.directus_activity_id_seq OWNED BY public.directus_activity.id;


--
-- Name: directus_collections; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_collections (
    collection character varying(64) NOT NULL,
    icon character varying(64),
    note text,
    display_template character varying(255),
    hidden boolean DEFAULT false NOT NULL,
    singleton boolean DEFAULT false NOT NULL,
    translations json,
    archive_field character varying(64),
    archive_app_filter boolean DEFAULT true NOT NULL,
    archive_value character varying(255),
    unarchive_value character varying(255),
    sort_field character varying(64),
    accountability character varying(255) DEFAULT 'all'::character varying,
    color character varying(255),
    item_duplication_fields json,
    sort integer,
    "group" character varying(64),
    collapse character varying(255) DEFAULT 'open'::character varying NOT NULL,
    preview_url character varying(255),
    versioning boolean DEFAULT false NOT NULL
);


ALTER TABLE public.directus_collections OWNER TO directus;

--
-- Name: directus_comments; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_comments (
    id uuid NOT NULL,
    collection character varying(64) NOT NULL,
    item character varying(255) NOT NULL,
    comment text NOT NULL,
    date_created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    date_updated timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    user_created uuid,
    user_updated uuid
);


ALTER TABLE public.directus_comments OWNER TO directus;

--
-- Name: directus_dashboards; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_dashboards (
    id uuid NOT NULL,
    name character varying(255) NOT NULL,
    icon character varying(64) DEFAULT 'dashboard'::character varying NOT NULL,
    note text,
    date_created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    user_created uuid,
    color character varying(255)
);


ALTER TABLE public.directus_dashboards OWNER TO directus;

--
-- Name: directus_extensions; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_extensions (
    enabled boolean DEFAULT true NOT NULL,
    id uuid NOT NULL,
    folder character varying(255) NOT NULL,
    source character varying(255) NOT NULL,
    bundle uuid
);


ALTER TABLE public.directus_extensions OWNER TO directus;

--
-- Name: directus_fields; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_fields (
    id integer NOT NULL,
    collection character varying(64) NOT NULL,
    field character varying(64) NOT NULL,
    special character varying(64),
    interface character varying(64),
    options json,
    display character varying(64),
    display_options json,
    readonly boolean DEFAULT false NOT NULL,
    hidden boolean DEFAULT false NOT NULL,
    sort integer,
    width character varying(30) DEFAULT 'full'::character varying,
    translations json,
    note text,
    conditions json,
    required boolean DEFAULT false,
    "group" character varying(64),
    validation json,
    validation_message text
);


ALTER TABLE public.directus_fields OWNER TO directus;

--
-- Name: directus_fields_id_seq; Type: SEQUENCE; Schema: public; Owner: directus
--

CREATE SEQUENCE public.directus_fields_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.directus_fields_id_seq OWNER TO directus;

--
-- Name: directus_fields_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: directus
--

ALTER SEQUENCE public.directus_fields_id_seq OWNED BY public.directus_fields.id;


--
-- Name: directus_files; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_files (
    id uuid NOT NULL,
    storage character varying(255) NOT NULL,
    filename_disk character varying(255),
    filename_download character varying(255) NOT NULL,
    title character varying(255),
    type character varying(255),
    folder uuid,
    uploaded_by uuid,
    created_on timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    modified_by uuid,
    modified_on timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    charset character varying(50),
    filesize bigint,
    width integer,
    height integer,
    duration integer,
    embed character varying(200),
    description text,
    location text,
    tags text,
    metadata json,
    focal_point_x integer,
    focal_point_y integer,
    tus_id character varying(64),
    tus_data json,
    uploaded_on timestamp with time zone
);


ALTER TABLE public.directus_files OWNER TO directus;

--
-- Name: directus_flows; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_flows (
    id uuid NOT NULL,
    name character varying(255) NOT NULL,
    icon character varying(64),
    color character varying(255),
    description text,
    status character varying(255) DEFAULT 'active'::character varying NOT NULL,
    trigger character varying(255),
    accountability character varying(255) DEFAULT 'all'::character varying,
    options json,
    operation uuid,
    date_created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    user_created uuid
);


ALTER TABLE public.directus_flows OWNER TO directus;

--
-- Name: directus_folders; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_folders (
    id uuid NOT NULL,
    name character varying(255) NOT NULL,
    parent uuid
);


ALTER TABLE public.directus_folders OWNER TO directus;

--
-- Name: directus_migrations; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_migrations (
    version character varying(255) NOT NULL,
    name character varying(255) NOT NULL,
    "timestamp" timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.directus_migrations OWNER TO directus;

--
-- Name: directus_notifications; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_notifications (
    id integer NOT NULL,
    "timestamp" timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    status character varying(255) DEFAULT 'inbox'::character varying,
    recipient uuid NOT NULL,
    sender uuid,
    subject character varying(255) NOT NULL,
    message text,
    collection character varying(64),
    item character varying(255)
);


ALTER TABLE public.directus_notifications OWNER TO directus;

--
-- Name: directus_notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: directus
--

CREATE SEQUENCE public.directus_notifications_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.directus_notifications_id_seq OWNER TO directus;

--
-- Name: directus_notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: directus
--

ALTER SEQUENCE public.directus_notifications_id_seq OWNED BY public.directus_notifications.id;


--
-- Name: directus_operations; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_operations (
    id uuid NOT NULL,
    name character varying(255),
    key character varying(255) NOT NULL,
    type character varying(255) NOT NULL,
    position_x integer NOT NULL,
    position_y integer NOT NULL,
    options json,
    resolve uuid,
    reject uuid,
    flow uuid NOT NULL,
    date_created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    user_created uuid
);


ALTER TABLE public.directus_operations OWNER TO directus;

--
-- Name: directus_panels; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_panels (
    id uuid NOT NULL,
    dashboard uuid NOT NULL,
    name character varying(255),
    icon character varying(64) DEFAULT NULL::character varying,
    color character varying(10),
    show_header boolean DEFAULT false NOT NULL,
    note text,
    type character varying(255) NOT NULL,
    position_x integer NOT NULL,
    position_y integer NOT NULL,
    width integer NOT NULL,
    height integer NOT NULL,
    options json,
    date_created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    user_created uuid
);


ALTER TABLE public.directus_panels OWNER TO directus;

--
-- Name: directus_permissions; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_permissions (
    id integer NOT NULL,
    collection character varying(64) NOT NULL,
    action character varying(10) NOT NULL,
    permissions json,
    validation json,
    presets json,
    fields text,
    policy uuid NOT NULL
);


ALTER TABLE public.directus_permissions OWNER TO directus;

--
-- Name: directus_permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: directus
--

CREATE SEQUENCE public.directus_permissions_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.directus_permissions_id_seq OWNER TO directus;

--
-- Name: directus_permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: directus
--

ALTER SEQUENCE public.directus_permissions_id_seq OWNED BY public.directus_permissions.id;


--
-- Name: directus_policies; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_policies (
    id uuid NOT NULL,
    name character varying(100) NOT NULL,
    icon character varying(64) DEFAULT 'badge'::character varying NOT NULL,
    description text,
    ip_access text,
    enforce_tfa boolean DEFAULT false NOT NULL,
    admin_access boolean DEFAULT false NOT NULL,
    app_access boolean DEFAULT false NOT NULL
);


ALTER TABLE public.directus_policies OWNER TO directus;

--
-- Name: directus_presets; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_presets (
    id integer NOT NULL,
    bookmark character varying(255),
    "user" uuid,
    role uuid,
    collection character varying(64),
    search character varying(100),
    layout character varying(100) DEFAULT 'tabular'::character varying,
    layout_query json,
    layout_options json,
    refresh_interval integer,
    filter json,
    icon character varying(64) DEFAULT 'bookmark'::character varying,
    color character varying(255)
);


ALTER TABLE public.directus_presets OWNER TO directus;

--
-- Name: directus_presets_id_seq; Type: SEQUENCE; Schema: public; Owner: directus
--

CREATE SEQUENCE public.directus_presets_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.directus_presets_id_seq OWNER TO directus;

--
-- Name: directus_presets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: directus
--

ALTER SEQUENCE public.directus_presets_id_seq OWNED BY public.directus_presets.id;


--
-- Name: directus_relations; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_relations (
    id integer NOT NULL,
    many_collection character varying(64) NOT NULL,
    many_field character varying(64) NOT NULL,
    one_collection character varying(64),
    one_field character varying(64),
    one_collection_field character varying(64),
    one_allowed_collections text,
    junction_field character varying(64),
    sort_field character varying(64),
    one_deselect_action character varying(255) DEFAULT 'nullify'::character varying NOT NULL
);


ALTER TABLE public.directus_relations OWNER TO directus;

--
-- Name: directus_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: directus
--

CREATE SEQUENCE public.directus_relations_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.directus_relations_id_seq OWNER TO directus;

--
-- Name: directus_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: directus
--

ALTER SEQUENCE public.directus_relations_id_seq OWNED BY public.directus_relations.id;


--
-- Name: directus_revisions; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_revisions (
    id integer NOT NULL,
    activity integer NOT NULL,
    collection character varying(64) NOT NULL,
    item character varying(255) NOT NULL,
    data json,
    delta json,
    parent integer,
    version uuid
);


ALTER TABLE public.directus_revisions OWNER TO directus;

--
-- Name: directus_revisions_id_seq; Type: SEQUENCE; Schema: public; Owner: directus
--

CREATE SEQUENCE public.directus_revisions_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.directus_revisions_id_seq OWNER TO directus;

--
-- Name: directus_revisions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: directus
--

ALTER SEQUENCE public.directus_revisions_id_seq OWNED BY public.directus_revisions.id;


--
-- Name: directus_roles; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_roles (
    id uuid NOT NULL,
    name character varying(100) NOT NULL,
    icon character varying(64) DEFAULT 'supervised_user_circle'::character varying NOT NULL,
    description text,
    parent uuid
);


ALTER TABLE public.directus_roles OWNER TO directus;

--
-- Name: directus_sessions; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_sessions (
    token character varying(64) NOT NULL,
    "user" uuid,
    expires timestamp with time zone NOT NULL,
    ip character varying(255),
    user_agent text,
    share uuid,
    origin character varying(255),
    next_token character varying(64)
);


ALTER TABLE public.directus_sessions OWNER TO directus;

--
-- Name: directus_settings; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_settings (
    id integer NOT NULL,
    project_name character varying(100) DEFAULT 'Directus'::character varying NOT NULL,
    project_url character varying(255),
    project_color character varying(255) DEFAULT '#6644FF'::character varying NOT NULL,
    project_logo uuid,
    public_foreground uuid,
    public_background uuid,
    public_note text,
    auth_login_attempts integer DEFAULT 25,
    auth_password_policy character varying(100),
    storage_asset_transform character varying(7) DEFAULT 'all'::character varying,
    storage_asset_presets json,
    custom_css text,
    storage_default_folder uuid,
    basemaps json,
    mapbox_key character varying(255),
    module_bar json,
    project_descriptor character varying(100),
    default_language character varying(255) DEFAULT 'en-US'::character varying NOT NULL,
    custom_aspect_ratios json,
    public_favicon uuid,
    default_appearance character varying(255) DEFAULT 'auto'::character varying NOT NULL,
    default_theme_light character varying(255),
    theme_light_overrides json,
    default_theme_dark character varying(255),
    theme_dark_overrides json,
    report_error_url character varying(255),
    report_bug_url character varying(255),
    report_feature_url character varying(255),
    public_registration boolean DEFAULT false NOT NULL,
    public_registration_verify_email boolean DEFAULT true NOT NULL,
    public_registration_role uuid,
    public_registration_email_filter json,
    visual_editor_urls json,
    accepted_terms boolean DEFAULT false,
    project_id uuid,
    mcp_enabled boolean DEFAULT false NOT NULL,
    mcp_allow_deletes boolean DEFAULT false NOT NULL,
    mcp_prompts_collection character varying(255) DEFAULT NULL::character varying,
    mcp_system_prompt_enabled boolean DEFAULT true NOT NULL,
    mcp_system_prompt text
);


ALTER TABLE public.directus_settings OWNER TO directus;

--
-- Name: directus_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: directus
--

CREATE SEQUENCE public.directus_settings_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.directus_settings_id_seq OWNER TO directus;

--
-- Name: directus_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: directus
--

ALTER SEQUENCE public.directus_settings_id_seq OWNED BY public.directus_settings.id;


--
-- Name: directus_shares; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_shares (
    id uuid NOT NULL,
    name character varying(255),
    collection character varying(64) NOT NULL,
    item character varying(255) NOT NULL,
    role uuid,
    password character varying(255),
    user_created uuid,
    date_created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    date_start timestamp with time zone,
    date_end timestamp with time zone,
    times_used integer DEFAULT 0,
    max_uses integer
);


ALTER TABLE public.directus_shares OWNER TO directus;

--
-- Name: directus_translations; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_translations (
    id uuid NOT NULL,
    language character varying(255) NOT NULL,
    key character varying(255) NOT NULL,
    value text NOT NULL
);


ALTER TABLE public.directus_translations OWNER TO directus;

--
-- Name: directus_users; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_users (
    id uuid NOT NULL,
    first_name character varying(50),
    last_name character varying(50),
    email character varying(128),
    password character varying(255),
    location character varying(255),
    title character varying(50),
    description text,
    tags json,
    avatar uuid,
    language character varying(255) DEFAULT NULL::character varying,
    tfa_secret character varying(255),
    status character varying(16) DEFAULT 'active'::character varying NOT NULL,
    role uuid,
    token character varying(255),
    last_access timestamp with time zone,
    last_page character varying(255),
    provider character varying(128) DEFAULT 'default'::character varying NOT NULL,
    external_identifier character varying(255),
    auth_data json,
    email_notifications boolean DEFAULT true,
    appearance character varying(255),
    theme_dark character varying(255),
    theme_light character varying(255),
    theme_light_overrides json,
    theme_dark_overrides json,
    text_direction character varying(255) DEFAULT 'auto'::character varying NOT NULL,
    website character varying(255),
    slug character varying(255) DEFAULT NULL::character varying NOT NULL,
    join_date timestamp without time zone NOT NULL,
    featured boolean DEFAULT false,
    artist_name character varying(255),
    banner uuid
);


ALTER TABLE public.directus_users OWNER TO directus;

--
-- Name: directus_versions; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_versions (
    id uuid NOT NULL,
    key character varying(64) NOT NULL,
    name character varying(255),
    collection character varying(64) NOT NULL,
    item character varying(255) NOT NULL,
    hash character varying(255),
    date_created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    date_updated timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    user_created uuid,
    user_updated uuid,
    delta json
);


ALTER TABLE public.directus_versions OWNER TO directus;

--
-- Name: directus_webhooks; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.directus_webhooks (
    id integer NOT NULL,
    name character varying(255) NOT NULL,
    method character varying(10) DEFAULT 'POST'::character varying NOT NULL,
    url character varying(255) NOT NULL,
    status character varying(10) DEFAULT 'active'::character varying NOT NULL,
    data boolean DEFAULT true NOT NULL,
    actions character varying(100) NOT NULL,
    collections character varying(255) NOT NULL,
    headers json,
    was_active_before_deprecation boolean DEFAULT false NOT NULL,
    migrated_flow uuid
);


ALTER TABLE public.directus_webhooks OWNER TO directus;

--
-- Name: directus_webhooks_id_seq; Type: SEQUENCE; Schema: public; Owner: directus
--

CREATE SEQUENCE public.directus_webhooks_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.directus_webhooks_id_seq OWNER TO directus;

--
-- Name: directus_webhooks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: directus
--

ALTER SEQUENCE public.directus_webhooks_id_seq OWNED BY public.directus_webhooks.id;


--
-- Name: junction_directus_users_files; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.junction_directus_users_files (
    id integer NOT NULL,
    directus_users_id uuid,
    directus_files_id uuid
);


ALTER TABLE public.junction_directus_users_files OWNER TO directus;

--
-- Name: junction_directus_users_files_id_seq; Type: SEQUENCE; Schema: public; Owner: directus
--

CREATE SEQUENCE public.junction_directus_users_files_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.junction_directus_users_files_id_seq OWNER TO directus;

--
-- Name: junction_directus_users_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: directus
--

ALTER SEQUENCE public.junction_directus_users_files_id_seq OWNED BY public.junction_directus_users_files.id;


--
-- Name: sexy_achievements; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.sexy_achievements (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    code character varying(50) NOT NULL,
    name character varying(255) NOT NULL,
    description text,
    icon character varying(255),
    category character varying(50) NOT NULL,
    required_count integer,
    points_reward integer DEFAULT 0,
    sort integer DEFAULT 0,
    status character varying(20) DEFAULT 'published'::character varying
);


ALTER TABLE public.sexy_achievements OWNER TO directus;

--
-- Name: TABLE sexy_achievements; Type: COMMENT; Schema: public; Owner: directus
--

COMMENT ON TABLE public.sexy_achievements IS 'Predefined achievement definitions for gamification';


--
-- Name: COLUMN sexy_achievements.code; Type: COMMENT; Schema: public; Owner: directus
--

COMMENT ON COLUMN public.sexy_achievements.code IS 'Unique code used in backend logic (e.g., first_recording, play_100)';


--
-- Name: COLUMN sexy_achievements.category; Type: COMMENT; Schema: public; Owner: directus
--

COMMENT ON COLUMN public.sexy_achievements.category IS 'Achievement category: recordings, playback, social, special';


--
-- Name: sexy_articles; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.sexy_articles (
    id uuid NOT NULL,
    status character varying(255) DEFAULT 'draft'::character varying NOT NULL,
    user_created uuid,
    date_created timestamp with time zone,
    date_updated timestamp with time zone,
    slug character varying(255) DEFAULT NULL::character varying,
    title character varying(255),
    excerpt text,
    content text,
    image uuid NOT NULL,
    tags json,
    publish_date timestamp without time zone,
    category character varying(255),
    featured boolean DEFAULT false,
    author uuid
);


ALTER TABLE public.sexy_articles OWNER TO directus;

--
-- Name: sexy_model_photos; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.sexy_model_photos (
    id integer NOT NULL,
    directus_users_id uuid NOT NULL,
    directus_files_id uuid NOT NULL,
    date_created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    date_updated timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.sexy_model_photos OWNER TO directus;

--
-- Name: sexy_model_photos_id_seq; Type: SEQUENCE; Schema: public; Owner: directus
--

CREATE SEQUENCE public.sexy_model_photos_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.sexy_model_photos_id_seq OWNER TO directus;

--
-- Name: sexy_model_photos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: directus
--

ALTER SEQUENCE public.sexy_model_photos_id_seq OWNED BY public.sexy_model_photos.id;


--
-- Name: sexy_recording_plays; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.sexy_recording_plays (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    user_id uuid NOT NULL,
    recording_id uuid NOT NULL,
    duration_played integer,
    completed boolean DEFAULT false,
    date_created timestamp with time zone DEFAULT now(),
    date_updated timestamp with time zone DEFAULT now()
);


ALTER TABLE public.sexy_recording_plays OWNER TO directus;

--
-- Name: TABLE sexy_recording_plays; Type: COMMENT; Schema: public; Owner: directus
--

COMMENT ON TABLE public.sexy_recording_plays IS 'Tracks user playback of recordings for analytics and gamification';


--
-- Name: COLUMN sexy_recording_plays.completed; Type: COMMENT; Schema: public; Owner: directus
--

COMMENT ON COLUMN public.sexy_recording_plays.completed IS 'True if user watched at least 90% of the recording';


--
-- Name: sexy_recordings; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.sexy_recordings (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    title character varying(255) NOT NULL,
    description text,
    slug character varying(255) NOT NULL,
    duration numeric(10,2) NOT NULL,
    events jsonb NOT NULL,
    device_info jsonb NOT NULL,
    tags json DEFAULT '[]'::json,
    linked_video uuid,
    status character varying(50) DEFAULT 'draft'::character varying,
    public boolean DEFAULT false,
    user_created uuid,
    user_updated uuid,
    date_created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    date_updated timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    original_recording_id uuid
);


ALTER TABLE public.sexy_recordings OWNER TO directus;

--
-- Name: sexy_user_achievements; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.sexy_user_achievements (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    user_id uuid NOT NULL,
    achievement_id uuid NOT NULL,
    progress integer DEFAULT 0,
    date_unlocked timestamp with time zone
);


ALTER TABLE public.sexy_user_achievements OWNER TO directus;

--
-- Name: TABLE sexy_user_achievements; Type: COMMENT; Schema: public; Owner: directus
--

COMMENT ON TABLE public.sexy_user_achievements IS 'Tracks which achievements users have unlocked';


--
-- Name: COLUMN sexy_user_achievements.progress; Type: COMMENT; Schema: public; Owner: directus
--

COMMENT ON COLUMN public.sexy_user_achievements.progress IS 'Current progress (e.g., 7/10 recordings created)';


--
-- Name: COLUMN sexy_user_achievements.date_unlocked; Type: COMMENT; Schema: public; Owner: directus
--

COMMENT ON COLUMN public.sexy_user_achievements.date_unlocked IS 'NULL if achievement not yet unlocked';


--
-- Name: sexy_user_points; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.sexy_user_points (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    user_id uuid NOT NULL,
    action character varying(50) NOT NULL,
    points integer NOT NULL,
    recording_id uuid,
    date_created timestamp with time zone DEFAULT now()
);


ALTER TABLE public.sexy_user_points OWNER TO directus;

--
-- Name: TABLE sexy_user_points; Type: COMMENT; Schema: public; Owner: directus
--

COMMENT ON TABLE public.sexy_user_points IS 'Individual point-earning actions for gamification system';


--
-- Name: COLUMN sexy_user_points.action; Type: COMMENT; Schema: public; Owner: directus
--

COMMENT ON COLUMN public.sexy_user_points.action IS 'Type of action: RECORDING_CREATE, RECORDING_PLAY, RECORDING_COMPLETE, COMMENT_CREATE, RECORDING_FEATURED';


--
-- Name: COLUMN sexy_user_points.points; Type: COMMENT; Schema: public; Owner: directus
--

COMMENT ON COLUMN public.sexy_user_points.points IS 'Raw points before time-weighted decay calculation';


--
-- Name: sexy_user_stats; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.sexy_user_stats (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    user_id uuid NOT NULL,
    total_raw_points integer DEFAULT 0,
    total_weighted_points numeric(10,2) DEFAULT 0,
    recordings_count integer DEFAULT 0,
    playbacks_count integer DEFAULT 0,
    comments_count integer DEFAULT 0,
    achievements_count integer DEFAULT 0,
    last_updated timestamp with time zone DEFAULT now()
);


ALTER TABLE public.sexy_user_stats OWNER TO directus;

--
-- Name: TABLE sexy_user_stats; Type: COMMENT; Schema: public; Owner: directus
--

COMMENT ON TABLE public.sexy_user_stats IS 'Cached user statistics for fast leaderboard queries';


--
-- Name: COLUMN sexy_user_stats.total_raw_points; Type: COMMENT; Schema: public; Owner: directus
--

COMMENT ON COLUMN public.sexy_user_stats.total_raw_points IS 'Sum of all points without time decay';


--
-- Name: COLUMN sexy_user_stats.total_weighted_points; Type: COMMENT; Schema: public; Owner: directus
--

COMMENT ON COLUMN public.sexy_user_stats.total_weighted_points IS 'Time-weighted score using exponential decay (λ=0.005)';


--
-- Name: COLUMN sexy_user_stats.last_updated; Type: COMMENT; Schema: public; Owner: directus
--

COMMENT ON COLUMN public.sexy_user_stats.last_updated IS 'Timestamp for cache invalidation';


--
-- Name: sexy_video_likes; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.sexy_video_likes (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    video_id uuid NOT NULL,
    user_id uuid NOT NULL,
    date_created timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.sexy_video_likes OWNER TO directus;

--
-- Name: sexy_video_plays; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.sexy_video_plays (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    video_id uuid NOT NULL,
    user_id uuid,
    session_id character varying(255),
    duration_watched integer DEFAULT 0,
    completed boolean DEFAULT false,
    date_created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    date_updated timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.sexy_video_plays OWNER TO directus;

--
-- Name: sexy_videos; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.sexy_videos (
    id uuid NOT NULL,
    status character varying(255) DEFAULT 'draft'::character varying NOT NULL,
    user_created uuid,
    date_created timestamp with time zone,
    date_updated timestamp with time zone,
    slug character varying(255),
    title character varying(255),
    image uuid,
    upload_date timestamp without time zone,
    premium boolean,
    featured boolean,
    tags json,
    movie uuid,
    description text
);


ALTER TABLE public.sexy_videos OWNER TO directus;

--
-- Name: sexy_videos_directus_users; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.sexy_videos_directus_users (
    id integer NOT NULL,
    sexy_videos_id uuid,
    directus_users_id uuid
);


ALTER TABLE public.sexy_videos_directus_users OWNER TO directus;

--
-- Name: sexy_videos_directus_users_id_seq; Type: SEQUENCE; Schema: public; Owner: directus
--

CREATE SEQUENCE public.sexy_videos_directus_users_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.sexy_videos_directus_users_id_seq OWNER TO directus;

--
-- Name: sexy_videos_directus_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: directus
--

ALTER SEQUENCE public.sexy_videos_directus_users_id_seq OWNED BY public.sexy_videos_directus_users.id;


--
-- Name: sexy_videos_models; Type: TABLE; Schema: public; Owner: directus
--

CREATE TABLE public.sexy_videos_models (
    id integer NOT NULL,
    sexy_videos_id uuid NOT NULL,
    directus_users_id uuid NOT NULL,
    date_created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
    date_updated timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.sexy_videos_models OWNER TO directus;

--
-- Name: sexy_videos_models_id_seq; Type: SEQUENCE; Schema: public; Owner: directus
--

CREATE SEQUENCE public.sexy_videos_models_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.sexy_videos_models_id_seq OWNER TO directus;

--
-- Name: sexy_videos_models_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: directus
--

ALTER SEQUENCE public.sexy_videos_models_id_seq OWNED BY public.sexy_videos_models.id;


--
-- Name: directus_activity id; Type: DEFAULT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_activity ALTER COLUMN id SET DEFAULT nextval('public.directus_activity_id_seq'::regclass);


--
-- Name: directus_fields id; Type: DEFAULT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_fields ALTER COLUMN id SET DEFAULT nextval('public.directus_fields_id_seq'::regclass);


--
-- Name: directus_notifications id; Type: DEFAULT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_notifications ALTER COLUMN id SET DEFAULT nextval('public.directus_notifications_id_seq'::regclass);


--
-- Name: directus_permissions id; Type: DEFAULT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_permissions ALTER COLUMN id SET DEFAULT nextval('public.directus_permissions_id_seq'::regclass);


--
-- Name: directus_presets id; Type: DEFAULT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_presets ALTER COLUMN id SET DEFAULT nextval('public.directus_presets_id_seq'::regclass);


--
-- Name: directus_relations id; Type: DEFAULT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_relations ALTER COLUMN id SET DEFAULT nextval('public.directus_relations_id_seq'::regclass);


--
-- Name: directus_revisions id; Type: DEFAULT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_revisions ALTER COLUMN id SET DEFAULT nextval('public.directus_revisions_id_seq'::regclass);


--
-- Name: directus_settings id; Type: DEFAULT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_settings ALTER COLUMN id SET DEFAULT nextval('public.directus_settings_id_seq'::regclass);


--
-- Name: directus_webhooks id; Type: DEFAULT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_webhooks ALTER COLUMN id SET DEFAULT nextval('public.directus_webhooks_id_seq'::regclass);


--
-- Name: junction_directus_users_files id; Type: DEFAULT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.junction_directus_users_files ALTER COLUMN id SET DEFAULT nextval('public.junction_directus_users_files_id_seq'::regclass);


--
-- Name: sexy_model_photos id; Type: DEFAULT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_model_photos ALTER COLUMN id SET DEFAULT nextval('public.sexy_model_photos_id_seq'::regclass);


--
-- Name: sexy_videos_directus_users id; Type: DEFAULT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_videos_directus_users ALTER COLUMN id SET DEFAULT nextval('public.sexy_videos_directus_users_id_seq'::regclass);


--
-- Name: sexy_videos_models id; Type: DEFAULT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_videos_models ALTER COLUMN id SET DEFAULT nextval('public.sexy_videos_models_id_seq'::regclass);


--
-- Name: directus_access directus_access_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_access
    ADD CONSTRAINT directus_access_pkey PRIMARY KEY (id);


--
-- Name: directus_activity directus_activity_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_activity
    ADD CONSTRAINT directus_activity_pkey PRIMARY KEY (id);


--
-- Name: directus_collections directus_collections_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_collections
    ADD CONSTRAINT directus_collections_pkey PRIMARY KEY (collection);


--
-- Name: directus_comments directus_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_comments
    ADD CONSTRAINT directus_comments_pkey PRIMARY KEY (id);


--
-- Name: directus_dashboards directus_dashboards_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_dashboards
    ADD CONSTRAINT directus_dashboards_pkey PRIMARY KEY (id);


--
-- Name: directus_extensions directus_extensions_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_extensions
    ADD CONSTRAINT directus_extensions_pkey PRIMARY KEY (id);


--
-- Name: directus_fields directus_fields_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_fields
    ADD CONSTRAINT directus_fields_pkey PRIMARY KEY (id);


--
-- Name: directus_files directus_files_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_files
    ADD CONSTRAINT directus_files_pkey PRIMARY KEY (id);


--
-- Name: directus_flows directus_flows_operation_unique; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_flows
    ADD CONSTRAINT directus_flows_operation_unique UNIQUE (operation);


--
-- Name: directus_flows directus_flows_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_flows
    ADD CONSTRAINT directus_flows_pkey PRIMARY KEY (id);


--
-- Name: directus_folders directus_folders_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_folders
    ADD CONSTRAINT directus_folders_pkey PRIMARY KEY (id);


--
-- Name: directus_migrations directus_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_migrations
    ADD CONSTRAINT directus_migrations_pkey PRIMARY KEY (version);


--
-- Name: directus_notifications directus_notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_notifications
    ADD CONSTRAINT directus_notifications_pkey PRIMARY KEY (id);


--
-- Name: directus_operations directus_operations_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_operations
    ADD CONSTRAINT directus_operations_pkey PRIMARY KEY (id);


--
-- Name: directus_operations directus_operations_reject_unique; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_operations
    ADD CONSTRAINT directus_operations_reject_unique UNIQUE (reject);


--
-- Name: directus_operations directus_operations_resolve_unique; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_operations
    ADD CONSTRAINT directus_operations_resolve_unique UNIQUE (resolve);


--
-- Name: directus_panels directus_panels_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_panels
    ADD CONSTRAINT directus_panels_pkey PRIMARY KEY (id);


--
-- Name: directus_permissions directus_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_permissions
    ADD CONSTRAINT directus_permissions_pkey PRIMARY KEY (id);


--
-- Name: directus_policies directus_policies_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_policies
    ADD CONSTRAINT directus_policies_pkey PRIMARY KEY (id);


--
-- Name: directus_presets directus_presets_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_presets
    ADD CONSTRAINT directus_presets_pkey PRIMARY KEY (id);


--
-- Name: directus_relations directus_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_relations
    ADD CONSTRAINT directus_relations_pkey PRIMARY KEY (id);


--
-- Name: directus_revisions directus_revisions_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_revisions
    ADD CONSTRAINT directus_revisions_pkey PRIMARY KEY (id);


--
-- Name: directus_roles directus_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_roles
    ADD CONSTRAINT directus_roles_pkey PRIMARY KEY (id);


--
-- Name: directus_sessions directus_sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_sessions
    ADD CONSTRAINT directus_sessions_pkey PRIMARY KEY (token);


--
-- Name: directus_settings directus_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_settings
    ADD CONSTRAINT directus_settings_pkey PRIMARY KEY (id);


--
-- Name: directus_shares directus_shares_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_shares
    ADD CONSTRAINT directus_shares_pkey PRIMARY KEY (id);


--
-- Name: directus_translations directus_translations_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_translations
    ADD CONSTRAINT directus_translations_pkey PRIMARY KEY (id);


--
-- Name: directus_users directus_users_email_unique; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_users
    ADD CONSTRAINT directus_users_email_unique UNIQUE (email);


--
-- Name: directus_users directus_users_external_identifier_unique; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_users
    ADD CONSTRAINT directus_users_external_identifier_unique UNIQUE (external_identifier);


--
-- Name: directus_users directus_users_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_users
    ADD CONSTRAINT directus_users_pkey PRIMARY KEY (id);


--
-- Name: directus_users directus_users_slug_unique; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_users
    ADD CONSTRAINT directus_users_slug_unique UNIQUE (slug);


--
-- Name: directus_users directus_users_token_unique; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_users
    ADD CONSTRAINT directus_users_token_unique UNIQUE (token);


--
-- Name: directus_versions directus_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_versions
    ADD CONSTRAINT directus_versions_pkey PRIMARY KEY (id);


--
-- Name: directus_webhooks directus_webhooks_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_webhooks
    ADD CONSTRAINT directus_webhooks_pkey PRIMARY KEY (id);


--
-- Name: junction_directus_users_files junction_directus_users_files_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.junction_directus_users_files
    ADD CONSTRAINT junction_directus_users_files_pkey PRIMARY KEY (id);


--
-- Name: sexy_achievements sexy_achievements_code_key; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_achievements
    ADD CONSTRAINT sexy_achievements_code_key UNIQUE (code);


--
-- Name: sexy_achievements sexy_achievements_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_achievements
    ADD CONSTRAINT sexy_achievements_pkey PRIMARY KEY (id);


--
-- Name: sexy_articles sexy_articles_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_articles
    ADD CONSTRAINT sexy_articles_pkey PRIMARY KEY (id);


--
-- Name: sexy_articles sexy_articles_slug_unique; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_articles
    ADD CONSTRAINT sexy_articles_slug_unique UNIQUE (slug);


--
-- Name: sexy_model_photos sexy_model_photos_directus_users_id_directus_files_id_key; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_model_photos
    ADD CONSTRAINT sexy_model_photos_directus_users_id_directus_files_id_key UNIQUE (directus_users_id, directus_files_id);


--
-- Name: sexy_model_photos sexy_model_photos_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_model_photos
    ADD CONSTRAINT sexy_model_photos_pkey PRIMARY KEY (id);


--
-- Name: sexy_recording_plays sexy_recording_plays_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_recording_plays
    ADD CONSTRAINT sexy_recording_plays_pkey PRIMARY KEY (id);


--
-- Name: sexy_recordings sexy_recordings_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_recordings
    ADD CONSTRAINT sexy_recordings_pkey PRIMARY KEY (id);


--
-- Name: sexy_recordings sexy_recordings_slug_key; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_recordings
    ADD CONSTRAINT sexy_recordings_slug_key UNIQUE (slug);


--
-- Name: sexy_user_achievements sexy_user_achievements_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_user_achievements
    ADD CONSTRAINT sexy_user_achievements_pkey PRIMARY KEY (id);


--
-- Name: sexy_user_achievements sexy_user_achievements_user_id_achievement_id_key; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_user_achievements
    ADD CONSTRAINT sexy_user_achievements_user_id_achievement_id_key UNIQUE (user_id, achievement_id);


--
-- Name: sexy_user_points sexy_user_points_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_user_points
    ADD CONSTRAINT sexy_user_points_pkey PRIMARY KEY (id);


--
-- Name: sexy_user_stats sexy_user_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_user_stats
    ADD CONSTRAINT sexy_user_stats_pkey PRIMARY KEY (id);


--
-- Name: sexy_user_stats sexy_user_stats_user_id_key; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_user_stats
    ADD CONSTRAINT sexy_user_stats_user_id_key UNIQUE (user_id);


--
-- Name: sexy_video_likes sexy_video_likes_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_video_likes
    ADD CONSTRAINT sexy_video_likes_pkey PRIMARY KEY (id);


--
-- Name: sexy_video_likes sexy_video_likes_video_id_user_id_key; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_video_likes
    ADD CONSTRAINT sexy_video_likes_video_id_user_id_key UNIQUE (video_id, user_id);


--
-- Name: sexy_video_plays sexy_video_plays_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_video_plays
    ADD CONSTRAINT sexy_video_plays_pkey PRIMARY KEY (id);


--
-- Name: sexy_videos_directus_users sexy_videos_directus_users_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_videos_directus_users
    ADD CONSTRAINT sexy_videos_directus_users_pkey PRIMARY KEY (id);


--
-- Name: sexy_videos_models sexy_videos_models_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_videos_models
    ADD CONSTRAINT sexy_videos_models_pkey PRIMARY KEY (id);


--
-- Name: sexy_videos_models sexy_videos_models_sexy_videos_id_directus_users_id_key; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_videos_models
    ADD CONSTRAINT sexy_videos_models_sexy_videos_id_directus_users_id_key UNIQUE (sexy_videos_id, directus_users_id);


--
-- Name: sexy_videos sexy_videos_pkey; Type: CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_videos
    ADD CONSTRAINT sexy_videos_pkey PRIMARY KEY (id);


--
-- Name: directus_users_slug_index; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX directus_users_slug_index ON public.directus_users USING btree (slug);


--
-- Name: idx_achievements_category; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX idx_achievements_category ON public.sexy_achievements USING btree (category);


--
-- Name: idx_achievements_code; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX idx_achievements_code ON public.sexy_achievements USING btree (code);


--
-- Name: idx_recording_plays_date; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX idx_recording_plays_date ON public.sexy_recording_plays USING btree (date_created);


--
-- Name: idx_recording_plays_recording; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX idx_recording_plays_recording ON public.sexy_recording_plays USING btree (recording_id);


--
-- Name: idx_recording_plays_user; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX idx_recording_plays_user ON public.sexy_recording_plays USING btree (user_id);


--
-- Name: idx_user_achievements_achievement; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX idx_user_achievements_achievement ON public.sexy_user_achievements USING btree (achievement_id);


--
-- Name: idx_user_achievements_unlocked; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX idx_user_achievements_unlocked ON public.sexy_user_achievements USING btree (date_unlocked) WHERE (date_unlocked IS NOT NULL);


--
-- Name: idx_user_achievements_user; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX idx_user_achievements_user ON public.sexy_user_achievements USING btree (user_id);


--
-- Name: idx_user_points_action; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX idx_user_points_action ON public.sexy_user_points USING btree (action);


--
-- Name: idx_user_points_date; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX idx_user_points_date ON public.sexy_user_points USING btree (date_created);


--
-- Name: idx_user_points_user; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX idx_user_points_user ON public.sexy_user_points USING btree (user_id);


--
-- Name: idx_user_stats_user; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX idx_user_stats_user ON public.sexy_user_stats USING btree (user_id);


--
-- Name: idx_user_stats_weighted; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX idx_user_stats_weighted ON public.sexy_user_stats USING btree (total_weighted_points DESC);


--
-- Name: sexy_articles_slug_index; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX sexy_articles_slug_index ON public.sexy_articles USING btree (slug);


--
-- Name: sexy_model_photos_files_id_idx; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX sexy_model_photos_files_id_idx ON public.sexy_model_photos USING btree (directus_files_id);


--
-- Name: sexy_model_photos_users_id_idx; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX sexy_model_photos_users_id_idx ON public.sexy_model_photos USING btree (directus_users_id);


--
-- Name: sexy_recordings_linked_video_idx; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX sexy_recordings_linked_video_idx ON public.sexy_recordings USING btree (linked_video);


--
-- Name: sexy_recordings_original_recording_idx; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX sexy_recordings_original_recording_idx ON public.sexy_recordings USING btree (original_recording_id);


--
-- Name: sexy_recordings_public_idx; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX sexy_recordings_public_idx ON public.sexy_recordings USING btree (public);


--
-- Name: sexy_recordings_slug_idx; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX sexy_recordings_slug_idx ON public.sexy_recordings USING btree (slug);


--
-- Name: sexy_recordings_status_idx; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX sexy_recordings_status_idx ON public.sexy_recordings USING btree (status);


--
-- Name: sexy_recordings_user_created_idx; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX sexy_recordings_user_created_idx ON public.sexy_recordings USING btree (user_created);


--
-- Name: sexy_video_likes_user_id_idx; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX sexy_video_likes_user_id_idx ON public.sexy_video_likes USING btree (user_id);


--
-- Name: sexy_video_likes_video_id_idx; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX sexy_video_likes_video_id_idx ON public.sexy_video_likes USING btree (video_id);


--
-- Name: sexy_video_plays_session_id_idx; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX sexy_video_plays_session_id_idx ON public.sexy_video_plays USING btree (session_id);


--
-- Name: sexy_video_plays_user_id_idx; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX sexy_video_plays_user_id_idx ON public.sexy_video_plays USING btree (user_id);


--
-- Name: sexy_video_plays_video_id_idx; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX sexy_video_plays_video_id_idx ON public.sexy_video_plays USING btree (video_id);


--
-- Name: sexy_videos_models_users_id_idx; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX sexy_videos_models_users_id_idx ON public.sexy_videos_models USING btree (directus_users_id);


--
-- Name: sexy_videos_models_videos_id_idx; Type: INDEX; Schema: public; Owner: directus
--

CREATE INDEX sexy_videos_models_videos_id_idx ON public.sexy_videos_models USING btree (sexy_videos_id);


--
-- Name: directus_access directus_access_policy_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_access
    ADD CONSTRAINT directus_access_policy_foreign FOREIGN KEY (policy) REFERENCES public.directus_policies(id) ON DELETE CASCADE;


--
-- Name: directus_access directus_access_role_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_access
    ADD CONSTRAINT directus_access_role_foreign FOREIGN KEY (role) REFERENCES public.directus_roles(id) ON DELETE CASCADE;


--
-- Name: directus_access directus_access_user_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_access
    ADD CONSTRAINT directus_access_user_foreign FOREIGN KEY ("user") REFERENCES public.directus_users(id) ON DELETE CASCADE;


--
-- Name: directus_collections directus_collections_group_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_collections
    ADD CONSTRAINT directus_collections_group_foreign FOREIGN KEY ("group") REFERENCES public.directus_collections(collection);


--
-- Name: directus_comments directus_comments_user_created_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_comments
    ADD CONSTRAINT directus_comments_user_created_foreign FOREIGN KEY (user_created) REFERENCES public.directus_users(id) ON DELETE SET NULL;


--
-- Name: directus_comments directus_comments_user_updated_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_comments
    ADD CONSTRAINT directus_comments_user_updated_foreign FOREIGN KEY (user_updated) REFERENCES public.directus_users(id);


--
-- Name: directus_dashboards directus_dashboards_user_created_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_dashboards
    ADD CONSTRAINT directus_dashboards_user_created_foreign FOREIGN KEY (user_created) REFERENCES public.directus_users(id) ON DELETE SET NULL;


--
-- Name: directus_files directus_files_folder_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_files
    ADD CONSTRAINT directus_files_folder_foreign FOREIGN KEY (folder) REFERENCES public.directus_folders(id) ON DELETE SET NULL;


--
-- Name: directus_files directus_files_modified_by_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_files
    ADD CONSTRAINT directus_files_modified_by_foreign FOREIGN KEY (modified_by) REFERENCES public.directus_users(id);


--
-- Name: directus_files directus_files_uploaded_by_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_files
    ADD CONSTRAINT directus_files_uploaded_by_foreign FOREIGN KEY (uploaded_by) REFERENCES public.directus_users(id);


--
-- Name: directus_flows directus_flows_user_created_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_flows
    ADD CONSTRAINT directus_flows_user_created_foreign FOREIGN KEY (user_created) REFERENCES public.directus_users(id) ON DELETE SET NULL;


--
-- Name: directus_folders directus_folders_parent_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_folders
    ADD CONSTRAINT directus_folders_parent_foreign FOREIGN KEY (parent) REFERENCES public.directus_folders(id);


--
-- Name: directus_notifications directus_notifications_recipient_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_notifications
    ADD CONSTRAINT directus_notifications_recipient_foreign FOREIGN KEY (recipient) REFERENCES public.directus_users(id) ON DELETE CASCADE;


--
-- Name: directus_notifications directus_notifications_sender_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_notifications
    ADD CONSTRAINT directus_notifications_sender_foreign FOREIGN KEY (sender) REFERENCES public.directus_users(id);


--
-- Name: directus_operations directus_operations_flow_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_operations
    ADD CONSTRAINT directus_operations_flow_foreign FOREIGN KEY (flow) REFERENCES public.directus_flows(id) ON DELETE CASCADE;


--
-- Name: directus_operations directus_operations_reject_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_operations
    ADD CONSTRAINT directus_operations_reject_foreign FOREIGN KEY (reject) REFERENCES public.directus_operations(id);


--
-- Name: directus_operations directus_operations_resolve_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_operations
    ADD CONSTRAINT directus_operations_resolve_foreign FOREIGN KEY (resolve) REFERENCES public.directus_operations(id);


--
-- Name: directus_operations directus_operations_user_created_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_operations
    ADD CONSTRAINT directus_operations_user_created_foreign FOREIGN KEY (user_created) REFERENCES public.directus_users(id) ON DELETE SET NULL;


--
-- Name: directus_panels directus_panels_dashboard_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_panels
    ADD CONSTRAINT directus_panels_dashboard_foreign FOREIGN KEY (dashboard) REFERENCES public.directus_dashboards(id) ON DELETE CASCADE;


--
-- Name: directus_panels directus_panels_user_created_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_panels
    ADD CONSTRAINT directus_panels_user_created_foreign FOREIGN KEY (user_created) REFERENCES public.directus_users(id) ON DELETE SET NULL;


--
-- Name: directus_permissions directus_permissions_policy_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_permissions
    ADD CONSTRAINT directus_permissions_policy_foreign FOREIGN KEY (policy) REFERENCES public.directus_policies(id) ON DELETE CASCADE;


--
-- Name: directus_presets directus_presets_role_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_presets
    ADD CONSTRAINT directus_presets_role_foreign FOREIGN KEY (role) REFERENCES public.directus_roles(id) ON DELETE CASCADE;


--
-- Name: directus_presets directus_presets_user_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_presets
    ADD CONSTRAINT directus_presets_user_foreign FOREIGN KEY ("user") REFERENCES public.directus_users(id) ON DELETE CASCADE;


--
-- Name: directus_revisions directus_revisions_activity_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_revisions
    ADD CONSTRAINT directus_revisions_activity_foreign FOREIGN KEY (activity) REFERENCES public.directus_activity(id) ON DELETE CASCADE;


--
-- Name: directus_revisions directus_revisions_parent_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_revisions
    ADD CONSTRAINT directus_revisions_parent_foreign FOREIGN KEY (parent) REFERENCES public.directus_revisions(id);


--
-- Name: directus_revisions directus_revisions_version_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_revisions
    ADD CONSTRAINT directus_revisions_version_foreign FOREIGN KEY (version) REFERENCES public.directus_versions(id) ON DELETE CASCADE;


--
-- Name: directus_roles directus_roles_parent_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_roles
    ADD CONSTRAINT directus_roles_parent_foreign FOREIGN KEY (parent) REFERENCES public.directus_roles(id);


--
-- Name: directus_sessions directus_sessions_share_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_sessions
    ADD CONSTRAINT directus_sessions_share_foreign FOREIGN KEY (share) REFERENCES public.directus_shares(id) ON DELETE CASCADE;


--
-- Name: directus_sessions directus_sessions_user_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_sessions
    ADD CONSTRAINT directus_sessions_user_foreign FOREIGN KEY ("user") REFERENCES public.directus_users(id) ON DELETE CASCADE;


--
-- Name: directus_settings directus_settings_project_logo_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_settings
    ADD CONSTRAINT directus_settings_project_logo_foreign FOREIGN KEY (project_logo) REFERENCES public.directus_files(id);


--
-- Name: directus_settings directus_settings_public_background_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_settings
    ADD CONSTRAINT directus_settings_public_background_foreign FOREIGN KEY (public_background) REFERENCES public.directus_files(id);


--
-- Name: directus_settings directus_settings_public_favicon_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_settings
    ADD CONSTRAINT directus_settings_public_favicon_foreign FOREIGN KEY (public_favicon) REFERENCES public.directus_files(id);


--
-- Name: directus_settings directus_settings_public_foreground_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_settings
    ADD CONSTRAINT directus_settings_public_foreground_foreign FOREIGN KEY (public_foreground) REFERENCES public.directus_files(id);


--
-- Name: directus_settings directus_settings_public_registration_role_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_settings
    ADD CONSTRAINT directus_settings_public_registration_role_foreign FOREIGN KEY (public_registration_role) REFERENCES public.directus_roles(id) ON DELETE SET NULL;


--
-- Name: directus_settings directus_settings_storage_default_folder_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_settings
    ADD CONSTRAINT directus_settings_storage_default_folder_foreign FOREIGN KEY (storage_default_folder) REFERENCES public.directus_folders(id) ON DELETE SET NULL;


--
-- Name: directus_shares directus_shares_collection_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_shares
    ADD CONSTRAINT directus_shares_collection_foreign FOREIGN KEY (collection) REFERENCES public.directus_collections(collection) ON DELETE CASCADE;


--
-- Name: directus_shares directus_shares_role_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_shares
    ADD CONSTRAINT directus_shares_role_foreign FOREIGN KEY (role) REFERENCES public.directus_roles(id) ON DELETE CASCADE;


--
-- Name: directus_shares directus_shares_user_created_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_shares
    ADD CONSTRAINT directus_shares_user_created_foreign FOREIGN KEY (user_created) REFERENCES public.directus_users(id) ON DELETE SET NULL;


--
-- Name: directus_users directus_users_banner_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_users
    ADD CONSTRAINT directus_users_banner_foreign FOREIGN KEY (banner) REFERENCES public.directus_files(id) ON DELETE SET NULL;


--
-- Name: directus_users directus_users_role_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_users
    ADD CONSTRAINT directus_users_role_foreign FOREIGN KEY (role) REFERENCES public.directus_roles(id) ON DELETE SET NULL;


--
-- Name: directus_versions directus_versions_collection_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_versions
    ADD CONSTRAINT directus_versions_collection_foreign FOREIGN KEY (collection) REFERENCES public.directus_collections(collection) ON DELETE CASCADE;


--
-- Name: directus_versions directus_versions_user_created_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_versions
    ADD CONSTRAINT directus_versions_user_created_foreign FOREIGN KEY (user_created) REFERENCES public.directus_users(id) ON DELETE SET NULL;


--
-- Name: directus_versions directus_versions_user_updated_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_versions
    ADD CONSTRAINT directus_versions_user_updated_foreign FOREIGN KEY (user_updated) REFERENCES public.directus_users(id);


--
-- Name: directus_webhooks directus_webhooks_migrated_flow_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.directus_webhooks
    ADD CONSTRAINT directus_webhooks_migrated_flow_foreign FOREIGN KEY (migrated_flow) REFERENCES public.directus_flows(id) ON DELETE SET NULL;


--
-- Name: junction_directus_users_files junction_directus_users_files_directus_files_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.junction_directus_users_files
    ADD CONSTRAINT junction_directus_users_files_directus_files_id_foreign FOREIGN KEY (directus_files_id) REFERENCES public.directus_files(id) ON DELETE SET NULL;


--
-- Name: junction_directus_users_files junction_directus_users_files_directus_users_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.junction_directus_users_files
    ADD CONSTRAINT junction_directus_users_files_directus_users_id_foreign FOREIGN KEY (directus_users_id) REFERENCES public.directus_users(id) ON DELETE SET NULL;


--
-- Name: sexy_articles sexy_articles_author_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_articles
    ADD CONSTRAINT sexy_articles_author_foreign FOREIGN KEY (author) REFERENCES public.directus_users(id) ON DELETE SET NULL;


--
-- Name: sexy_articles sexy_articles_image_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_articles
    ADD CONSTRAINT sexy_articles_image_foreign FOREIGN KEY (image) REFERENCES public.directus_files(id);


--
-- Name: sexy_articles sexy_articles_user_created_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_articles
    ADD CONSTRAINT sexy_articles_user_created_foreign FOREIGN KEY (user_created) REFERENCES public.directus_users(id);


--
-- Name: sexy_model_photos sexy_model_photos_directus_files_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_model_photos
    ADD CONSTRAINT sexy_model_photos_directus_files_id_fkey FOREIGN KEY (directus_files_id) REFERENCES public.directus_files(id) ON DELETE CASCADE;


--
-- Name: sexy_model_photos sexy_model_photos_directus_users_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_model_photos
    ADD CONSTRAINT sexy_model_photos_directus_users_id_fkey FOREIGN KEY (directus_users_id) REFERENCES public.directus_users(id) ON DELETE CASCADE;


--
-- Name: sexy_recording_plays sexy_recording_plays_recording_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_recording_plays
    ADD CONSTRAINT sexy_recording_plays_recording_id_fkey FOREIGN KEY (recording_id) REFERENCES public.sexy_recordings(id) ON DELETE CASCADE;


--
-- Name: sexy_recording_plays sexy_recording_plays_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_recording_plays
    ADD CONSTRAINT sexy_recording_plays_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.directus_users(id) ON DELETE CASCADE;


--
-- Name: sexy_recordings sexy_recordings_linked_video_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_recordings
    ADD CONSTRAINT sexy_recordings_linked_video_fkey FOREIGN KEY (linked_video) REFERENCES public.sexy_videos(id) ON DELETE SET NULL;


--
-- Name: sexy_recordings sexy_recordings_original_recording_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_recordings
    ADD CONSTRAINT sexy_recordings_original_recording_fkey FOREIGN KEY (original_recording_id) REFERENCES public.sexy_recordings(id) ON DELETE SET NULL;


--
-- Name: sexy_recordings sexy_recordings_user_created_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_recordings
    ADD CONSTRAINT sexy_recordings_user_created_fkey FOREIGN KEY (user_created) REFERENCES public.directus_users(id) ON DELETE CASCADE;


--
-- Name: sexy_user_achievements sexy_user_achievements_achievement_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_user_achievements
    ADD CONSTRAINT sexy_user_achievements_achievement_id_fkey FOREIGN KEY (achievement_id) REFERENCES public.sexy_achievements(id) ON DELETE CASCADE;


--
-- Name: sexy_user_achievements sexy_user_achievements_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_user_achievements
    ADD CONSTRAINT sexy_user_achievements_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.directus_users(id) ON DELETE CASCADE;


--
-- Name: sexy_user_points sexy_user_points_recording_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_user_points
    ADD CONSTRAINT sexy_user_points_recording_id_fkey FOREIGN KEY (recording_id) REFERENCES public.sexy_recordings(id) ON DELETE SET NULL;


--
-- Name: sexy_user_points sexy_user_points_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_user_points
    ADD CONSTRAINT sexy_user_points_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.directus_users(id) ON DELETE CASCADE;


--
-- Name: sexy_user_stats sexy_user_stats_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_user_stats
    ADD CONSTRAINT sexy_user_stats_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.directus_users(id) ON DELETE CASCADE;


--
-- Name: sexy_video_likes sexy_video_likes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_video_likes
    ADD CONSTRAINT sexy_video_likes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.directus_users(id) ON DELETE CASCADE;


--
-- Name: sexy_video_likes sexy_video_likes_video_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_video_likes
    ADD CONSTRAINT sexy_video_likes_video_id_fkey FOREIGN KEY (video_id) REFERENCES public.sexy_videos(id) ON DELETE CASCADE;


--
-- Name: sexy_video_plays sexy_video_plays_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_video_plays
    ADD CONSTRAINT sexy_video_plays_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.directus_users(id) ON DELETE SET NULL;


--
-- Name: sexy_video_plays sexy_video_plays_video_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_video_plays
    ADD CONSTRAINT sexy_video_plays_video_id_fkey FOREIGN KEY (video_id) REFERENCES public.sexy_videos(id) ON DELETE CASCADE;


--
-- Name: sexy_videos_directus_users sexy_videos_directus_users_directus_users_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_videos_directus_users
    ADD CONSTRAINT sexy_videos_directus_users_directus_users_id_foreign FOREIGN KEY (directus_users_id) REFERENCES public.directus_users(id) ON DELETE SET NULL;


--
-- Name: sexy_videos_directus_users sexy_videos_directus_users_sexy_videos_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_videos_directus_users
    ADD CONSTRAINT sexy_videos_directus_users_sexy_videos_id_foreign FOREIGN KEY (sexy_videos_id) REFERENCES public.sexy_videos(id) ON DELETE SET NULL;


--
-- Name: sexy_videos sexy_videos_image_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_videos
    ADD CONSTRAINT sexy_videos_image_foreign FOREIGN KEY (image) REFERENCES public.directus_files(id) ON DELETE SET NULL;


--
-- Name: sexy_videos_models sexy_videos_models_directus_users_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_videos_models
    ADD CONSTRAINT sexy_videos_models_directus_users_id_fkey FOREIGN KEY (directus_users_id) REFERENCES public.directus_users(id) ON DELETE CASCADE;


--
-- Name: sexy_videos_models sexy_videos_models_sexy_videos_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_videos_models
    ADD CONSTRAINT sexy_videos_models_sexy_videos_id_fkey FOREIGN KEY (sexy_videos_id) REFERENCES public.sexy_videos(id) ON DELETE CASCADE;


--
-- Name: sexy_videos sexy_videos_movie_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_videos
    ADD CONSTRAINT sexy_videos_movie_foreign FOREIGN KEY (movie) REFERENCES public.directus_files(id) ON DELETE SET NULL;


--
-- Name: sexy_videos sexy_videos_user_created_foreign; Type: FK CONSTRAINT; Schema: public; Owner: directus
--

ALTER TABLE ONLY public.sexy_videos
    ADD CONSTRAINT sexy_videos_user_created_foreign FOREIGN KEY (user_created) REFERENCES public.directus_users(id);


--
-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: pg_database_owner
--

REVOKE USAGE ON SCHEMA public FROM PUBLIC;
GRANT ALL ON SCHEMA public TO PUBLIC;


--
-- PostgreSQL database dump complete
--

\unrestrict dH8fx3AdK64TG7IecPmrgrOWxeiXn3AKobbF7dTmH75S3dVHMMUX0JW7Gkw8UDz

