--
-- PostgreSQL database dump
--


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: btree_gist; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;


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

CREATE EXTENSION IF NOT EXISTS vector WITH SCHEMA public;


--
-- Name: category; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE public.category AS ENUM (
    'Edit',
    'Effect',
    'Generator'
);


--
-- Name: model_type; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE public.model_type AS ENUM (
    'instrument',
    'voice'
);


--
-- Name: project_tag_categories; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE public.project_tag_categories AS ENUM (
    'system'
);


--
-- Name: script_status; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE public.script_status AS ENUM (
    'new',
    'verified',
    'trained',
    'deleted'
);


--
-- Name: stripe_cancellation_feedback; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE public.stripe_cancellation_feedback AS ENUM (
    'customer_service',
    'low_quality',
    'missing_features',
    'other',
    'switched_service',
    'too_complex',
    'too_expensive',
    'unused'
);


--
-- Name: stripe_cancellation_reason; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE public.stripe_cancellation_reason AS ENUM (
    'cancellation_requested',
    'payment_disputed',
    'payment_failed'
);


--
-- Name: stripe_cancellation_status; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE public.stripe_cancellation_status AS ENUM (
    'submitted',
    'finalised',
    'reactivated'
);


--
-- Name: sync_status; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE public.sync_status AS ENUM (
    'synced',
    'error'
);


--
-- Name: sync_type; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE public.sync_type AS ENUM (
    'manual',
    'user_signup',
    'subscription_update',
    'engagement_score'
);


--
-- Name: user_environment; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE public.user_environment AS ENUM (
    'production',
    'staging',
    'beta'
);


--
-- Name: user_role; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE public.user_role AS ENUM (
    'waitlist',
    'standard',
    'admin'
);


--
-- Name: delete_email_verification(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION public.delete_email_verification() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    DELETE FROM email_verifications WHERE email = OLD.email;
    RETURN OLD;
END;
$$;


--
-- Name: update_updated_at_column(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION public.update_updated_at_column() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  NEW.updated_at = NOW();
  RETURN NEW;
END;
$$;


--
-- Name: update_updated_at_column_user_engagement(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION public.update_updated_at_column_user_engagement() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  IF NEW.engagement_score <> OLD.engagement_score THEN
    NEW.updated_at = NOW();
  END IF;
  RETURN NEW;
END;
$$;


SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: activity; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.activity (
    id integer NOT NULL,
    user_id integer,
    action text NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    ip text,
    is_frontend boolean DEFAULT false NOT NULL,
    properties jsonb DEFAULT '{}'::jsonb NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: activity_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.activity ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.activity_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: app_features; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.app_features (
    id integer NOT NULL,
    code text NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: app_features_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.app_features ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.app_features_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: composer_choices; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.composer_choices (
    id integer NOT NULL,
    request_id integer NOT NULL,
    choice jsonb NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: composer_choices_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.composer_choices ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.composer_choices_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: composer_requests; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.composer_requests (
    id integer NOT NULL,
    user_id integer NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    queue_name text NOT NULL,
    request jsonb NOT NULL,
    response jsonb NOT NULL,
    response_time_ms integer NOT NULL,
    uuid text DEFAULT gen_random_uuid() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: composer_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.composer_requests ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.composer_requests_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: conductor_request_tags; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.conductor_request_tags (
    id integer NOT NULL,
    conductor_request_id integer NOT NULL,
    category text NOT NULL,
    value text NOT NULL,
    tag_version text,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: conductor_request_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.conductor_request_tags ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.conductor_request_tags_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: conductor_requests; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.conductor_requests (
    id integer NOT NULL,
    user_id integer,
    request text,
    context json,
    response json,
    response_time_ms integer,
    created_at timestamp without time zone DEFAULT now(),
    tag_version text,
    session_context json,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: conductor_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.conductor_requests ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.conductor_requests_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: conductor_token_quota; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.conductor_token_quota (
    minute integer NOT NULL,
    tokens_used integer NOT NULL
);


--
-- Name: config_vals; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.config_vals (
    id integer NOT NULL,
    name text,
    value text,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: config_vals_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.config_vals ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.config_vals_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: device_tags; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.device_tags (
    id integer NOT NULL,
    device_id integer NOT NULL,
    value text NOT NULL,
    category text,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: device_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.device_tags ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.device_tags_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: devices; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.devices (
    id integer NOT NULL,
    name text NOT NULL,
    author_id integer NOT NULL,
    code text NOT NULL,
    superseded_by integer,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    uuid text DEFAULT gen_random_uuid() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: devices_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.devices ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.devices_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: email_verifications; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.email_verifications (
    id integer NOT NULL,
    email character varying(255) NOT NULL,
    token character varying(255) NOT NULL,
    verified boolean DEFAULT false NOT NULL,
    invalidated boolean DEFAULT false NOT NULL,
    expires_at timestamp without time zone DEFAULT (now() + '00:30:00'::interval) NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: email_verifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.email_verifications ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.email_verifications_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: embedded_strings; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.embedded_strings (
    id integer NOT NULL,
    content text NOT NULL,
    embedding json NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: embedded_strings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.embedded_strings ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.embedded_strings_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: faq_answers; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.faq_answers (
    id integer NOT NULL,
    answer text NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: faq_answers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.faq_answers ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.faq_answers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: faq_questions; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.faq_questions (
    id integer NOT NULL,
    answer_id integer NOT NULL,
    question text NOT NULL,
    embedding public.vector(1536),
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: faq_questions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.faq_questions ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.faq_questions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: lalala_files; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.lalala_files (
    id integer NOT NULL,
    sample_id integer NOT NULL,
    lalala_id text NOT NULL,
    expires_at timestamp without time zone NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: lalala_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.lalala_files ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.lalala_files_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: migrations; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.migrations (
    id integer NOT NULL,
    filename text NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    content text NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: paddle_webhooks_events; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.paddle_webhooks_events (
    id integer NOT NULL,
    user_id integer,
    paddle_customer_id text,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL,
    type text NOT NULL,
    payload jsonb NOT NULL
);


--
-- Name: paddle_webhooks_events_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.paddle_webhooks_events ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.paddle_webhooks_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: plan_app_features; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.plan_app_features (
    plan_id integer NOT NULL,
    app_feature_id integer NOT NULL
);


--
-- Name: plan_overrides; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.plan_overrides (
    id integer NOT NULL,
    plan_id integer NOT NULL,
    email character varying(255) NOT NULL,
    expires_at timestamp without time zone NOT NULL,
    enabled boolean DEFAULT true NOT NULL,
    note text,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: plan_overrides_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.plan_overrides ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.plan_overrides_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: plans; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.plans (
    id integer NOT NULL,
    name text NOT NULL,
    is_trial boolean DEFAULT false NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL,
    active_until timestamp without time zone,
    price_id_env_var text DEFAULT 'STRIPE_PRO_SUBSCRIPTION_PRICE_ID'::text NOT NULL,
    trial_days integer DEFAULT 0 NOT NULL,
    paddle_price_id_env_var text DEFAULT 'PADDLE_PRO_SUBSCRIPTION_PRICE_ID'::text
);


--
-- Name: plans_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.plans ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.plans_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: preset_tags; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.preset_tags (
    id integer NOT NULL,
    preset_id integer NOT NULL,
    value text NOT NULL,
    category text,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: preset_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.preset_tags ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.preset_tags_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: presets; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.presets (
    id integer NOT NULL,
    name text NOT NULL,
    settings json NOT NULL,
    device_id integer NOT NULL,
    superseded_by integer,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    author_id integer NOT NULL,
    uuid text DEFAULT gen_random_uuid() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: presets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.presets ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.presets_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: project_samples; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.project_samples (
    project_id integer,
    sample_id integer,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: project_tags; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.project_tags (
    id integer NOT NULL,
    project_id integer NOT NULL,
    category public.project_tag_categories NOT NULL,
    tag text NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: project_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.project_tags ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.project_tags_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: projects; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.projects (
    id integer NOT NULL,
    user_id integer NOT NULL,
    project_state jsonb NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL,
    uuid text NOT NULL,
    is_deleted boolean DEFAULT false NOT NULL,
    superseded_by integer,
    remix_of_id integer,
    remixable boolean DEFAULT false NOT NULL,
    saved_at timestamp without time zone DEFAULT now()
);


--
-- Name: projects_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.projects ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.projects_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: sample_derivations; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sample_derivations (
    sample_id integer NOT NULL,
    derived_from_id integer NOT NULL,
    derivation_type text NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: sample_packs; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sample_packs (
    id integer NOT NULL,
    name text NOT NULL,
    author_id integer,
    uuid text DEFAULT gen_random_uuid() NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    published boolean DEFAULT false,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: sample_packs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.sample_packs ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.sample_packs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: sample_tags; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sample_tags (
    id integer NOT NULL,
    sample_id integer NOT NULL,
    value text NOT NULL,
    category text,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: sample_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.sample_tags ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.sample_tags_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: sample_voice_conversion_models; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sample_voice_conversion_models (
    sample_id integer NOT NULL,
    voice_conversion_model_id integer NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: samples; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.samples (
    id integer NOT NULL,
    name text NOT NULL,
    s3_key text,
    length_in_ms integer,
    pack_id integer,
    author_id integer,
    uuid text DEFAULT gen_random_uuid() NOT NULL,
    waveform_svg text,
    warp json,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    bpm integer,
    compressed_s3_key text,
    cache_key text,
    analysis jsonb DEFAULT '{}'::jsonb NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL,
    CONSTRAINT samples_at_least_one_s3_key CHECK ((NOT ((s3_key IS NULL) AND (compressed_s3_key IS NULL))))
);


--
-- Name: samples_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.samples ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.samples_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: sendgrid_events; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sendgrid_events (
    id integer NOT NULL,
    user_id integer,
    email text NOT NULL,
    event text,
    source text,
    category text[],
    ip text,
    mc_stats text,
    send_at integer,
    sg_event_id text,
    sg_message_id text,
    sg_template_id text,
    sg_template_name text,
    singlesend_id text,
    singlesend_name text,
    marketing_campaign_id integer,
    marketing_campaign_name text,
    marketing_campaign_version text,
    template_hash text,
    template_id text,
    template_version_id text,
    useragent text,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: sendgrid_events_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.sendgrid_events ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.sendgrid_events_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: sendgrid_sync_jobs; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.sendgrid_sync_jobs (
    id integer NOT NULL,
    job_id character varying(255) NOT NULL,
    trigger_script character varying(255) NOT NULL,
    status character varying(255) NOT NULL,
    response jsonb,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: sendgrid_sync_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.sendgrid_sync_jobs ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.sendgrid_sync_jobs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: service_quotas; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.service_quotas (
    id integer NOT NULL,
    user_id integer NOT NULL,
    service text NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    meta jsonb,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: service_quotas_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.service_quotas ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.service_quotas_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: shared_tracks_plays; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.shared_tracks_plays (
    id integer NOT NULL,
    user_id integer,
    track_id integer NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: shared_tracks_plays_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.shared_tracks_plays ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.shared_tracks_plays_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: short_url_clicks; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.short_url_clicks (
    short_url_id integer,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    request_information jsonb
);


--
-- Name: short_urls; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.short_urls (
    id integer NOT NULL,
    short_code text NOT NULL,
    long_url text NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    user_id integer,
    is_manual boolean DEFAULT false
);


--
-- Name: short_urls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.short_urls ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.short_urls_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: typeform_signup_surveys; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.typeform_signup_surveys (
    id integer NOT NULL,
    user_id integer NOT NULL,
    answers json NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: signup_surveys_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.typeform_signup_surveys ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.signup_surveys_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: subscription_cancellation_details; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.subscription_cancellation_details (
    id integer NOT NULL,
    user_id integer NOT NULL,
    reason public.stripe_cancellation_reason,
    feedback public.stripe_cancellation_feedback,
    comment text,
    created_at timestamp without time zone DEFAULT now(),
    status public.stripe_cancellation_status DEFAULT 'submitted'::public.stripe_cancellation_status
);


--
-- Name: subscription_cancellation_details_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.subscription_cancellation_details ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.subscription_cancellation_details_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: subscription_updates; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.subscription_updates (
    id integer NOT NULL,
    user_id integer NOT NULL,
    subscribed_until timestamp without time zone NOT NULL,
    amount_paid_cents_usd integer DEFAULT 0 NOT NULL,
    created_at timestamp without time zone DEFAULT now(),
    will_renew boolean DEFAULT true,
    updated_at timestamp without time zone DEFAULT now() NOT NULL,
    plan_id integer NOT NULL,
    is_manual boolean DEFAULT false NOT NULL
);


--
-- Name: subscription_updates_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.subscription_updates ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.subscription_updates_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: track_preset_tags; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.track_preset_tags (
    id integer NOT NULL,
    track_preset_id integer NOT NULL,
    value text NOT NULL,
    category text,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: track_preset_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.track_preset_tags ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.track_preset_tags_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: track_presets; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.track_presets (
    id integer NOT NULL,
    preset_data jsonb NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL,
    published boolean DEFAULT false NOT NULL
);


--
-- Name: track_presets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.track_presets ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.track_presets_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: tracks_for_sharing; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.tracks_for_sharing (
    id integer NOT NULL,
    s3_key text NOT NULL,
    author_id integer NOT NULL,
    name text NOT NULL,
    uuid text NOT NULL,
    s3_url text NOT NULL,
    band_energy jsonb NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL,
    project_id integer
);


--
-- Name: tracks_for_sharing_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.tracks_for_sharing ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.tracks_for_sharing_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: user_deletion_requests; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.user_deletion_requests (
    id integer NOT NULL,
    user_id integer NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: user_deletion_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.user_deletion_requests ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.user_deletion_requests_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: user_email_cold_storage; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.user_email_cold_storage (
    id integer NOT NULL,
    user_id integer NOT NULL,
    in_storage boolean DEFAULT true NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: user_email_cold_storage_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.user_email_cold_storage ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.user_email_cold_storage_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: user_engagement_score; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.user_engagement_score (
    id integer NOT NULL,
    user_id integer,
    engagement_score real NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: user_engagement_score_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.user_engagement_score ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.user_engagement_score_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: user_identities; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.user_identities (
    id integer NOT NULL,
    user_id integer NOT NULL,
    issuer text NOT NULL,
    external_id text NOT NULL,
    profile_data text,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: user_identities_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.user_identities ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.user_identities_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


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

CREATE TABLE public.users (
    id integer NOT NULL,
    normalized_email text NOT NULL,
    email text NOT NULL,
    display_name text NOT NULL,
    role public.user_role DEFAULT 'standard'::public.user_role NOT NULL,
    stripe_customer_id text,
    message_limit_override integer,
    environment public.user_environment DEFAULT 'production'::public.user_environment NOT NULL,
    share_name text,
    user_categorisation text,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL,
    browser_language character varying(32),
    paddle_customer_id text
);


--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.users ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.users_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: voice_conversion_model_corpus; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.voice_conversion_model_corpus (
    model_id integer NOT NULL,
    sample_id integer NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: voice_conversion_model_training_runs; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.voice_conversion_model_training_runs (
    id integer NOT NULL,
    model_id integer NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    state text DEFAULT 'pending'::text NOT NULL,
    trainer_version text,
    progress real DEFAULT 0.0 NOT NULL,
    s3_key text,
    error text,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: voice_conversion_model_training_runs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.voice_conversion_model_training_runs ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.voice_conversion_model_training_runs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: voice_conversion_models; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.voice_conversion_models (
    id integer NOT NULL,
    uuid uuid DEFAULT gen_random_uuid() NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    author_id integer,
    name text NOT NULL,
    archived boolean DEFAULT false NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL,
    model_type public.model_type DEFAULT 'instrument'::public.model_type NOT NULL
);


--
-- Name: voice_conversion_models_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.voice_conversion_models ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.voice_conversion_models_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: voice_conversion_training_script_samples; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.voice_conversion_training_script_samples (
    training_script_id integer NOT NULL,
    sample_id integer NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: voice_conversion_training_scripts; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.voice_conversion_training_scripts (
    id integer NOT NULL,
    user_id integer NOT NULL,
    script_title text NOT NULL,
    training_script text NOT NULL,
    transcribed_script text,
    match_score real,
    model_id integer,
    status public.script_status DEFAULT 'new'::public.script_status NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: voice_conversion_training_scripts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.voice_conversion_training_scripts ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.voice_conversion_training_scripts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: waiting_list_signups; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.waiting_list_signups (
    id integer NOT NULL,
    email text NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: waiting_list_signups_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.waiting_list_signups ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.waiting_list_signups_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: wavtool_standup_summaries; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.wavtool_standup_summaries (
    id integer NOT NULL,
    date_from date NOT NULL,
    date_to date NOT NULL,
    summary text NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: wavtool_standup_summaries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.wavtool_standup_summaries ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.wavtool_standup_summaries_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: wavtool_standups; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.wavtool_standups (
    id integer NOT NULL,
    user_id integer,
    date date NOT NULL,
    standup_done text,
    standup_doing text,
    standup_blockers text,
    standup_mood text,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL,
    is_working boolean DEFAULT true NOT NULL
);


--
-- Name: wavtool_standups_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.wavtool_standups ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.wavtool_standups_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: welcome_survey_answers; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.welcome_survey_answers (
    id integer NOT NULL,
    user_id integer NOT NULL,
    hear_about_us text NOT NULL,
    hear_about_us_details text,
    user_self_description text NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: welcome_survey_answers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.welcome_survey_answers ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.welcome_survey_answers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: zoho_sync_status; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.zoho_sync_status (
    id integer NOT NULL,
    user_id integer,
    user_ids jsonb,
    sync_type public.sync_type NOT NULL,
    sync_status public.sync_status NOT NULL,
    error_message text,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: zoho_sync_status_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.zoho_sync_status ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.zoho_sync_status_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: zoho_tokens; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.zoho_tokens (
    id integer NOT NULL,
    access_token text NOT NULL,
    refresh_token text NOT NULL,
    client_id text NOT NULL,
    client_secret text NOT NULL,
    scope text NOT NULL,
    api_domain text NOT NULL,
    token_type text NOT NULL,
    expires_in integer NOT NULL,
    expires_at timestamp without time zone NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


--
-- Name: zoho_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.zoho_tokens ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
    SEQUENCE NAME public.zoho_tokens_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: activity activity_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.activity
    ADD CONSTRAINT activity_pkey PRIMARY KEY (id);


--
-- Name: app_features app_features_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.app_features
    ADD CONSTRAINT app_features_pkey PRIMARY KEY (id);


--
-- Name: composer_choices composer_choices_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.composer_choices
    ADD CONSTRAINT composer_choices_pkey PRIMARY KEY (id);


--
-- Name: composer_requests composer_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.composer_requests
    ADD CONSTRAINT composer_requests_pkey PRIMARY KEY (id);


--
-- Name: composer_requests composer_requests_uuid_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.composer_requests
    ADD CONSTRAINT composer_requests_uuid_key UNIQUE (uuid);


--
-- Name: conductor_request_tags conductor_request_tags_conductor_request_id_tag_version_cat_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.conductor_request_tags
    ADD CONSTRAINT conductor_request_tags_conductor_request_id_tag_version_cat_key UNIQUE (conductor_request_id, tag_version, category, value);


--
-- Name: conductor_request_tags conductor_request_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.conductor_request_tags
    ADD CONSTRAINT conductor_request_tags_pkey PRIMARY KEY (id);


--
-- Name: conductor_requests conductor_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.conductor_requests
    ADD CONSTRAINT conductor_requests_pkey PRIMARY KEY (id);


--
-- Name: conductor_token_quota conductor_token_quota_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.conductor_token_quota
    ADD CONSTRAINT conductor_token_quota_pkey PRIMARY KEY (minute);


--
-- Name: config_vals config_vals_name_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.config_vals
    ADD CONSTRAINT config_vals_name_key UNIQUE (name);


--
-- Name: config_vals config_vals_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.config_vals
    ADD CONSTRAINT config_vals_pkey PRIMARY KEY (id);


--
-- Name: device_tags device_tags_device_id_category_value_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.device_tags
    ADD CONSTRAINT device_tags_device_id_category_value_key UNIQUE (device_id, category, value);


--
-- Name: device_tags device_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.device_tags
    ADD CONSTRAINT device_tags_pkey PRIMARY KEY (id);


--
-- Name: devices devices_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.devices
    ADD CONSTRAINT devices_pkey PRIMARY KEY (id);


--
-- Name: devices devices_uuid_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.devices
    ADD CONSTRAINT devices_uuid_key UNIQUE (uuid);


--
-- Name: email_verifications email_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.email_verifications
    ADD CONSTRAINT email_verifications_pkey PRIMARY KEY (id);


--
-- Name: embedded_strings embedded_strings_content_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.embedded_strings
    ADD CONSTRAINT embedded_strings_content_key UNIQUE (content);


--
-- Name: embedded_strings embedded_strings_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.embedded_strings
    ADD CONSTRAINT embedded_strings_pkey PRIMARY KEY (id);


--
-- Name: faq_answers faq_answers_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.faq_answers
    ADD CONSTRAINT faq_answers_pkey PRIMARY KEY (id);


--
-- Name: faq_questions faq_questions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.faq_questions
    ADD CONSTRAINT faq_questions_pkey PRIMARY KEY (id);


--
-- Name: lalala_files lalala_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.lalala_files
    ADD CONSTRAINT lalala_files_pkey PRIMARY KEY (id);


--
-- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.migrations
    ADD CONSTRAINT migrations_pkey PRIMARY KEY (id);


--
-- Name: paddle_webhooks_events paddle_webhooks_events_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.paddle_webhooks_events
    ADD CONSTRAINT paddle_webhooks_events_pkey PRIMARY KEY (id);


--
-- Name: plan_overrides plan_overrides_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.plan_overrides
    ADD CONSTRAINT plan_overrides_pkey PRIMARY KEY (id);


--
-- Name: plans plans_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.plans
    ADD CONSTRAINT plans_pkey PRIMARY KEY (id);


--
-- Name: preset_tags preset_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.preset_tags
    ADD CONSTRAINT preset_tags_pkey PRIMARY KEY (id);


--
-- Name: preset_tags preset_tags_preset_id_category_value_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.preset_tags
    ADD CONSTRAINT preset_tags_preset_id_category_value_key UNIQUE (preset_id, category, value);


--
-- Name: presets presets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.presets
    ADD CONSTRAINT presets_pkey PRIMARY KEY (id);


--
-- Name: presets presets_uuid_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.presets
    ADD CONSTRAINT presets_uuid_key UNIQUE (uuid);


--
-- Name: project_samples project_samples_project_id_sample_id_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.project_samples
    ADD CONSTRAINT project_samples_project_id_sample_id_key UNIQUE (project_id, sample_id);


--
-- Name: project_tags project_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.project_tags
    ADD CONSTRAINT project_tags_pkey PRIMARY KEY (id);


--
-- Name: projects project_uuids_same_implies_user_id_same; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.projects
    ADD CONSTRAINT project_uuids_same_implies_user_id_same EXCLUDE USING gist (uuid WITH =, user_id WITH <>);


--
-- Name: projects projects_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.projects
    ADD CONSTRAINT projects_pkey PRIMARY KEY (id);


--
-- Name: sample_derivations sample_derivations_sample_id_derived_from_id_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.sample_derivations
    ADD CONSTRAINT sample_derivations_sample_id_derived_from_id_key UNIQUE (sample_id, derived_from_id);


--
-- Name: sample_packs sample_packs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.sample_packs
    ADD CONSTRAINT sample_packs_pkey PRIMARY KEY (id);


--
-- Name: sample_packs sample_packs_uuid_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.sample_packs
    ADD CONSTRAINT sample_packs_uuid_key UNIQUE (uuid);


--
-- Name: sample_tags sample_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.sample_tags
    ADD CONSTRAINT sample_tags_pkey PRIMARY KEY (id);


--
-- Name: sample_tags sample_tags_sample_id_category_value_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.sample_tags
    ADD CONSTRAINT sample_tags_sample_id_category_value_key UNIQUE (sample_id, category, value);


--
-- Name: sample_voice_conversion_models sample_voice_conversion_model_sample_id_voice_conversion_mo_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.sample_voice_conversion_models
    ADD CONSTRAINT sample_voice_conversion_model_sample_id_voice_conversion_mo_key UNIQUE (sample_id, voice_conversion_model_id);


--
-- Name: samples samples_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.samples
    ADD CONSTRAINT samples_pkey PRIMARY KEY (id);


--
-- Name: samples samples_uuid_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.samples
    ADD CONSTRAINT samples_uuid_key UNIQUE (uuid);


--
-- Name: sendgrid_events sendgrid_events_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.sendgrid_events
    ADD CONSTRAINT sendgrid_events_pkey PRIMARY KEY (id);


--
-- Name: sendgrid_sync_jobs sendgrid_sync_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.sendgrid_sync_jobs
    ADD CONSTRAINT sendgrid_sync_jobs_pkey PRIMARY KEY (id);


--
-- Name: service_quotas service_quotas_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.service_quotas
    ADD CONSTRAINT service_quotas_pkey PRIMARY KEY (id);


--
-- Name: shared_tracks_plays shared_tracks_plays_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.shared_tracks_plays
    ADD CONSTRAINT shared_tracks_plays_pkey PRIMARY KEY (id);


--
-- Name: short_urls short_urls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.short_urls
    ADD CONSTRAINT short_urls_pkey PRIMARY KEY (id);


--
-- Name: short_urls short_urls_short_code_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.short_urls
    ADD CONSTRAINT short_urls_short_code_key UNIQUE (short_code);


--
-- Name: typeform_signup_surveys signup_surveys_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.typeform_signup_surveys
    ADD CONSTRAINT signup_surveys_pkey PRIMARY KEY (id);


--
-- Name: subscription_cancellation_details subscription_cancellation_details_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.subscription_cancellation_details
    ADD CONSTRAINT subscription_cancellation_details_pkey PRIMARY KEY (id);


--
-- Name: subscription_updates subscription_updates_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.subscription_updates
    ADD CONSTRAINT subscription_updates_pkey PRIMARY KEY (id);


--
-- Name: track_preset_tags track_preset_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.track_preset_tags
    ADD CONSTRAINT track_preset_tags_pkey PRIMARY KEY (id);


--
-- Name: track_presets track_presets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.track_presets
    ADD CONSTRAINT track_presets_pkey PRIMARY KEY (id);


--
-- Name: tracks_for_sharing tracks_for_sharing_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.tracks_for_sharing
    ADD CONSTRAINT tracks_for_sharing_pkey PRIMARY KEY (id);


--
-- Name: tracks_for_sharing tracks_for_sharing_uuid_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.tracks_for_sharing
    ADD CONSTRAINT tracks_for_sharing_uuid_key UNIQUE (uuid);


--
-- Name: voice_conversion_training_script_samples unique_training_script_sample; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.voice_conversion_training_script_samples
    ADD CONSTRAINT unique_training_script_sample PRIMARY KEY (training_script_id, sample_id);


--
-- Name: user_deletion_requests user_deletion_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.user_deletion_requests
    ADD CONSTRAINT user_deletion_requests_pkey PRIMARY KEY (id);


--
-- Name: user_email_cold_storage user_email_cold_storage_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.user_email_cold_storage
    ADD CONSTRAINT user_email_cold_storage_pkey PRIMARY KEY (id);


--
-- Name: user_engagement_score user_engagement_score_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.user_engagement_score
    ADD CONSTRAINT user_engagement_score_pkey PRIMARY KEY (id);


--
-- Name: user_engagement_score user_engagement_score_user_id_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.user_engagement_score
    ADD CONSTRAINT user_engagement_score_user_id_key UNIQUE (user_id);


--
-- Name: user_identities user_identities_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.user_identities
    ADD CONSTRAINT user_identities_pkey PRIMARY KEY (id);


--
-- Name: users users_email_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.users
    ADD CONSTRAINT users_email_key UNIQUE (email);


--
-- Name: users users_normalized_email_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.users
    ADD CONSTRAINT users_normalized_email_key UNIQUE (normalized_email);


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

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


--
-- Name: voice_conversion_model_corpus voice_conversion_model_corpus_model_id_sample_id_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.voice_conversion_model_corpus
    ADD CONSTRAINT voice_conversion_model_corpus_model_id_sample_id_key UNIQUE (model_id, sample_id);


--
-- Name: voice_conversion_model_training_runs voice_conversion_model_training_runs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.voice_conversion_model_training_runs
    ADD CONSTRAINT voice_conversion_model_training_runs_pkey PRIMARY KEY (id);


--
-- Name: voice_conversion_models voice_conversion_models_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.voice_conversion_models
    ADD CONSTRAINT voice_conversion_models_pkey PRIMARY KEY (id);


--
-- Name: voice_conversion_models voice_conversion_models_uuid_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.voice_conversion_models
    ADD CONSTRAINT voice_conversion_models_uuid_key UNIQUE (uuid);


--
-- Name: voice_conversion_training_scripts voice_conversion_training_scripts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.voice_conversion_training_scripts
    ADD CONSTRAINT voice_conversion_training_scripts_pkey PRIMARY KEY (id);


--
-- Name: waiting_list_signups waiting_list_signups_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.waiting_list_signups
    ADD CONSTRAINT waiting_list_signups_pkey PRIMARY KEY (id);


--
-- Name: wavtool_standup_summaries wavtool_standup_summaries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.wavtool_standup_summaries
    ADD CONSTRAINT wavtool_standup_summaries_pkey PRIMARY KEY (id);


--
-- Name: wavtool_standups wavtool_standups_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.wavtool_standups
    ADD CONSTRAINT wavtool_standups_pkey PRIMARY KEY (id);


--
-- Name: welcome_survey_answers welcome_survey_answers_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.welcome_survey_answers
    ADD CONSTRAINT welcome_survey_answers_pkey PRIMARY KEY (id);


--
-- Name: zoho_sync_status zoho_sync_status_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.zoho_sync_status
    ADD CONSTRAINT zoho_sync_status_pkey PRIMARY KEY (id);


--
-- Name: zoho_tokens zoho_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.zoho_tokens
    ADD CONSTRAINT zoho_tokens_pkey PRIMARY KEY (id);


--
-- Name: activity_action_created_at_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX activity_action_created_at_user_id_id_idx ON public.activity USING btree (action, created_at, user_id, id);


--
-- Name: activity_action_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX activity_action_user_id_id_idx ON public.activity USING btree (action, user_id, id);


--
-- Name: activity_timestamp_user_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX activity_timestamp_user_id_idx ON public.activity USING btree (created_at, user_id);


--
-- Name: activity_user_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX activity_user_id_idx ON public.activity USING btree (user_id);


--
-- Name: composer_requests_created_at_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX composer_requests_created_at_idx ON public.composer_requests USING btree (created_at);


--
-- Name: composer_requests_created_at_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX composer_requests_created_at_user_id_id_idx ON public.composer_requests USING btree (created_at, user_id, id);


--
-- Name: composer_requests_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX composer_requests_user_id_id_idx ON public.composer_requests USING btree (user_id, id);


--
-- Name: composer_requests_user_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX composer_requests_user_id_idx ON public.composer_requests USING btree (user_id);


--
-- Name: conductor_requests_created_at_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX conductor_requests_created_at_user_id_id_idx ON public.conductor_requests USING btree (created_at, user_id, id);


--
-- Name: conductor_requests_timestamp_user_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX conductor_requests_timestamp_user_id_idx ON public.conductor_requests USING btree (created_at, user_id);


--
-- Name: conductor_requests_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX conductor_requests_user_id_id_idx ON public.conductor_requests USING btree (user_id, id);


--
-- Name: conductor_requests_user_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX conductor_requests_user_id_idx ON public.conductor_requests USING btree (user_id);


--
-- Name: device_tags_device_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX device_tags_device_id_idx ON public.device_tags USING btree (device_id);


--
-- Name: devices_author_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX devices_author_id_idx ON public.devices USING btree (author_id);


--
-- Name: email_index; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX email_index ON public.email_verifications USING btree (email);


--
-- Name: plan_override_email_index; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX plan_override_email_index ON public.plan_overrides USING btree (email);


--
-- Name: presets_author_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX presets_author_id_idx ON public.presets USING btree (author_id);


--
-- Name: presets_device_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX presets_device_id_idx ON public.presets USING btree (device_id);


--
-- Name: project_samples_sample_id_project_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX project_samples_sample_id_project_id_idx ON public.project_samples USING btree (sample_id, project_id);


--
-- Name: projects_live_created_at_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX projects_live_created_at_user_id_id_idx ON public.projects USING btree (created_at, user_id, id) WHERE ((superseded_by IS NULL) AND (is_deleted = false));


--
-- Name: projects_live_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX projects_live_user_id_id_idx ON public.projects USING btree (user_id, id) WHERE ((superseded_by IS NULL) AND (is_deleted = false));


--
-- Name: projects_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX projects_user_id_id_idx ON public.projects USING btree (user_id, id);


--
-- Name: projects_uuid_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX projects_uuid_idx ON public.projects USING btree (uuid);


--
-- Name: sample_packs_author_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX sample_packs_author_id_idx ON public.sample_packs USING btree (author_id);


--
-- Name: samples_author_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX samples_author_id_idx ON public.samples USING btree (author_id);


--
-- Name: samples_cache_key_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX samples_cache_key_idx ON public.samples USING btree (cache_key);


--
-- Name: samples_pack_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX samples_pack_id_idx ON public.samples USING btree (pack_id);


--
-- Name: samples_tags_sample_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX samples_tags_sample_id_idx ON public.sample_tags USING btree (sample_id);


--
-- Name: service_quotas_timestamp_user_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX service_quotas_timestamp_user_id_idx ON public.service_quotas USING btree (created_at, user_id);


--
-- Name: shared_tracks_plays_track_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX shared_tracks_plays_track_id_idx ON public.shared_tracks_plays USING btree (track_id);


--
-- Name: signup_surveys_user_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX signup_surveys_user_id_idx ON public.typeform_signup_surveys USING btree (user_id);


--
-- Name: subscription_updates_user_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX subscription_updates_user_id_idx ON public.subscription_updates USING btree (user_id);


--
-- Name: track_preset_tags_preset_id_category_value_key; Type: INDEX; Schema: public; Owner: -
--

CREATE UNIQUE INDEX track_preset_tags_preset_id_category_value_key ON public.track_preset_tags USING btree (track_preset_id, category, value);


--
-- Name: tracks_for_sharing_author_id_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX tracks_for_sharing_author_id_id_idx ON public.tracks_for_sharing USING btree (author_id, id);


--
-- Name: tracks_for_sharing_author_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX tracks_for_sharing_author_id_idx ON public.tracks_for_sharing USING btree (author_id);


--
-- Name: tracks_for_sharing_created_at_author_id_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX tracks_for_sharing_created_at_author_id_id_idx ON public.tracks_for_sharing USING btree (created_at, author_id, id);


--
-- Name: user_identities_iss_ext_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX user_identities_iss_ext_id_idx ON public.user_identities USING btree (issuer, external_id);


--
-- Name: user_identities_user_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX user_identities_user_id_idx ON public.user_identities USING btree (user_id);


--
-- Name: users_stripe_customer_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX users_stripe_customer_id_idx ON public.users USING btree (stripe_customer_id);


--
-- Name: voice_conversion_model_training_runs_model_id_idx; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX voice_conversion_model_training_runs_model_id_idx ON public.voice_conversion_model_training_runs USING btree (model_id);


--
-- Name: voice_conversion_models_author_id_name_uq; Type: INDEX; Schema: public; Owner: -
--

CREATE UNIQUE INDEX voice_conversion_models_author_id_name_uq ON public.voice_conversion_models USING btree (author_id, name) WHERE ((author_id IS NOT NULL) AND (NOT archived));


--
-- Name: voice_conversion_models_no_author_id_name_uq; Type: INDEX; Schema: public; Owner: -
--

CREATE UNIQUE INDEX voice_conversion_models_no_author_id_name_uq ON public.voice_conversion_models USING btree (name) WHERE ((author_id IS NULL) AND (NOT archived));


--
-- Name: user_engagement_score conditional_set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER conditional_set_timestamp BEFORE UPDATE ON public.user_engagement_score FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column_user_engagement();


--
-- Name: users delete_email_verification_trigger; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER delete_email_verification_trigger AFTER DELETE ON public.users FOR EACH ROW EXECUTE FUNCTION public.delete_email_verification();


--
-- Name: activity set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.activity FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: app_features set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.app_features FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: composer_choices set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.composer_choices FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: composer_requests set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.composer_requests FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: conductor_requests set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.conductor_requests FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: config_vals set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.config_vals FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: device_tags set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.device_tags FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: devices set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.devices FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: email_verifications set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.email_verifications FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: embedded_strings set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.embedded_strings FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: faq_answers set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.faq_answers FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: faq_questions set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.faq_questions FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: lalala_files set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.lalala_files FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: migrations set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.migrations FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: plan_overrides set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.plan_overrides FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: plans set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.plans FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: preset_tags set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.preset_tags FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: presets set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.presets FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: projects set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.projects FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: sample_derivations set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.sample_derivations FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: sample_packs set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.sample_packs FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: sample_tags set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.sample_tags FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: sample_voice_conversion_models set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.sample_voice_conversion_models FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: samples set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.samples FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: sendgrid_sync_jobs set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.sendgrid_sync_jobs FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: service_quotas set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.service_quotas FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: shared_tracks_plays set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.shared_tracks_plays FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: subscription_updates set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.subscription_updates FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: track_preset_tags set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.track_preset_tags FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: track_presets set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.track_presets FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: tracks_for_sharing set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.tracks_for_sharing FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: typeform_signup_surveys set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.typeform_signup_surveys FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: user_email_cold_storage set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.user_email_cold_storage FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: user_identities set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.user_identities FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: users set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

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


--
-- Name: voice_conversion_model_training_runs set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.voice_conversion_model_training_runs FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: voice_conversion_models set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.voice_conversion_models FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: voice_conversion_training_scripts set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.voice_conversion_training_scripts FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: waiting_list_signups set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.waiting_list_signups FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: wavtool_standups set_timestamp; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.wavtool_standups FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: activity activity_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.activity
    ADD CONSTRAINT activity_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: composer_choices composer_choices_request_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.composer_choices
    ADD CONSTRAINT composer_choices_request_id_fkey FOREIGN KEY (request_id) REFERENCES public.composer_requests(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: composer_requests composer_requests_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.composer_requests
    ADD CONSTRAINT composer_requests_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: conductor_request_tags conductor_request_tags_conductor_request_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.conductor_request_tags
    ADD CONSTRAINT conductor_request_tags_conductor_request_id_fkey FOREIGN KEY (conductor_request_id) REFERENCES public.conductor_requests(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: conductor_requests conductor_requests_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.conductor_requests
    ADD CONSTRAINT conductor_requests_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: device_tags device_tags_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.device_tags
    ADD CONSTRAINT device_tags_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: devices devices_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.devices
    ADD CONSTRAINT devices_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- Name: devices devices_superseded_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.devices
    ADD CONSTRAINT devices_superseded_by_fkey FOREIGN KEY (superseded_by) REFERENCES public.devices(id) ON UPDATE CASCADE ON DELETE SET NULL;


--
-- Name: faq_questions faq_questions_answer_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.faq_questions
    ADD CONSTRAINT faq_questions_answer_id_fkey FOREIGN KEY (answer_id) REFERENCES public.faq_answers(id);


--
-- Name: lalala_files lalala_files_sample_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.lalala_files
    ADD CONSTRAINT lalala_files_sample_id_fkey FOREIGN KEY (sample_id) REFERENCES public.samples(id);


--
-- Name: paddle_webhooks_events paddle_webhooks_events_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.paddle_webhooks_events
    ADD CONSTRAINT paddle_webhooks_events_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);


--
-- Name: plan_app_features plan_app_features_app_feature_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.plan_app_features
    ADD CONSTRAINT plan_app_features_app_feature_id_fkey FOREIGN KEY (app_feature_id) REFERENCES public.app_features(id);


--
-- Name: plan_app_features plan_app_features_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.plan_app_features
    ADD CONSTRAINT plan_app_features_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id);


--
-- Name: plan_overrides plan_overrides_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.plan_overrides
    ADD CONSTRAINT plan_overrides_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: preset_tags preset_tags_preset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.preset_tags
    ADD CONSTRAINT preset_tags_preset_id_fkey FOREIGN KEY (preset_id) REFERENCES public.presets(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: presets presets_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.presets
    ADD CONSTRAINT presets_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- Name: presets presets_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.presets
    ADD CONSTRAINT presets_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- Name: presets presets_superseded_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.presets
    ADD CONSTRAINT presets_superseded_by_fkey FOREIGN KEY (superseded_by) REFERENCES public.presets(id) ON UPDATE CASCADE ON DELETE SET NULL;


--
-- Name: project_samples project_samples_project_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.project_samples
    ADD CONSTRAINT project_samples_project_id_fkey FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;


--
-- Name: project_samples project_samples_sample_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.project_samples
    ADD CONSTRAINT project_samples_sample_id_fkey FOREIGN KEY (sample_id) REFERENCES public.samples(id) ON DELETE RESTRICT;


--
-- Name: project_tags project_tags_project_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.project_tags
    ADD CONSTRAINT project_tags_project_id_fkey FOREIGN KEY (project_id) REFERENCES public.projects(id);


--
-- Name: projects projects_remix_of_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.projects
    ADD CONSTRAINT projects_remix_of_id_fkey FOREIGN KEY (remix_of_id) REFERENCES public.projects(id) ON DELETE SET NULL;


--
-- Name: projects projects_superseded_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.projects
    ADD CONSTRAINT projects_superseded_by_fkey FOREIGN KEY (superseded_by) REFERENCES public.projects(id);


--
-- Name: projects projects_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.projects
    ADD CONSTRAINT projects_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);


--
-- Name: sample_derivations sample_derivations_derived_from_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.sample_derivations
    ADD CONSTRAINT sample_derivations_derived_from_id_fkey FOREIGN KEY (derived_from_id) REFERENCES public.samples(id) ON DELETE RESTRICT;


--
-- Name: sample_derivations sample_derivations_sample_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.sample_derivations
    ADD CONSTRAINT sample_derivations_sample_id_fkey FOREIGN KEY (sample_id) REFERENCES public.samples(id) ON DELETE CASCADE;


--
-- Name: sample_packs sample_packs_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.sample_packs
    ADD CONSTRAINT sample_packs_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- Name: sample_tags sample_tags_sample_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.sample_tags
    ADD CONSTRAINT sample_tags_sample_id_fkey FOREIGN KEY (sample_id) REFERENCES public.samples(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: sample_voice_conversion_models sample_voice_conversion_models_sample_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.sample_voice_conversion_models
    ADD CONSTRAINT sample_voice_conversion_models_sample_id_fkey FOREIGN KEY (sample_id) REFERENCES public.samples(id) ON DELETE CASCADE;


--
-- Name: sample_voice_conversion_models sample_voice_conversion_models_voice_conversion_model_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.sample_voice_conversion_models
    ADD CONSTRAINT sample_voice_conversion_models_voice_conversion_model_id_fkey FOREIGN KEY (voice_conversion_model_id) REFERENCES public.voice_conversion_models(id) ON DELETE RESTRICT;


--
-- Name: samples samples_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.samples
    ADD CONSTRAINT samples_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- Name: samples samples_pack_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.samples
    ADD CONSTRAINT samples_pack_id_fkey FOREIGN KEY (pack_id) REFERENCES public.sample_packs(id) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- Name: sendgrid_events sendgrid_events_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.sendgrid_events
    ADD CONSTRAINT sendgrid_events_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: service_quotas service_quotas_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.service_quotas
    ADD CONSTRAINT service_quotas_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: shared_tracks_plays shared_tracks_plays_track_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.shared_tracks_plays
    ADD CONSTRAINT shared_tracks_plays_track_id_fkey FOREIGN KEY (track_id) REFERENCES public.tracks_for_sharing(id) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- Name: shared_tracks_plays shared_tracks_plays_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.shared_tracks_plays
    ADD CONSTRAINT shared_tracks_plays_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- Name: short_url_clicks short_url_clicks_short_url_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.short_url_clicks
    ADD CONSTRAINT short_url_clicks_short_url_id_fkey FOREIGN KEY (short_url_id) REFERENCES public.short_urls(id);


--
-- Name: short_urls short_urls_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.short_urls
    ADD CONSTRAINT short_urls_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: typeform_signup_surveys signup_surveys_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.typeform_signup_surveys
    ADD CONSTRAINT signup_surveys_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: subscription_cancellation_details subscription_cancellation_details_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.subscription_cancellation_details
    ADD CONSTRAINT subscription_cancellation_details_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: subscription_updates subscription_updates_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.subscription_updates
    ADD CONSTRAINT subscription_updates_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plans(id);


--
-- Name: subscription_updates subscription_updates_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.subscription_updates
    ADD CONSTRAINT subscription_updates_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: track_preset_tags track_preset_tags_track_preset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.track_preset_tags
    ADD CONSTRAINT track_preset_tags_track_preset_id_fkey FOREIGN KEY (track_preset_id) REFERENCES public.track_presets(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: tracks_for_sharing tracks_for_sharing_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.tracks_for_sharing
    ADD CONSTRAINT tracks_for_sharing_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE RESTRICT;


--
-- Name: tracks_for_sharing tracks_for_sharing_project_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.tracks_for_sharing
    ADD CONSTRAINT tracks_for_sharing_project_id_fkey FOREIGN KEY (project_id) REFERENCES public.projects(id);


--
-- Name: user_deletion_requests user_deletion_requests_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.user_deletion_requests
    ADD CONSTRAINT user_deletion_requests_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: user_email_cold_storage user_email_cold_storage_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.user_email_cold_storage
    ADD CONSTRAINT user_email_cold_storage_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: user_engagement_score user_engagement_score_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.user_engagement_score
    ADD CONSTRAINT user_engagement_score_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: user_identities user_identities_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.user_identities
    ADD CONSTRAINT user_identities_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: voice_conversion_model_corpus voice_conversion_model_corpus_model_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.voice_conversion_model_corpus
    ADD CONSTRAINT voice_conversion_model_corpus_model_id_fkey FOREIGN KEY (model_id) REFERENCES public.voice_conversion_models(id);


--
-- Name: voice_conversion_model_corpus voice_conversion_model_corpus_sample_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.voice_conversion_model_corpus
    ADD CONSTRAINT voice_conversion_model_corpus_sample_id_fkey FOREIGN KEY (sample_id) REFERENCES public.samples(id);


--
-- Name: voice_conversion_model_training_runs voice_conversion_model_training_runs_model_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.voice_conversion_model_training_runs
    ADD CONSTRAINT voice_conversion_model_training_runs_model_id_fkey FOREIGN KEY (model_id) REFERENCES public.voice_conversion_models(id);


--
-- Name: voice_conversion_models voice_conversion_models_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.voice_conversion_models
    ADD CONSTRAINT voice_conversion_models_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);


--
-- Name: voice_conversion_training_script_samples voice_conversion_training_script_sample_training_script_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.voice_conversion_training_script_samples
    ADD CONSTRAINT voice_conversion_training_script_sample_training_script_id_fkey FOREIGN KEY (training_script_id) REFERENCES public.voice_conversion_training_scripts(id) ON DELETE CASCADE;


--
-- Name: voice_conversion_training_script_samples voice_conversion_training_script_samples_sample_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.voice_conversion_training_script_samples
    ADD CONSTRAINT voice_conversion_training_script_samples_sample_id_fkey FOREIGN KEY (sample_id) REFERENCES public.samples(id) ON DELETE CASCADE;


--
-- Name: voice_conversion_training_scripts voice_conversion_training_scripts_model_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.voice_conversion_training_scripts
    ADD CONSTRAINT voice_conversion_training_scripts_model_id_fkey FOREIGN KEY (model_id) REFERENCES public.voice_conversion_models(id);


--
-- Name: voice_conversion_training_scripts voice_conversion_training_scripts_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.voice_conversion_training_scripts
    ADD CONSTRAINT voice_conversion_training_scripts_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);


--
-- Name: wavtool_standups wavtool_standups_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.wavtool_standups
    ADD CONSTRAINT wavtool_standups_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: welcome_survey_answers welcome_survey_answers_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.welcome_survey_answers
    ADD CONSTRAINT welcome_survey_answers_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- Name: zoho_sync_status zoho_sync_status_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.zoho_sync_status
    ADD CONSTRAINT zoho_sync_status_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE RESTRICT ON DELETE CASCADE;


--
-- PostgreSQL database dump complete
--

