



--
-- Name: activity_logs; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.activity_logs (
    id integer NOT NULL,
    user_id integer NOT NULL,
    workspace_id integer,
    action character varying(255) NOT NULL,
    resource_type character varying(100),
    resource_id integer,
    resource_name character varying(255),
    created_at timestamp without time zone
);


ALTER TABLE public.activity_logs OWNER TO postgres;

--
-- Name: activity_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.activity_logs_id_seq OWNER TO postgres;

--
-- Name: activity_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.activity_logs_id_seq OWNED BY public.activity_logs.id;


--
-- Name: ad_audit_logs; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.ad_audit_logs (
    id integer NOT NULL,
    user_id integer,
    admin_id integer,
    ad_campaign_id integer,
    action character varying(50) NOT NULL,
    details_json json,
    created_at timestamp without time zone
);


ALTER TABLE public.ad_audit_logs OWNER TO postgres;

--
-- Name: ad_audit_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.ad_audit_logs_id_seq OWNER TO postgres;

--
-- Name: ad_audit_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.ad_audit_logs_id_seq OWNED BY public.ad_audit_logs.id;


--
-- Name: ad_budget_wallet; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.ad_budget_wallet (
    id integer NOT NULL,
    total_budget double precision,
    total_spent double precision,
    currency character varying(10),
    updated_by integer,
    updated_at timestamp without time zone
);


ALTER TABLE public.ad_budget_wallet OWNER TO postgres;

--
-- Name: ad_budget_wallet_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.ad_budget_wallet_id_seq OWNER TO postgres;

--
-- Name: ad_budget_wallet_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.ad_budget_wallet_id_seq OWNED BY public.ad_budget_wallet.id;


--
-- Name: ad_campaign_metrics; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.ad_campaign_metrics (
    id integer NOT NULL,
    ad_campaign_id integer NOT NULL,
    platform character varying(50) NOT NULL,
    date date NOT NULL,
    impressions integer,
    views integer,
    clicks integer,
    ctr double precision,
    spend double precision,
    cost_per_view double precision,
    cost_per_click double precision,
    likes integer,
    comments integer,
    shares integer,
    conversions integer,
    reach integer,
    frequency double precision,
    fetched_at timestamp without time zone
);


ALTER TABLE public.ad_campaign_metrics OWNER TO postgres;

--
-- Name: ad_campaign_metrics_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.ad_campaign_metrics_id_seq OWNER TO postgres;

--
-- Name: ad_campaign_metrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.ad_campaign_metrics_id_seq OWNED BY public.ad_campaign_metrics.id;


--
-- Name: ad_campaigns; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.ad_campaigns (
    id integer NOT NULL,
    user_id integer NOT NULL,
    campaign_id integer,
    name character varying(500) NOT NULL,
    platforms_json json,
    budget_amount double precision,
    daily_budget double precision,
    duration_days integer,
    start_date timestamp without time zone,
    end_date timestamp without time zone,
    targeting_json json,
    ai_suggestions_json json,
    ad_caption text,
    ad_cta character varying(100),
    status character varying(50),
    admin_notes text,
    rejection_reason text,
    reviewed_by integer,
    reviewed_at timestamp without time zone,
    platform_ids_json json,
    created_at timestamp without time zone,
    updated_at timestamp without time zone
);


ALTER TABLE public.ad_campaigns OWNER TO postgres;

--
-- Name: ad_campaigns_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.ad_campaigns_id_seq OWNER TO postgres;

--
-- Name: ad_campaigns_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.ad_campaigns_id_seq OWNED BY public.ad_campaigns.id;

--
-- Name: admin_ad_accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.admin_ad_accounts_id_seq OWNER TO postgres;

--
-- Name: admin_ad_accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.admin_ad_accounts_id_seq OWNED BY public.admin_ad_accounts.id;


--
-- Name: advisor_chats; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.advisor_chats (
    id integer NOT NULL,
    report_id integer NOT NULL,
    user_id integer NOT NULL,
    role character varying(20) NOT NULL,
    content text NOT NULL,
    created_at timestamp without time zone
);


ALTER TABLE public.advisor_chats OWNER TO postgres;

--
-- Name: advisor_chats_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.advisor_chats_id_seq OWNER TO postgres;

--
-- Name: advisor_chats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.advisor_chats_id_seq OWNED BY public.advisor_chats.id;

--
-- Name: ai_model_configs_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.ai_model_configs_id_seq OWNER TO postgres;

--
-- Name: ai_model_configs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.ai_model_configs_id_seq OWNED BY public.ai_model_configs.id;

--
-- Name: api_keys_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.api_keys_id_seq OWNER TO postgres;

--
-- Name: api_keys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.api_keys_id_seq OWNED BY public.api_keys.id;


--
-- Name: audit_logs; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.audit_logs (
    id integer NOT NULL,
    user_id integer,
    action character varying(255) NOT NULL,
    resource_type character varying(100),
    resource_id integer,
    details json,
    ip_address character varying(45),
    created_at timestamp without time zone
);


ALTER TABLE public.audit_logs OWNER TO postgres;

--
-- Name: audit_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.audit_logs_id_seq OWNER TO postgres;

--
-- Name: audit_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.audit_logs_id_seq OWNED BY public.audit_logs.id;


--
-- Name: background_tasks; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.background_tasks (
    id integer NOT NULL,
    user_id integer NOT NULL,
    task_type character varying(100) NOT NULL,
    task_id character varying(255) NOT NULL,
    status character varying(50),
    result_json json,
    error_message text,
    progress integer,
    created_at timestamp without time zone,
    completed_at timestamp without time zone
);


ALTER TABLE public.background_tasks OWNER TO postgres;

--
-- Name: background_tasks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.background_tasks_id_seq OWNER TO postgres;

--
-- Name: background_tasks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.background_tasks_id_seq OWNED BY public.background_tasks.id;


--
-- Name: campaign_metrics; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.campaign_metrics (
    id integer NOT NULL,
    post_id integer NOT NULL,
    views integer,
    likes integer,
    comments integer,
    shares integer,
    ctr double precision,
    fetched_at timestamp without time zone
);


ALTER TABLE public.campaign_metrics OWNER TO postgres;

--
-- Name: campaign_metrics_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.campaign_metrics_id_seq OWNER TO postgres;

--
-- Name: campaign_metrics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.campaign_metrics_id_seq OWNED BY public.campaign_metrics.id;


--
-- Name: campaign_posts; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.campaign_posts (
    id integer NOT NULL,
    campaign_id integer NOT NULL,
    platform character varying(50) NOT NULL,
    publish_mode character varying(20),
    post_id character varying(255),
    post_url text,
    caption text,
    scheduled_at timestamp without time zone,
    published_at timestamp without time zone,
    status character varying(50)
);


ALTER TABLE public.campaign_posts OWNER TO postgres;

--
-- Name: campaign_posts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.campaign_posts_id_seq OWNER TO postgres;

--
-- Name: campaign_posts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.campaign_posts_id_seq OWNED BY public.campaign_posts.id;


--
-- Name: campaigns; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.campaigns (
    id integer NOT NULL,
    user_id integer NOT NULL,
    report_id integer,
    name character varying(500) NOT NULL,
    video_url text,
    video_id character varying(255),
    video_provider character varying(50),
    script text,
    storyboard_json json,
    user_script_notes text,
    video_duration integer,
    status character varying(50),
    created_at timestamp without time zone
);


ALTER TABLE public.campaigns OWNER TO postgres;

--
-- Name: campaigns_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.campaigns_id_seq OWNER TO postgres;

--
-- Name: campaigns_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.campaigns_id_seq OWNED BY public.campaigns.id;

--
-- Name: chat_messages_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.chat_messages_id_seq OWNER TO postgres;

--
-- Name: chat_messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.chat_messages_id_seq OWNED BY public.chat_messages.id;


--
-- Name: cofounder_profiles; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.cofounder_profiles (
    id integer NOT NULL,
    user_id integer NOT NULL,
    skills json,
    interests json,
    experience_years integer,
    bio text,
    looking_for text,
    city character varying(100),
    is_visible boolean,
    created_at timestamp without time zone
);


ALTER TABLE public.cofounder_profiles OWNER TO postgres;

--
-- Name: cofounder_profiles_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.cofounder_profiles_id_seq OWNER TO postgres;

--
-- Name: cofounder_profiles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.cofounder_profiles_id_seq OWNED BY public.cofounder_profiles.id;


--
-- Name: company_registrations; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.company_registrations (
    id integer NOT NULL,
    user_id integer NOT NULL,
    report_id integer,
    company_name_ar character varying(500) NOT NULL,
    company_name_en character varying(500),
    entity_type character varying(100) NOT NULL,
    country character varying(100),
    capital numeric(15,2),
    activities_json json,
    owners_json json,
    required_licenses_json json,
    ai_legal_advice text,
    wathq_cr_number character varying(50),
    misa_license_number character varying(50),
    status character varying(50),
    created_at timestamp without time zone
);


ALTER TABLE public.company_registrations OWNER TO postgres;

--
-- Name: company_registrations_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.company_registrations_id_seq OWNER TO postgres;

--
-- Name: company_registrations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.company_registrations_id_seq OWNED BY public.company_registrations.id;


--
-- Name: competitor_monitors; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.competitor_monitors (
    id integer NOT NULL,
    user_id integer NOT NULL,
    report_id integer NOT NULL,
    competitor_url character varying(1000) NOT NULL,
    last_snapshot json,
    last_checked timestamp without time zone,
    changes_detected integer,
    is_active boolean,
    created_at timestamp without time zone
);


ALTER TABLE public.competitor_monitors OWNER TO postgres;

--
-- Name: competitor_monitors_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.competitor_monitors_id_seq OWNER TO postgres;

--
-- Name: competitor_monitors_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.competitor_monitors_id_seq OWNED BY public.competitor_monitors.id;


--
-- Name: factory_partners; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.factory_partners (
    id integer NOT NULL,
    name character varying(500) NOT NULL,
    name_ar character varying(500),
    country character varying(100),
    city character varying(200),
    website_url text,
    email character varying(255),
    phone character varying(50),
    sectors_json json,
    capabilities_json json,
    min_order integer,
    logo_url text,
    description text,
    description_ar text,
    user_id integer,
    is_verified boolean,
    is_active boolean,
    created_at timestamp without time zone
);


ALTER TABLE public.factory_partners OWNER TO postgres;

--
-- Name: factory_partners_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.factory_partners_id_seq OWNER TO postgres;

--
-- Name: factory_partners_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.factory_partners_id_seq OWNED BY public.factory_partners.id;


--
-- Name: gamma_presentations; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.gamma_presentations (
    id integer NOT NULL,
    user_id integer NOT NULL,
    report_id integer NOT NULL,
    gamma_id character varying(255),
    gamma_url text,
    format_type character varying(50),
    theme character varying(100),
    status character varying(50),
    error_message text,
    created_at timestamp without time zone
);


ALTER TABLE public.gamma_presentations OWNER TO postgres;

--
-- Name: gamma_presentations_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.gamma_presentations_id_seq OWNER TO postgres;

--
-- Name: gamma_presentations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.gamma_presentations_id_seq OWNED BY public.gamma_presentations.id;


--
-- Name: grants; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.grants (
    id integer NOT NULL,
    name character varying(255) NOT NULL,
    name_ar character varying(255),
    provider character varying(255) NOT NULL,
    country character varying(100),
    sector character varying(100),
    max_amount double precision,
    currency character varying(10),
    url character varying(1000),
    description text,
    deadline timestamp without time zone,
    is_active boolean
);


ALTER TABLE public.grants OWNER TO postgres;

--
-- Name: grants_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.grants_id_seq OWNER TO postgres;

--
-- Name: grants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.grants_id_seq OWNED BY public.grants.id;


--
-- Name: incubator_applications; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.incubator_applications (
    id integer NOT NULL,
    user_id integer NOT NULL,
    report_id integer,
    incubator_name character varying(500) NOT NULL,
    incubator_type character varying(100),
    application_data_json json,
    ai_application_text text,
    pitch_summary text,
    status character varying(50),
    submitted_at timestamp without time zone,
    response_status character varying(50),
    created_at timestamp without time zone
);


ALTER TABLE public.incubator_applications OWNER TO postgres;

--
-- Name: incubator_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.incubator_applications_id_seq OWNER TO postgres;

--
-- Name: incubator_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.incubator_applications_id_seq OWNED BY public.incubator_applications.id;

--
-- Name: incubator_partners_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.incubator_partners_id_seq OWNER TO postgres;

--
-- Name: incubator_partners_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.incubator_partners_id_seq OWNED BY public.incubator_partners.id;


--
-- Name: investor_contacts; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.investor_contacts (
    id integer NOT NULL,
    user_id integer NOT NULL,
    report_id integer,
    name character varying(255) NOT NULL,
    company character varying(255),
    email character varying(255),
    phone character varying(50),
    stage character varying(50),
    notes text,
    last_contact timestamp without time zone,
    next_followup timestamp without time zone,
    created_at timestamp without time zone
);


ALTER TABLE public.investor_contacts OWNER TO postgres;

--
-- Name: investor_contacts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.investor_contacts_id_seq OWNER TO postgres;

--
-- Name: investor_contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.investor_contacts_id_seq OWNED BY public.investor_contacts.id;


--
-- Name: kanban_cards; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.kanban_cards (
    id integer NOT NULL,
    user_id integer NOT NULL,
    report_id integer,
    title character varying(255) NOT NULL,
    description text,
    stage character varying(50),
    "position" integer,
    created_at timestamp without time zone
);


ALTER TABLE public.kanban_cards OWNER TO postgres;

--
-- Name: kanban_cards_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.kanban_cards_id_seq OWNER TO postgres;

--
-- Name: kanban_cards_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.kanban_cards_id_seq OWNED BY public.kanban_cards.id;


--
-- Name: kpi_entries; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.kpi_entries (
    id integer NOT NULL,
    kpi_id integer NOT NULL,
    month character varying(7) NOT NULL,
    actual_value double precision NOT NULL,
    notes text,
    created_at timestamp without time zone
);


ALTER TABLE public.kpi_entries OWNER TO postgres;

--
-- Name: kpi_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.kpi_entries_id_seq OWNER TO postgres;

--
-- Name: kpi_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.kpi_entries_id_seq OWNED BY public.kpi_entries.id;


--
-- Name: legal_documents; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.legal_documents (
    id integer NOT NULL,
    user_id integer NOT NULL,
    report_id integer,
    doc_type character varying(100) NOT NULL,
    title character varying(255) NOT NULL,
    content text,
    language character varying(5),
    created_at timestamp without time zone
);


ALTER TABLE public.legal_documents OWNER TO postgres;

--
-- Name: legal_documents_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.legal_documents_id_seq OWNER TO postgres;

--
-- Name: legal_documents_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.legal_documents_id_seq OWNED BY public.legal_documents.id;


--
-- Name: market_alerts; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.market_alerts (
    id integer NOT NULL,
    user_id integer NOT NULL,
    report_id integer NOT NULL,
    alert_type character varying(50) NOT NULL,
    title character varying(255) NOT NULL,
    description text,
    source_url character varying(1000),
    severity character varying(20),
    is_read boolean,
    created_at timestamp without time zone
);


ALTER TABLE public.market_alerts OWNER TO postgres;

--
-- Name: market_alerts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.market_alerts_id_seq OWNER TO postgres;

--
-- Name: market_alerts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.market_alerts_id_seq OWNED BY public.market_alerts.id;


--
-- Name: marketplace_inquiries; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.marketplace_inquiries (
    id integer NOT NULL,
    listing_id integer NOT NULL,
    sender_id integer NOT NULL,
    inquiry_type character varying(30) NOT NULL,
    message text NOT NULL,
    contact_info character varying(500),
    status character varying(20),
    reply_message text,
    created_at timestamp without time zone
);


ALTER TABLE public.marketplace_inquiries OWNER TO postgres;

--
-- Name: marketplace_inquiries_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.marketplace_inquiries_id_seq OWNER TO postgres;

--
-- Name: marketplace_inquiries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.marketplace_inquiries_id_seq OWNED BY public.marketplace_inquiries.id;


--
-- Name: marketplace_listings; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.marketplace_listings (
    id integer NOT NULL,
    report_id integer NOT NULL,
    user_id integer NOT NULL,
    listing_goal character varying(30),
    title character varying(500),
    sector character varying(100),
    price double precision,
    currency character varying(10),
    description text,
    preview_text text,
    investment_needed double precision,
    equity_offered double precision,
    partner_role character varying(500),
    license_terms text,
    contact_email character varying(255),
    cover_image character varying(500),
    approval_status character varying(20),
    admin_notes text,
    featured boolean,
    is_active boolean,
    views integer,
    purchases integer,
    created_at timestamp without time zone
);


ALTER TABLE public.marketplace_listings OWNER TO postgres;

--
-- Name: marketplace_listings_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.marketplace_listings_id_seq OWNER TO postgres;

--
-- Name: marketplace_listings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.marketplace_listings_id_seq OWNED BY public.marketplace_listings.id;

--
-- Name: marketplace_purchases_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.marketplace_purchases_id_seq OWNER TO postgres;

--
-- Name: marketplace_purchases_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.marketplace_purchases_id_seq OWNED BY public.marketplace_purchases.id;


--
-- Name: marketplace_reviews; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.marketplace_reviews (
    id integer NOT NULL,
    listing_id integer NOT NULL,
    purchase_id integer NOT NULL,
    buyer_id integer NOT NULL,
    rating integer NOT NULL,
    comment text,
    created_at timestamp without time zone
);


ALTER TABLE public.marketplace_reviews OWNER TO postgres;

--
-- Name: marketplace_reviews_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.marketplace_reviews_id_seq OWNER TO postgres;

--
-- Name: marketplace_reviews_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.marketplace_reviews_id_seq OWNED BY public.marketplace_reviews.id;


--
-- Name: milestone_tasks; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.milestone_tasks (
    id integer NOT NULL,
    milestone_id integer NOT NULL,
    title character varying(255) NOT NULL,
    is_done boolean,
    "position" integer,
    created_at timestamp without time zone
);


ALTER TABLE public.milestone_tasks OWNER TO postgres;

--
-- Name: milestone_tasks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.milestone_tasks_id_seq OWNER TO postgres;

--
-- Name: milestone_tasks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.milestone_tasks_id_seq OWNED BY public.milestone_tasks.id;

--
-- Name: notebook_assets_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.notebook_assets_id_seq OWNER TO postgres;

--
-- Name: notebook_assets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.notebook_assets_id_seq OWNED BY public.notebook_assets.id;


--
-- Name: notifications; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.notifications (
    id integer NOT NULL,
    user_id integer NOT NULL,
    title character varying(255) NOT NULL,
    message text,
    category character varying(50),
    link character varying(500),
    is_read boolean,
    created_at timestamp without time zone
);


ALTER TABLE public.notifications OWNER TO postgres;

--
-- Name: notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.notifications_id_seq OWNER TO postgres;

--
-- Name: notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.notifications_id_seq OWNED BY public.notifications.id;

--
-- Name: patent_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.patent_applications_id_seq OWNER TO postgres;

--
-- Name: patent_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.patent_applications_id_seq OWNED BY public.patent_applications.id;


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

CREATE TABLE public.plans (
    id integer NOT NULL,
    name character varying(50) NOT NULL,
    display_name character varying(100) NOT NULL,
    reports_per_month integer NOT NULL,
    price_monthly numeric(10,2),
    stripe_price_id character varying(255),
    can_export_pdf boolean,
    has_api_access boolean,
    video_provider character varying(20)
);


ALTER TABLE public.plans OWNER TO postgres;

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

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


ALTER TABLE public.plans_id_seq OWNER TO postgres;

--
-- Name: plans_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.plans_id_seq OWNED BY public.plans.id;


--
-- Name: project_kpis; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.project_kpis (
    id integer NOT NULL,
    report_id integer NOT NULL,
    user_id integer NOT NULL,
    name character varying(255) NOT NULL,
    unit character varying(50),
    target_value double precision,
    category character varying(50),
    created_at timestamp without time zone
);


ALTER TABLE public.project_kpis OWNER TO postgres;

--
-- Name: project_kpis_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.project_kpis_id_seq OWNER TO postgres;

--
-- Name: project_kpis_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.project_kpis_id_seq OWNED BY public.project_kpis.id;


--
-- Name: project_milestones; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.project_milestones (
    id integer NOT NULL,
    report_id integer NOT NULL,
    user_id integer NOT NULL,
    title character varying(255) NOT NULL,
    description text,
    week_number integer,
    status character varying(50),
    due_date timestamp without time zone,
    completed_at timestamp without time zone,
    "position" integer,
    created_at timestamp without time zone
);


ALTER TABLE public.project_milestones OWNER TO postgres;

--
-- Name: project_milestones_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.project_milestones_id_seq OWNER TO postgres;

--
-- Name: project_milestones_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.project_milestones_id_seq OWNED BY public.project_milestones.id;


--
-- Name: prototype_messages; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.prototype_messages (
    id integer NOT NULL,
    request_id integer NOT NULL,
    sender_id integer NOT NULL,
    sender_type character varying(20),
    message text NOT NULL,
    attachments_json json,
    created_at timestamp without time zone
);


ALTER TABLE public.prototype_messages OWNER TO postgres;

--
-- Name: prototype_messages_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.prototype_messages_id_seq OWNER TO postgres;

--
-- Name: prototype_messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.prototype_messages_id_seq OWNED BY public.prototype_messages.id;


--
-- Name: prototype_quotes; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.prototype_quotes (
    id integer NOT NULL,
    request_id integer NOT NULL,
    factory_id integer NOT NULL,
    unit_price double precision,
    total_price double precision,
    currency character varying(10),
    lead_time_days integer,
    notes text,
    status character varying(30),
    created_at timestamp without time zone
);


ALTER TABLE public.prototype_quotes OWNER TO postgres;

--
-- Name: prototype_quotes_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.prototype_quotes_id_seq OWNER TO postgres;

--
-- Name: prototype_quotes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.prototype_quotes_id_seq OWNED BY public.prototype_quotes.id;


--
-- Name: prototype_requests; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.prototype_requests (
    id integer NOT NULL,
    user_id integer NOT NULL,
    report_id integer NOT NULL,
    factory_id integer,
    title character varying(500) NOT NULL,
    description text,
    specifications_json json,
    quantity integer,
    budget_range character varying(100),
    deadline timestamp without time zone,
    attachments_json json,
    status character varying(30),
    nda_html text,
    nda_status character varying(30),
    nda_generated_at timestamp without time zone,
    nda_approved_at timestamp without time zone,
    cost_estimate_json json,
    cost_estimate_generated_at timestamp without time zone,
    created_at timestamp without time zone
);


ALTER TABLE public.prototype_requests OWNER TO postgres;

--
-- Name: prototype_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.prototype_requests_id_seq OWNER TO postgres;

--
-- Name: prototype_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.prototype_requests_id_seq OWNED BY public.prototype_requests.id;


--
-- Name: referrals; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.referrals (
    id integer NOT NULL,
    referrer_id integer NOT NULL,
    referred_id integer,
    code character varying(20) NOT NULL,
    status character varying(50),
    reward_applied boolean,
    created_at timestamp without time zone,
    converted_at timestamp without time zone
);


ALTER TABLE public.referrals OWNER TO postgres;

--
-- Name: referrals_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.referrals_id_seq OWNER TO postgres;

--
-- Name: referrals_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.referrals_id_seq OWNED BY public.referrals.id;


--
-- Name: report_notebooks; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.report_notebooks (
    id integer NOT NULL,
    report_id integer NOT NULL,
    notebook_id character varying(255) NOT NULL,
    source_id character varying(255),
    notebook_url character varying(1000),
    created_at timestamp without time zone
);


ALTER TABLE public.report_notebooks OWNER TO postgres;

--
-- Name: report_notebooks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.report_notebooks_id_seq OWNER TO postgres;

--
-- Name: report_notebooks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.report_notebooks_id_seq OWNED BY public.report_notebooks.id;


--
-- Name: report_templates; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.report_templates (
    id integer NOT NULL,
    name character varying(255) NOT NULL,
    name_ar character varying(255) NOT NULL,
    sector character varying(100) NOT NULL,
    description text,
    description_ar text,
    default_description text NOT NULL,
    default_description_ar text NOT NULL,
    icon character varying(10),
    is_active boolean,
    usage_count integer,
    created_at timestamp without time zone
);


ALTER TABLE public.report_templates OWNER TO postgres;

--
-- Name: report_templates_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.report_templates_id_seq OWNER TO postgres;

--
-- Name: report_templates_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.report_templates_id_seq OWNED BY public.report_templates.id;


--
-- Name: report_versions; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.report_versions (
    id integer NOT NULL,
    report_id integer NOT NULL,
    version_number integer NOT NULL,
    synthesis_snapshot json,
    html_snapshot text,
    created_at timestamp without time zone
);


ALTER TABLE public.report_versions OWNER TO postgres;

--
-- Name: report_versions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.report_versions_id_seq OWNER TO postgres;

--
-- Name: report_versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.report_versions_id_seq OWNED BY public.report_versions.id;

--
-- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.reports_id_seq OWNER TO postgres;

--
-- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;


--
-- Name: search_index; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.search_index (
    id integer NOT NULL,
    report_id integer NOT NULL,
    content_text text NOT NULL,
    embedding_json json,
    created_at timestamp without time zone
);


ALTER TABLE public.search_index OWNER TO postgres;

--
-- Name: search_index_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.search_index_id_seq OWNER TO postgres;

--
-- Name: search_index_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.search_index_id_seq OWNED BY public.search_index.id;

--
-- Name: social_accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.social_accounts_id_seq OWNER TO postgres;

--
-- Name: social_accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.social_accounts_id_seq OWNED BY public.social_accounts.id;

--
-- Name: sponsor_social_accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.sponsor_social_accounts_id_seq OWNER TO postgres;

--
-- Name: sponsor_social_accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.sponsor_social_accounts_id_seq OWNED BY public.sponsor_social_accounts.id;


--
-- Name: subscriptions; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.subscriptions (
    id integer NOT NULL,
    user_id integer NOT NULL,
    plan_id integer NOT NULL,
    stripe_subscription_id character varying(255),
    stripe_customer_id character varying(255),
    status character varying(50),
    current_period_end timestamp without time zone,
    created_at timestamp without time zone
);


ALTER TABLE public.subscriptions OWNER TO postgres;

--
-- Name: subscriptions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.subscriptions_id_seq OWNER TO postgres;

--
-- Name: subscriptions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.subscriptions_id_seq OWNED BY public.subscriptions.id;


--
-- Name: system_prompts; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.system_prompts (
    id integer NOT NULL,
    service_key character varying(100) NOT NULL,
    display_name character varying(200) NOT NULL,
    system_prompt text NOT NULL,
    user_prompt_template text,
    is_active boolean,
    updated_at timestamp without time zone,
    updated_by integer
);


ALTER TABLE public.system_prompts OWNER TO postgres;

--
-- Name: system_prompts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.system_prompts_id_seq OWNER TO postgres;

--
-- Name: system_prompts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.system_prompts_id_seq OWNED BY public.system_prompts.id;

--
-- Name: trademark_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.trademark_applications_id_seq OWNER TO postgres;

--
-- Name: trademark_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.trademark_applications_id_seq OWNED BY public.trademark_applications.id;


--
-- Name: user_ad_budgets; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.user_ad_budgets (
    id integer NOT NULL,
    user_id integer NOT NULL,
    allocated_budget double precision,
    total_spent double precision,
    is_active boolean,
    set_by_admin_id integer,
    updated_at timestamp without time zone
);


ALTER TABLE public.user_ad_budgets OWNER TO postgres;

--
-- Name: user_ad_budgets_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.user_ad_budgets_id_seq OWNER TO postgres;

--
-- Name: user_ad_budgets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.user_ad_budgets_id_seq OWNED BY public.user_ad_budgets.id;

--
-- Name: user_platform_keys_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.user_platform_keys_id_seq OWNER TO postgres;

--
-- Name: user_platform_keys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.user_platform_keys_id_seq OWNED BY public.user_platform_keys.id;

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

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


ALTER TABLE public.users_id_seq OWNER TO postgres;

--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;

--
-- Name: video_provider_configs_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.video_provider_configs_id_seq OWNER TO postgres;

--
-- Name: video_provider_configs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.video_provider_configs_id_seq OWNED BY public.video_provider_configs.id;

--
-- Name: webhook_endpoints_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.webhook_endpoints_id_seq OWNER TO postgres;

--
-- Name: webhook_endpoints_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.webhook_endpoints_id_seq OWNED BY public.webhook_endpoints.id;


--
-- Name: websites; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.websites (
    id integer NOT NULL,
    user_id integer NOT NULL,
    report_id integer,
    tenant_id character varying(255),
    subdomain character varying(255),
    custom_domain character varying(500),
    status character varying(50),
    created_at timestamp without time zone
);


ALTER TABLE public.websites OWNER TO postgres;

--
-- Name: websites_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.websites_id_seq OWNER TO postgres;

--
-- Name: websites_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.websites_id_seq OWNED BY public.websites.id;


--
-- Name: whatsapp_campaigns; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.whatsapp_campaigns (
    id integer NOT NULL,
    user_id integer NOT NULL,
    instance_id integer NOT NULL,
    name character varying(500) NOT NULL,
    message_template text NOT NULL,
    media_url text,
    contacts_json json,
    sent_count integer,
    delivered_count integer,
    read_count integer,
    status character varying(50),
    created_at timestamp without time zone
);


ALTER TABLE public.whatsapp_campaigns OWNER TO postgres;

--
-- Name: whatsapp_campaigns_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.whatsapp_campaigns_id_seq OWNER TO postgres;

--
-- Name: whatsapp_campaigns_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.whatsapp_campaigns_id_seq OWNED BY public.whatsapp_campaigns.id;

--
-- Name: whatsapp_instances_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.whatsapp_instances_id_seq OWNER TO postgres;

--
-- Name: whatsapp_instances_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.whatsapp_instances_id_seq OWNED BY public.whatsapp_instances.id;

--
-- Name: white_label_configs_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.white_label_configs_id_seq OWNER TO postgres;

--
-- Name: white_label_configs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.white_label_configs_id_seq OWNED BY public.white_label_configs.id;


--
-- Name: workspace_members; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.workspace_members (
    id integer NOT NULL,
    workspace_id integer NOT NULL,
    user_id integer NOT NULL,
    role character varying(50),
    joined_at timestamp without time zone
);


ALTER TABLE public.workspace_members OWNER TO postgres;

--
-- Name: workspace_members_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.workspace_members_id_seq OWNER TO postgres;

--
-- Name: workspace_members_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.workspace_members_id_seq OWNED BY public.workspace_members.id;


--
-- Name: workspaces; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.workspaces (
    id integer NOT NULL,
    name character varying(255) NOT NULL,
    owner_id integer NOT NULL,
    invite_code character varying(32),
    created_at timestamp without time zone
);


ALTER TABLE public.workspaces OWNER TO postgres;

--
-- Name: workspaces_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.workspaces_id_seq OWNER TO postgres;

--
-- Name: workspaces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.workspaces_id_seq OWNED BY public.workspaces.id;


--
-- Name: activity_logs id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: ad_audit_logs id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: ad_budget_wallet id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: ad_campaign_metrics id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: ad_campaigns id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: advisor_chats id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: audit_logs id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: background_tasks id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: campaign_metrics id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: campaign_posts id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: campaigns id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: cofounder_profiles id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: company_registrations id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: competitor_monitors id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: factory_partners id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: gamma_presentations id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: grants id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: incubator_applications id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: investor_contacts id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: kanban_cards id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: kpi_entries id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: legal_documents id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: market_alerts id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: marketplace_inquiries id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: marketplace_listings id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: marketplace_reviews id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: milestone_tasks id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: notifications id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: plans id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: project_kpis id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: project_milestones id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: prototype_messages id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: prototype_quotes id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: prototype_requests id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: referrals id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: report_notebooks id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: report_templates id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: report_versions id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: search_index id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: subscriptions id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: system_prompts id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: user_ad_budgets id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: websites id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: whatsapp_campaigns id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: workspace_members id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Name: workspaces id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- Data for Name: activity_logs; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.activity_logs (id, user_id, workspace_id, action, resource_type, resource_id, resource_name, created_at) FROM stdin;
\.


--
-- Data for Name: ad_audit_logs; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.ad_audit_logs (id, user_id, admin_id, ad_campaign_id, action, details_json, created_at) FROM stdin;
\.


--
-- Data for Name: ad_budget_wallet; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.ad_budget_wallet (id, total_budget, total_spent, currency, updated_by, updated_at) FROM stdin;
\.


--
-- Data for Name: ad_campaign_metrics; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.ad_campaign_metrics (id, ad_campaign_id, platform, date, impressions, views, clicks, ctr, spend, cost_per_view, cost_per_click, likes, comments, shares, conversions, reach, frequency, fetched_at) FROM stdin;
\.


--
-- Data for Name: ad_campaigns; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.ad_campaigns (id, user_id, campaign_id, name, platforms_json, budget_amount, daily_budget, duration_days, start_date, end_date, targeting_json, ai_suggestions_json, ad_caption, ad_cta, status, admin_notes, rejection_reason, reviewed_by, reviewed_at, platform_ids_json, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: advisor_chats; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.advisor_chats (id, report_id, user_id, role, content, created_at) FROM stdin;
\.


--
-- Data for Name: audit_logs; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.audit_logs (id, user_id, action, resource_type, resource_id, details, ip_address, created_at) FROM stdin;
\.


--
-- Data for Name: background_tasks; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.background_tasks (id, user_id, task_type, task_id, status, result_json, error_message, progress, created_at, completed_at) FROM stdin;
\.


--
-- Data for Name: campaign_metrics; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.campaign_metrics (id, post_id, views, likes, comments, shares, ctr, fetched_at) FROM stdin;
\.


--
-- Data for Name: campaign_posts; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.campaign_posts (id, campaign_id, platform, publish_mode, post_id, post_url, caption, scheduled_at, published_at, status) FROM stdin;
\.


--
-- Data for Name: campaigns; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.campaigns (id, user_id, report_id, name, video_url, video_id, video_provider, script, storyboard_json, user_script_notes, video_duration, status, created_at) FROM stdin;
\.


--
-- Data for Name: cofounder_profiles; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.cofounder_profiles (id, user_id, skills, interests, experience_years, bio, looking_for, city, is_visible, created_at) FROM stdin;
\.


--
-- Data for Name: company_registrations; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.company_registrations (id, user_id, report_id, company_name_ar, company_name_en, entity_type, country, capital, activities_json, owners_json, required_licenses_json, ai_legal_advice, wathq_cr_number, misa_license_number, status, created_at) FROM stdin;
\.


--
-- Data for Name: competitor_monitors; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.competitor_monitors (id, user_id, report_id, competitor_url, last_snapshot, last_checked, changes_detected, is_active, created_at) FROM stdin;
\.


--
-- Data for Name: factory_partners; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.factory_partners (id, name, name_ar, country, city, website_url, email, phone, sectors_json, capabilities_json, min_order, logo_url, description, description_ar, user_id, is_verified, is_active, created_at) FROM stdin;
1	SABIC Polymers Factory	مصنع سابك للبوليمرات	SA	الجبيل	https://www.sabic.com	prototyping@sabic.com	+966-13-341-0000	["\\u0628\\u062a\\u0631\\u0648\\u0643\\u064a\\u0645\\u0627\\u0648\\u064a\\u0627\\u062a", "\\u0628\\u0644\\u0627\\u0633\\u062a\\u064a\\u0643", "\\u0635\\u0646\\u0627\\u0639\\u0629"]	["\\u062d\\u0642\\u0646 \\u0628\\u0644\\u0627\\u0633\\u062a\\u064a\\u0643", "\\u0642\\u0648\\u0627\\u0644\\u0628", "\\u062a\\u0634\\u0643\\u064a\\u0644"]	100	\N	Leading petrochemical manufacturer with prototyping capabilities	مصنع رائد في البتروكيماويات مع إمكانيات النماذج الأولية	\N	t	t	2026-03-02 19:28:33.594969
2	Saudi Industrial Development	التنمية الصناعية السعودية	SA	الرياض	https://www.sid.sa	info@sid.sa	+966-11-477-0000	["\\u0635\\u0646\\u0627\\u0639\\u0629", "\\u0645\\u0639\\u0627\\u062f\\u0646", "\\u0625\\u0644\\u0643\\u062a\\u0631\\u0648\\u0646\\u064a\\u0627\\u062a"]	["CNC", "\\u062a\\u0635\\u0646\\u064a\\u0639 \\u0645\\u0639\\u0627\\u062f\\u0646", "\\u0644\\u062d\\u0627\\u0645", "\\u062a\\u062c\\u0645\\u064a\\u0639"]	10	\N	Full-service industrial manufacturing and prototyping	تصنيع صناعي شامل ونماذج أولية	\N	t	t	2026-03-02 19:28:33.594975
3	Jeddah Industrial City Factory	مصنع المدينة الصناعية بجدة	SA	جدة	https://www.modon.gov.sa	factory@jic.sa	+966-12-635-0000	["\\u0623\\u063a\\u0630\\u064a\\u0629", "\\u062a\\u0639\\u0628\\u0626\\u0629", "\\u0635\\u0646\\u0627\\u0639\\u0629"]	["\\u062a\\u0639\\u0628\\u0626\\u0629 \\u0648\\u062a\\u063a\\u0644\\u064a\\u0641", "\\u0637\\u0628\\u0627\\u0639\\u0629", "\\u062a\\u0634\\u0643\\u064a\\u0644"]	50	\N	Food processing and packaging prototyping	نماذج أولية لتصنيع وتعبئة الأغذية	\N	t	t	2026-03-02 19:28:33.594977
4	Dammam Steel Works	مصنع الدمام للصلب	SA	الدمام	https://www.dsw.sa	proto@dsw.sa	+966-13-847-0000	["\\u0645\\u0639\\u0627\\u062f\\u0646", "\\u0625\\u0646\\u0634\\u0627\\u0621\\u0627\\u062a", "\\u0635\\u0646\\u0627\\u0639\\u0629"]	["\\u0642\\u0637\\u0639 \\u0644\\u064a\\u0632\\u0631", "CNC", "\\u0644\\u062d\\u0627\\u0645", "\\u062a\\u0634\\u0643\\u064a\\u0644 \\u0645\\u0639\\u0627\\u062f\\u0646"]	5	\N	Precision metal fabrication and steel prototyping	تصنيع معادن دقيق ونماذج أولية من الصلب	\N	t	t	2026-03-02 19:28:33.594979
5	Riyadh 3D Print Lab	مختبر الطباعة ثلاثية الأبعاد - الرياض	SA	الرياض	https://www.r3dlab.sa	orders@r3dlab.sa	+966-11-290-0000	["\\u062a\\u0642\\u0646\\u064a\\u0629", "\\u0637\\u0628\\u064a", "\\u0635\\u0646\\u0627\\u0639\\u0629"]	["\\u0637\\u0628\\u0627\\u0639\\u0629 3D SLA", "\\u0637\\u0628\\u0627\\u0639\\u0629 3D FDM", "\\u0637\\u0628\\u0627\\u0639\\u0629 \\u0645\\u0639\\u0627\\u062f\\u0646", "\\u0646\\u0645\\u0630\\u062c\\u0629 \\u0633\\u0631\\u064a\\u0639\\u0629"]	1	\N	Rapid prototyping with industrial 3D printers	نمذجة سريعة بطابعات ثلاثية الأبعاد صناعية	\N	t	t	2026-03-02 19:28:33.594982
6	Dubai Industrial City Manufacturing	تصنيع مدينة دبي الصناعية	AE	دبي	https://www.dic.ae	mfg@dic.ae	+971-4-815-0000	["\\u0635\\u0646\\u0627\\u0639\\u0629", "\\u0625\\u0644\\u0643\\u062a\\u0631\\u0648\\u0646\\u064a\\u0627\\u062a", "\\u0633\\u064a\\u0627\\u0631\\u0627\\u062a"]	["CNC", "\\u062d\\u0642\\u0646 \\u0628\\u0644\\u0627\\u0633\\u062a\\u064a\\u0643", "\\u062a\\u062c\\u0645\\u064a\\u0639 \\u0625\\u0644\\u0643\\u062a\\u0631\\u0648\\u0646\\u064a"]	10	\N	Multi-capability manufacturing hub in Dubai	مركز تصنيع متعدد القدرات في دبي	\N	t	t	2026-03-02 19:28:33.594984
7	Sharjah Precision Engineering	الشارقة للهندسة الدقيقة	AE	الشارقة	https://www.spe.ae	info@spe.ae	+971-6-534-0000	["\\u0635\\u0646\\u0627\\u0639\\u0629", "\\u0637\\u064a\\u0631\\u0627\\u0646", "\\u0637\\u0628\\u064a"]	["CNC \\u062f\\u0642\\u064a\\u0642", "EDM", "\\u062a\\u0634\\u0643\\u064a\\u0644", "\\u0645\\u0639\\u0627\\u0644\\u062c\\u0629 \\u062d\\u0631\\u0627\\u0631\\u064a\\u0629"]	5	\N	High-precision engineering and aerospace-grade prototyping	هندسة عالية الدقة ونماذج أولية بمعايير الطيران	\N	t	t	2026-03-02 19:28:33.594986
8	Shenzhen Electronics Hub	مركز شنجن للإلكترونيات	CN	شنجن	https://www.szehub.cn	orders@szehub.cn	+86-755-8888-0000	["\\u0625\\u0644\\u0643\\u062a\\u0631\\u0648\\u0646\\u064a\\u0627\\u062a", "\\u062a\\u0642\\u0646\\u064a\\u0629", "IoT"]	["PCB", "\\u062a\\u062c\\u0645\\u064a\\u0639 SMT", "\\u062d\\u0642\\u0646 \\u0628\\u0644\\u0627\\u0633\\u062a\\u064a\\u0643", "\\u062a\\u0635\\u0646\\u064a\\u0639 \\u0625\\u0644\\u0643\\u062a\\u0631\\u0648\\u0646\\u064a"]	50	\N	Electronics prototyping and small-batch manufacturing	نماذج أولية إلكترونية وتصنيع دفعات صغيرة	\N	t	t	2026-03-02 19:28:33.594988
9	Shenzhen Rapid Mold Co.	شنجن للقوالب السريعة	CN	شنجن	https://www.szrapidmold.cn	sales@szrapidmold.cn	+86-755-2666-0000	["\\u0635\\u0646\\u0627\\u0639\\u0629", "\\u0628\\u0644\\u0627\\u0633\\u062a\\u064a\\u0643", "\\u0633\\u064a\\u0627\\u0631\\u0627\\u062a"]	["\\u0642\\u0648\\u0627\\u0644\\u0628 \\u062d\\u0642\\u0646", "\\u0642\\u0648\\u0627\\u0644\\u0628 \\u0633\\u064a\\u0644\\u064a\\u0643\\u0648\\u0646", "\\u0637\\u0628\\u0627\\u0639\\u0629 3D \\u0635\\u0646\\u0627\\u0639\\u064a\\u0629"]	100	\N	Injection mold tooling and plastic prototyping	تصنيع قوالب الحقن ونماذج بلاستيكية أولية	\N	t	t	2026-03-02 19:28:33.59499
10	Yiwu General Manufacturing	يوو للتصنيع العام	CN	يوو	https://www.ywgm.cn	info@ywgm.cn	+86-579-8555-0000	["\\u062a\\u062c\\u0627\\u0631\\u0629", "\\u0623\\u063a\\u0630\\u064a\\u0629", "\\u0645\\u0646\\u062a\\u062c\\u0627\\u062a \\u0627\\u0633\\u062a\\u0647\\u0644\\u0627\\u0643\\u064a\\u0629"]	["\\u062a\\u0639\\u0628\\u0626\\u0629", "\\u0637\\u0628\\u0627\\u0639\\u0629", "\\u062a\\u0634\\u0643\\u064a\\u0644", "\\u062a\\u062c\\u0645\\u064a\\u0639"]	200	\N	General consumer product manufacturing and packaging	تصنيع منتجات استهلاكية عامة وتعبئة	\N	t	t	2026-03-02 19:28:33.594992
11	Istanbul Manufacturing Zone	منطقة إسطنبول الصناعية	TR	إسطنبول	https://www.imz.com.tr	proto@imz.com.tr	+90-212-555-0000	["\\u0646\\u0633\\u064a\\u062c", "\\u0623\\u063a\\u0630\\u064a\\u0629", "\\u0635\\u0646\\u0627\\u0639\\u0629"]	["\\u0646\\u0633\\u064a\\u062c", "\\u062e\\u064a\\u0627\\u0637\\u0629", "\\u062a\\u0639\\u0628\\u0626\\u0629 \\u0623\\u063a\\u0630\\u064a\\u0629", "\\u062a\\u0634\\u0643\\u064a\\u0644 \\u0645\\u0639\\u0627\\u062f\\u0646"]	50	\N	Textile, food, and general manufacturing prototyping	نماذج أولية للنسيج والأغذية والتصنيع العام	\N	t	t	2026-03-02 19:28:33.594994
12	Ankara Precision Machining	أنقرة للتشغيل الدقيق	TR	أنقرة	https://www.apm.com.tr	info@apm.com.tr	+90-312-444-0000	["\\u0635\\u0646\\u0627\\u0639\\u0629", "\\u0633\\u064a\\u0627\\u0631\\u0627\\u062a", "\\u062f\\u0641\\u0627\\u0639"]	["CNC 5 \\u0645\\u062d\\u0627\\u0648\\u0631", "\\u062a\\u0634\\u0643\\u064a\\u0644 \\u062f\\u0642\\u064a\\u0642", "\\u0645\\u0639\\u0627\\u0644\\u062c\\u0629 \\u0633\\u0637\\u062d\\u064a\\u0629"]	10	\N	5-axis CNC machining and defense-grade prototyping	تشغيل CNC خماسي المحاور ونماذج بمعايير دفاعية	\N	t	t	2026-03-02 19:28:33.594996
13	Cairo Industrial Complex	المجمع الصناعي بالقاهرة	EG	القاهرة	https://www.cic-eg.com	info@cic-eg.com	+20-2-2345-0000	["\\u0635\\u0646\\u0627\\u0639\\u0629", "\\u0623\\u063a\\u0630\\u064a\\u0629", "\\u0646\\u0633\\u064a\\u062c"]	["\\u062a\\u0635\\u0646\\u064a\\u0639 \\u0639\\u0627\\u0645", "\\u062a\\u0639\\u0628\\u0626\\u0629", "\\u0646\\u0633\\u064a\\u062c", "\\u0637\\u0628\\u0627\\u0639\\u0629"]	100	\N	General manufacturing with competitive pricing	تصنيع عام بأسعار تنافسية	\N	t	t	2026-03-02 19:28:33.594997
14	10th of Ramadan City Factory	مصنع مدينة العاشر من رمضان	EG	العاشر من رمضان	https://www.10rc-factory.eg	orders@10rc.eg	+20-2-4567-0000	["\\u0628\\u0644\\u0627\\u0633\\u062a\\u064a\\u0643", "\\u0643\\u064a\\u0645\\u0627\\u0648\\u064a\\u0627\\u062a", "\\u0635\\u0646\\u0627\\u0639\\u0629"]	["\\u062d\\u0642\\u0646 \\u0628\\u0644\\u0627\\u0633\\u062a\\u064a\\u0643", "\\u0646\\u0641\\u062e", "\\u062a\\u0634\\u0643\\u064a\\u0644 \\u062d\\u0631\\u0627\\u0631\\u064a"]	200	\N	Plastics and chemical product manufacturing	تصنيع منتجات بلاستيكية وكيماوية	\N	t	t	2026-03-02 19:28:33.594999
15	Abu Dhabi Advanced Manufacturing	أبوظبي للتصنيع المتقدم	AE	أبوظبي	https://www.adam.ae	rfq@adam.ae	+971-2-678-0000	["\\u0637\\u0627\\u0642\\u0629", "\\u0637\\u064a\\u0631\\u0627\\u0646", "\\u062a\\u0642\\u0646\\u064a\\u0629"]	["\\u0637\\u0628\\u0627\\u0639\\u0629 \\u0645\\u0639\\u0627\\u062f\\u0646 3D", "CNC", "\\u062a\\u0635\\u0646\\u064a\\u0639 \\u0645\\u0631\\u0643\\u0628\\u0627\\u062a", "\\u0627\\u062e\\u062a\\u0628\\u0627\\u0631"]	1	\N	Advanced manufacturing for energy and aerospace sectors	تصنيع متقدم لقطاعي الطاقة والطيران	\N	t	t	2026-03-02 19:28:33.595001
\.


--
-- Data for Name: gamma_presentations; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.gamma_presentations (id, user_id, report_id, gamma_id, gamma_url, format_type, theme, status, error_message, created_at) FROM stdin;
\.


--
-- Data for Name: grants; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.grants (id, name, name_ar, provider, country, sector, max_amount, currency, url, description, deadline, is_active) FROM stdin;
1	Monsha'at SME Financing	تمويل منشآت للمنشآت الصغيرة والمتوسطة	Monsha'at (منشآت)	SA	all	5000000	SAR	https://www.monshaat.gov.sa	Financing and support programs for Saudi SMEs including Kafalah guarantee program	\N	t
2	Saudi Development Fund (SDB)	بنك التنمية الاجتماعية	Social Development Bank	SA	all	500000	SAR	https://www.sdb.gov.sa	Soft loans for Saudi entrepreneurs and micro-enterprises	\N	t
3	Tamkeen Bahrain	تمكين البحرين	Tamkeen	BH	all	100000	BHD	https://www.tamkeen.bh	Enterprise support and development fund for Bahrain businesses	\N	t
4	Khalifa Fund (UAE)	صندوق خليفة (الإمارات)	Khalifa Fund	AE	all	3000000	AED	https://www.khalifafund.gov.ae	SME development fund for UAE nationals	\N	t
5	KAUST Innovation Fund	صندوق ابتكار كاوست	KAUST	SA	tech	2000000	SAR	https://innovation.kaust.edu.sa	Deep tech and research-based startup funding	\N	t
6	Saudi Venture Capital (SVC)	الشركة السعودية للاستثمار الجريء	SVC	SA	tech	10000000	SAR	https://www.svc.com.sa	Venture capital investment in Saudi tech startups via fund-of-funds model	\N	t
7	Wa'ed by Aramco	واعد من أرامكو	Saudi Aramco	SA	energy,tech	5000000	SAR	https://www.waed.net	Entrepreneurship program by Saudi Aramco for tech and energy startups	\N	t
8	MCIT Digital Fund	صندوق الاتصالات الرقمي	MCIT	SA	tech	1000000	SAR	https://www.mcit.gov.sa	Digital transformation and tech startup support by Ministry of Communications	\N	t
\.


--
-- Data for Name: incubator_applications; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.incubator_applications (id, user_id, report_id, incubator_name, incubator_type, application_data_json, ai_application_text, pitch_summary, status, submitted_at, response_status, created_at) FROM stdin;
1	3	2	Eastern Province Chamber	incubator	\N	\N	\N	draft	\N	\N	2026-03-02 19:37:10.14565
\.


--
-- Data for Name: investor_contacts; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.investor_contacts (id, user_id, report_id, name, company, email, phone, stage, notes, last_contact, next_followup, created_at) FROM stdin;
\.


--
-- Data for Name: kanban_cards; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.kanban_cards (id, user_id, report_id, title, description, stage, "position", created_at) FROM stdin;
\.


--
-- Data for Name: kpi_entries; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.kpi_entries (id, kpi_id, month, actual_value, notes, created_at) FROM stdin;
\.


--
-- Data for Name: legal_documents; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.legal_documents (id, user_id, report_id, doc_type, title, content, language, created_at) FROM stdin;
\.


--
-- Data for Name: market_alerts; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.market_alerts (id, user_id, report_id, alert_type, title, description, source_url, severity, is_read, created_at) FROM stdin;
\.


--
-- Data for Name: marketplace_inquiries; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.marketplace_inquiries (id, listing_id, sender_id, inquiry_type, message, contact_info, status, reply_message, created_at) FROM stdin;
\.


--
-- Data for Name: marketplace_listings; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.marketplace_listings (id, report_id, user_id, listing_goal, title, sector, price, currency, description, preview_text, investment_needed, equity_offered, partner_role, license_terms, contact_email, cover_image, approval_status, admin_notes, featured, is_active, views, purchases, created_at) FROM stdin;
1	1	3	sell	منصة الذكاء الاصطناعي المتكاملة لتحويل أفكارك إلى واقع	تجارة إلكترونية	5000	SAR	استعد لتغيير قواعد اللعبة مع منصتنا الثورية التي تجمع بين قوة الذكاء الاصطناعي وعقلية كبار المستشارين. بفضل أكثر من 90 ميزة ذكية، نقدم لك أدوات التحليل المالي، أبحاث السوق، أدوات المستثمرين، والتسويق الآلي، كل ذلك في مكان واحد. سواء كنت رائد أعمال أو مستثمر، نحن هنا لدعم قراراتك الاستراتيجية وتحقيق النجاح.	اكتشف كيف يمكن لمنصة الذكاء الاصطناعي المتكاملة أن تحقق لك النجاح في مشروعك.	\N	\N	\N	\N		\N	approved	\N	f	t	0	0	2026-03-02 09:12:31.373486
\.


--
-- Data for Name: marketplace_reviews; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.marketplace_reviews (id, listing_id, purchase_id, buyer_id, rating, comment, created_at) FROM stdin;
\.


--
-- Data for Name: milestone_tasks; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.milestone_tasks (id, milestone_id, title, is_done, "position", created_at) FROM stdin;
3	1	Draft necessary legal documents and agreements.	f	2	2026-03-02 19:09:37.799455
4	2	Create a detailed financial plan and pitch deck.	f	0	2026-03-02 19:09:37.804823
5	2	Identify potential investors and financial institutions.	f	1	2026-03-02 19:09:37.80483
6	2	Schedule and conduct meetings with potential investors.	f	2	2026-03-02 19:09:37.804833
7	3	Conduct market research to define brand positioning.	f	0	2026-03-02 19:09:37.808957
8	3	Design logo and branding materials.	f	1	2026-03-02 19:09:37.808963
9	3	Create a brand guideline document.	f	2	2026-03-02 19:09:37.808966
10	4	Identify key features based on target market needs.	f	0	2026-03-02 19:09:37.81298
11	4	Develop a minimum viable product (MVP) roadmap.	f	1	2026-03-02 19:09:37.812989
12	4	Select technology stack and partners for development.	f	2	2026-03-02 19:09:37.812991
13	5	Conduct a risk assessment for potential vulnerabilities.	f	0	2026-03-02 19:09:37.816765
14	5	Develop a cybersecurity policy.	f	1	2026-03-02 19:09:37.816773
15	5	Implement necessary technology and measures.	f	2	2026-03-02 19:09:37.816775
16	6	Hire software developers and UX/UI designers.	f	0	2026-03-02 19:09:37.820451
17	6	Start building the MVP of the digital banking application.	f	1	2026-03-02 19:09:37.820457
18	6	Conduct regular progress meetings to ensure timelines are met.	f	2	2026-03-02 19:09:37.82046
19	7	Identify key marketing channels to reach target customers.	f	0	2026-03-02 19:09:37.824194
20	7	Develop promotional materials and content.	f	1	2026-03-02 19:09:37.824202
21	7	Plan social media and online marketing campaigns.	f	2	2026-03-02 19:09:37.824204
22	8	Conduct a compliance audit with legal team.	f	0	2026-03-02 19:09:37.827801
23	8	Test the platform for compliance with SAMA regulations.	f	1	2026-03-02 19:09:37.827809
24	8	Prepare documentation for regulatory submission.	f	2	2026-03-02 19:09:37.827811
25	9	Select a group of beta testers from target demographics.	f	0	2026-03-02 19:09:37.83119
26	9	Collect feedback and analyze user experience.	f	1	2026-03-02 19:09:37.831196
27	9	Make necessary adjustments based on feedback.	f	2	2026-03-02 19:09:37.831199
28	10	Implement changes based on beta testing feedback.	f	0	2026-03-02 19:09:37.834807
29	10	Conduct final performance and security testing.	f	1	2026-03-02 19:09:37.834813
30	10	Prepare for full-scale launch.	f	2	2026-03-02 19:09:37.834815
31	11	Launch advertising campaigns across selected channels.	f	0	2026-03-02 19:09:37.838266
32	11	Host an online launch event to raise awareness.	f	1	2026-03-02 19:09:37.838273
33	11	Engage with influencers to promote the bank.	f	2	2026-03-02 19:09:37.838275
34	12	Provide customer support for new users.	f	0	2026-03-02 19:09:37.840468
35	12	Monitor user engagement and satisfaction.	f	1	2026-03-02 19:09:37.840475
36	12	Collect initial performance metrics and feedback.	f	2	2026-03-02 19:09:37.840477
1	1	Register the business entity with the Saudi Arabian Monetary Authority (SAMA).	f	0	2026-03-02 19:09:37.799445
2	1	Consult with legal experts on regulatory compliance.	f	1	2026-03-02 19:09:37.799452
\.


--
-- Data for Name: notifications; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.notifications (id, user_id, title, message, category, link, is_read, created_at) FROM stdin;
1	1	دراسة جديدة تنتظر الموافقة	قدّم Ashraf Farid دراسة «منصة الذكاء الاصطناعي المتكاملة لتحويل أفكارك إلى واقع» للعرض في السوق.	marketplace	/admin/marketplace	t	2026-03-02 09:12:31.39054
2	3	تمت الموافقة على دراستك ✅	دراسة «منصة الذكاء الاصطناعي المتكاملة لتحويل أفكارك إلى واقع» أصبحت متاحة الآن في السوق.	marketplace	/marketplace/view/1	f	2026-03-02 09:24:35.857021
\.


--
-- Data for Name: plans; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.plans (id, name, display_name, reports_per_month, price_monthly, stripe_price_id, can_export_pdf, has_api_access, video_provider) FROM stdin;
1	free	Free	2	0.00	\N	f	f	sora
2	pro	Pro	50	29.00	price_pro_placeholder	t	f	sora
3	enterprise	Enterprise	-1	99.00	price_enterprise_placeholder	t	t	sora
4	empire	Empire	-1	299.00	\N	t	t	sora
\.


--
-- Data for Name: project_kpis; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.project_kpis (id, report_id, user_id, name, unit, target_value, category, created_at) FROM stdin;
1	2	3	Monthly Revenue	SAR	141666.67	financial	2026-03-02 19:21:20.302571
2	2	3	Monthly Expenses	SAR	800000	financial	2026-03-02 19:21:20.302578
3	2	3	Profit Margin	%	10	financial	2026-03-02 19:21:20.30258
4	2	3	Customer Count	عدد	5000	customers	2026-03-02 19:21:20.302582
5	2	3	Customer Acquisition Cost (CAC)	SAR	200	customers	2026-03-02 19:21:20.302584
6	2	3	Conversion Rate	%	15	customers	2026-03-02 19:21:20.302585
7	2	3	Retention Rate	%	80	customers	2026-03-02 19:21:20.302587
8	2	3	Monthly New Accounts Opened	عدد	1000	operations	2026-03-02 19:21:20.302589
9	2	3	Monthly Transactions Processed	عدد	30000	operations	2026-03-02 19:21:20.30259
10	2	3	Average Transaction Value	SAR	500	operations	2026-03-02 19:21:20.302592
11	2	3	Cybersecurity Incidents	عدد	0	operations	2026-03-02 19:21:20.302594
12	2	3	Regulatory Compliance Score	%	100	operations	2026-03-02 19:21:20.302597
\.


--
-- Data for Name: project_milestones; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.project_milestones (id, report_id, user_id, title, description, week_number, status, due_date, completed_at, "position", created_at) FROM stdin;
1	2	3	Legal Setup and Compliance	Establish the legal framework necessary for the digital bank.	1	pending	2026-03-09 19:09:37.791011	\N	0	2026-03-02 19:09:37.79329
2	2	3	Funding Acquisition	Secure initial funding required for operations.	2	pending	2026-03-16 19:09:37.791011	\N	1	2026-03-02 19:09:37.796455
3	2	3	Branding Strategy Development	Develop a unique brand identity for the digital bank.	3	pending	2026-03-23 19:09:37.791011	\N	2	2026-03-02 19:09:37.803498
4	2	3	Product Development Planning	Outline the features and services of the digital bank.	4	pending	2026-03-30 19:09:37.791011	\N	3	2026-03-02 19:09:37.807466
5	2	3	Cybersecurity Measures Implementation	Establish cybersecurity protocols to protect customer data.	5	pending	2026-04-06 19:09:37.791011	\N	4	2026-03-02 19:09:37.811435
6	2	3	Product Development Execution	Begin the development of the digital banking platform.	6	pending	2026-04-13 19:09:37.791011	\N	5	2026-03-02 19:09:37.815287
7	2	3	Marketing Strategy Development	Create a marketing plan for the bank's launch.	7	pending	2026-04-20 19:09:37.791011	\N	6	2026-03-02 19:09:37.819095
8	2	3	Regulatory Compliance and Testing	Ensure all aspects of the bank meet regulatory standards.	8	pending	2026-04-27 19:09:37.791011	\N	7	2026-03-02 19:09:37.822749
9	2	3	Soft Launch of the Digital Bank	Launch the MVP to a limited audience for feedback.	9	pending	2026-05-04 19:09:37.791011	\N	8	2026-03-02 19:09:37.826399
10	2	3	Final Product Adjustments	Make final tweaks to the product before full launch.	10	pending	2026-05-11 19:09:37.791011	\N	9	2026-03-02 19:09:37.829895
11	2	3	Official Marketing Launch	Execute the marketing strategy to promote the digital bank.	11	pending	2026-05-18 19:09:37.791011	\N	10	2026-03-02 19:09:37.833649
12	2	3	Onboarding First Customers	Begin onboarding customers to the digital bank.	12	pending	2026-05-25 19:09:37.791011	\N	11	2026-03-02 19:09:37.837149
\.


--
-- Data for Name: prototype_messages; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.prototype_messages (id, request_id, sender_id, sender_type, message, attachments_json, created_at) FROM stdin;
\.


--
-- Data for Name: prototype_quotes; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.prototype_quotes (id, request_id, factory_id, unit_price, total_price, currency, lead_time_days, notes, status, created_at) FROM stdin;
\.


--
-- Data for Name: prototype_requests; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.prototype_requests (id, user_id, report_id, factory_id, title, description, specifications_json, quantity, budget_range, deadline, attachments_json, status, nda_html, nda_status, nda_generated_at, nda_approved_at, cost_estimate_json, cost_estimate_generated_at, created_at) FROM stdin;
1	3	2	\N	Digital bank in KSA	\N	\N	1	\N	\N	\N	draft	```html\n<!DOCTYPE html>\n<html lang="ar">\n<head>\n    <meta charset="UTF-8">\n    <meta name="viewport" content="width=device-width, initial-scale=1.0">\n    <title>اتفاقية عدم إفشاء - NDA</title>\n    <style>\n        body {\n            font-family: Arial, sans-serif;\n            line-height: 1.6;\n        }\n        h1, h2 {\n            text-align: center;\n        }\n        section {\n            margin-bottom: 20px;\n        }\n        .english {\n            direction: ltr;\n            text-align: left;\n        }\n        .arabic {\n            direction: rtl;\n            text-align: right;\n        }\n    </style>\n</head>\n<body>\n\n<h1>اتفاقية عدم إفشاء</h1>\n<h1>Non-Disclosure Agreement</h1>\n\n<section>\n    <div class="arabic">\n        <h2>المقدمة</h2>\n        <p>تم إبرام هذه الاتفاقية بين الطرف الأول [اسم صاحب المشروع] والطرف الثاني [اسم المصنع] فيما يتعلق بمشروع "البنك الرقمي في المملكة العربية السعودية".</p>\n    </div>\n    <div class="english">\n        <h2>Introduction</h2>\n        <p>This agreement is made between the First Party [Project Owner Name] and the Second Party [Factory Name] concerning the "Digital Bank in KSA" project.</p>\n    </div>\n</section>\n\n<section>\n    <div class="arabic">\n        <h2>1. تعريف المعلومات السرية</h2>\n        <p>تشمل المعلومات السرية جميع البيانات والوثائق المتعلقة بالمشروع والتي يتم تبادلها بين الطرفين.</p>\n    </div>\n    <div class="english">\n        <h2>1. Definition of Confidential Information</h2>\n        <p>Confidential Information includes all data and documents related to the project exchanged between the parties.</p>\n    </div>\n</section>\n\n<section>\n    <div class="arabic">\n        <h2>2. التزامات الطرفين</h2>\n        <p>يتعهد كل طرف بالحفاظ على سرية المعلومات وعدم الإفصاح عنها لأي طرف ثالث دون موافقة كتابية مسبقة من الطرف الآخر.</p>\n    </div>\n    <div class="english">\n        <h2>2. Obligations of the Parties</h2>\n        <p>Each party agrees to maintain the confidentiality of the information and not disclose it to any third party without the prior written consent of the other party.</p>\n    </div>\n</section>\n\n<section>\n    <div class="arabic">\n        <h2>3. مدة السرية</h2>\n        <p>تظل التزامات السرية سارية لمدة ثلاث سنوات من تاريخ توقيع هذه الاتفاقية.</p>\n    </div>\n    <div class="english">\n        <h2>3. Duration of Confidentiality</h2>\n        <p>The confidentiality obligations shall remain in effect for three years from the date of signing this agreement.</p>\n    </div>\n</section>\n\n<section>\n    <div class="arabic">\n        <h2>4. الاستثناءات</h2>\n        <p>لا تنطبق التزامات السرية على المعلومات التي تصبح متاحة للجمهور دون خرق من الطرف المتلقي.</p>\n    </div>\n    <div class="english">\n        <h2>4. Exceptions</h2>\n        <p>The confidentiality obligations do not apply to information that becomes publicly available without breach by the receiving party.</p>\n    </div>\n</section>\n\n<section>\n    <div class="arabic">\n        <h2>5. العقوبات والتعويضات</h2>\n        <p>في حالة خرق أي من الطرفين لهذه الاتفاقية، يكون للطرف المتضرر الحق في المطالبة بالتعويض عن الأضرار التي لحقت به.</p>\n    </div>\n    <div class="english">\n        <h2>5. Penalties and Compensation</h2>\n        <p>In case of a breach of this agreement by either party, the aggrieved party has the right to claim compensation for the damages incurred.</p>\n    </div>\n</section>\n\n<section>\n    <div class="arabic">\n        <h2>6. القانون الواجب التطبيق</h2>\n        <p>تخضع هذه الاتفاقية وتفسر وفقًا لقوانين المملكة العربية السعودية.</p>\n    </div>\n    <div class="english">\n        <h2>6. Governing Law</h2>\n        <p>This agreement shall be governed by and construed in accordance with the laws of the Kingdom of Saudi Arabia.</p>\n    </div>\n</section>\n\n<section>\n    <div class="arabic">\n        <h2>7. حل النزاعات</h2>\n        <p>في حال نشوء أي نزاع يتعلق بهذه الاتفاقية، يتفق الطرفان على محاولة حله وديًا قبل اللجوء إلى المحاكم.</p>\n    </div>\n    <div class="english">\n        <h2>7. Dispute Resolution</h2>\n        <p>In the event of any dispute arising under this agreement, the parties agree to attempt to resolve it amicably before resorting to the courts.</p>\n    </div>\n</section>\n\n<section>\n    <div class="arabic">\n        <h2>8. أحكام عامة</h2>\n        <p>تشكل هذه الاتفاقية كامل التفاهم بين الطرفين فيما يتعلق بالموضوع المذكور، ولا يجوز تعديلها إلا بكتابة وموافقة كلا الطرفين.</p>\n    </div>\n    <div class="english">\n        <h2>8. General Provisions</h2>\n        <p>This agreement constitutes the entire understanding between the parties regarding the subject matter and may only be amended in writing with the consent of both parties.</p>\n    </div>\n</section>\n\n</body>\n</html>\n```	draft	2026-03-02 19:27:44.224943	\N	\N	\N	2026-03-02 19:27:44.226522
\.


--
-- Data for Name: referrals; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.referrals (id, referrer_id, referred_id, code, status, reward_applied, created_at, converted_at) FROM stdin;
\.


--
-- Data for Name: report_notebooks; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.report_notebooks (id, report_id, notebook_id, source_id, notebook_url, created_at) FROM stdin;
1	1	a644e1c5-2c42-46db-8760-bbba48b56408	b548e826-9e59-432c-9bf9-859a65b4cb99	https://notebooklm.google.com/notebook/a644e1c5-2c42-46db-8760-bbba48b56408	2026-02-15 10:43:24.784087
2	2	408323fb-5884-4081-8dd8-2a79db4b7a26	6de8a001-5ba2-45e5-a2db-ccc0fd3b5c4d	https://notebooklm.google.com/notebook/408323fb-5884-4081-8dd8-2a79db4b7a26	2026-03-02 19:02:51.314335
\.


--
-- Data for Name: report_templates; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.report_templates (id, name, name_ar, sector, description, description_ar, default_description, default_description_ar, icon, is_active, usage_count, created_at) FROM stdin;
\.


--
-- Data for Name: report_versions; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.report_versions (id, report_id, version_number, synthesis_snapshot, html_snapshot, created_at) FROM stdin;
\.


--
-- Data for Name: search_index; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.search_index (id, report_id, content_text, embedding_json, created_at) FROM stdin;
\.


--
-- Data for Name: subscriptions; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.subscriptions (id, user_id, plan_id, stripe_subscription_id, stripe_customer_id, status, current_period_end, created_at) FROM stdin;
\.


--
-- Data for Name: system_prompts; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.system_prompts (id, service_key, display_name, system_prompt, user_prompt_template, is_active, updated_at, updated_by) FROM stdin;
\.


--
-- Data for Name: user_ad_budgets; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.user_ad_budgets (id, user_id, allocated_budget, total_spent, is_active, set_by_admin_id, updated_at) FROM stdin;
\.


--
-- Data for Name: websites; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.websites (id, user_id, report_id, tenant_id, subdomain, custom_domain, status, created_at) FROM stdin;
\.


--
-- Data for Name: whatsapp_campaigns; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.whatsapp_campaigns (id, user_id, instance_id, name, message_template, media_url, contacts_json, sent_count, delivered_count, read_count, status, created_at) FROM stdin;
\.


--
-- Data for Name: workspace_members; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.workspace_members (id, workspace_id, user_id, role, joined_at) FROM stdin;
\.


--
-- Data for Name: workspaces; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.workspaces (id, name, owner_id, invite_code, created_at) FROM stdin;
\.



--
-- Name: activity_logs activity_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.activity_logs
    ADD CONSTRAINT activity_logs_pkey PRIMARY KEY (id);


--
-- Name: ad_audit_logs ad_audit_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ad_audit_logs
    ADD CONSTRAINT ad_audit_logs_pkey PRIMARY KEY (id);


--
-- Name: ad_budget_wallet ad_budget_wallet_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ad_budget_wallet
    ADD CONSTRAINT ad_budget_wallet_pkey PRIMARY KEY (id);


--
-- Name: ad_campaign_metrics ad_campaign_metrics_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ad_campaign_metrics
    ADD CONSTRAINT ad_campaign_metrics_pkey PRIMARY KEY (id);


--
-- Name: ad_campaigns ad_campaigns_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ad_campaigns
    ADD CONSTRAINT ad_campaigns_pkey PRIMARY KEY (id);


--
-- Name: advisor_chats advisor_chats_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.advisor_chats
    ADD CONSTRAINT advisor_chats_pkey PRIMARY KEY (id);


--
-- Name: audit_logs audit_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.audit_logs
    ADD CONSTRAINT audit_logs_pkey PRIMARY KEY (id);


--
-- Name: background_tasks background_tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.background_tasks
    ADD CONSTRAINT background_tasks_pkey PRIMARY KEY (id);


--
-- Name: background_tasks background_tasks_task_id_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.background_tasks
    ADD CONSTRAINT background_tasks_task_id_key UNIQUE (task_id);


--
-- Name: campaign_metrics campaign_metrics_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.campaign_metrics
    ADD CONSTRAINT campaign_metrics_pkey PRIMARY KEY (id);


--
-- Name: campaign_posts campaign_posts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.campaign_posts
    ADD CONSTRAINT campaign_posts_pkey PRIMARY KEY (id);


--
-- Name: campaigns campaigns_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.campaigns
    ADD CONSTRAINT campaigns_pkey PRIMARY KEY (id);


--
-- Name: cofounder_profiles cofounder_profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.cofounder_profiles
    ADD CONSTRAINT cofounder_profiles_pkey PRIMARY KEY (id);


--
-- Name: company_registrations company_registrations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.company_registrations
    ADD CONSTRAINT company_registrations_pkey PRIMARY KEY (id);


--
-- Name: competitor_monitors competitor_monitors_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.competitor_monitors
    ADD CONSTRAINT competitor_monitors_pkey PRIMARY KEY (id);


--
-- Name: factory_partners factory_partners_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.factory_partners
    ADD CONSTRAINT factory_partners_pkey PRIMARY KEY (id);


--
-- Name: gamma_presentations gamma_presentations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.gamma_presentations
    ADD CONSTRAINT gamma_presentations_pkey PRIMARY KEY (id);


--
-- Name: grants grants_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.grants
    ADD CONSTRAINT grants_pkey PRIMARY KEY (id);


--
-- Name: incubator_applications incubator_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.incubator_applications
    ADD CONSTRAINT incubator_applications_pkey PRIMARY KEY (id);


--
-- Name: investor_contacts investor_contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.investor_contacts
    ADD CONSTRAINT investor_contacts_pkey PRIMARY KEY (id);


--
-- Name: kanban_cards kanban_cards_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.kanban_cards
    ADD CONSTRAINT kanban_cards_pkey PRIMARY KEY (id);


--
-- Name: kpi_entries kpi_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.kpi_entries
    ADD CONSTRAINT kpi_entries_pkey PRIMARY KEY (id);


--
-- Name: legal_documents legal_documents_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.legal_documents
    ADD CONSTRAINT legal_documents_pkey PRIMARY KEY (id);


--
-- Name: market_alerts market_alerts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.market_alerts
    ADD CONSTRAINT market_alerts_pkey PRIMARY KEY (id);


--
-- Name: marketplace_inquiries marketplace_inquiries_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.marketplace_inquiries
    ADD CONSTRAINT marketplace_inquiries_pkey PRIMARY KEY (id);


--
-- Name: marketplace_listings marketplace_listings_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.marketplace_listings
    ADD CONSTRAINT marketplace_listings_pkey PRIMARY KEY (id);


--
-- Name: marketplace_reviews marketplace_reviews_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.marketplace_reviews
    ADD CONSTRAINT marketplace_reviews_pkey PRIMARY KEY (id);


--
-- Name: milestone_tasks milestone_tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.milestone_tasks
    ADD CONSTRAINT milestone_tasks_pkey PRIMARY KEY (id);


--
-- Name: notifications notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.notifications
    ADD CONSTRAINT notifications_pkey PRIMARY KEY (id);


--
-- Name: plans plans_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.plans
    ADD CONSTRAINT plans_name_key UNIQUE (name);


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

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


--
-- Name: project_kpis project_kpis_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.project_kpis
    ADD CONSTRAINT project_kpis_pkey PRIMARY KEY (id);


--
-- Name: project_milestones project_milestones_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.project_milestones
    ADD CONSTRAINT project_milestones_pkey PRIMARY KEY (id);


--
-- Name: prototype_messages prototype_messages_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.prototype_messages
    ADD CONSTRAINT prototype_messages_pkey PRIMARY KEY (id);


--
-- Name: prototype_quotes prototype_quotes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.prototype_quotes
    ADD CONSTRAINT prototype_quotes_pkey PRIMARY KEY (id);


--
-- Name: prototype_requests prototype_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.prototype_requests
    ADD CONSTRAINT prototype_requests_pkey PRIMARY KEY (id);


--
-- Name: referrals referrals_code_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.referrals
    ADD CONSTRAINT referrals_code_key UNIQUE (code);


--
-- Name: referrals referrals_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.referrals
    ADD CONSTRAINT referrals_pkey PRIMARY KEY (id);


--
-- Name: report_notebooks report_notebooks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.report_notebooks
    ADD CONSTRAINT report_notebooks_pkey PRIMARY KEY (id);


--
-- Name: report_notebooks report_notebooks_report_id_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.report_notebooks
    ADD CONSTRAINT report_notebooks_report_id_key UNIQUE (report_id);


--
-- Name: report_templates report_templates_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.report_templates
    ADD CONSTRAINT report_templates_pkey PRIMARY KEY (id);


--
-- Name: report_versions report_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.report_versions
    ADD CONSTRAINT report_versions_pkey PRIMARY KEY (id);


--
-- Name: search_index search_index_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.search_index
    ADD CONSTRAINT search_index_pkey PRIMARY KEY (id);


--
-- Name: subscriptions subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.subscriptions
    ADD CONSTRAINT subscriptions_pkey PRIMARY KEY (id);


--
-- Name: subscriptions subscriptions_user_id_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.subscriptions
    ADD CONSTRAINT subscriptions_user_id_key UNIQUE (user_id);


--
-- Name: system_prompts system_prompts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.system_prompts
    ADD CONSTRAINT system_prompts_pkey PRIMARY KEY (id);


--
-- Name: ad_campaign_metrics uq_ad_metrics_campaign_platform_date; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ad_campaign_metrics
    ADD CONSTRAINT uq_ad_metrics_campaign_platform_date UNIQUE (ad_campaign_id, platform, date);


--
-- Name: kpi_entries uq_kpi_month; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.kpi_entries
    ADD CONSTRAINT uq_kpi_month UNIQUE (kpi_id, month);


--
-- Name: marketplace_reviews uq_purchase_review; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.marketplace_reviews
    ADD CONSTRAINT uq_purchase_review UNIQUE (purchase_id);


--
-- Name: user_ad_budgets user_ad_budgets_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.user_ad_budgets
    ADD CONSTRAINT user_ad_budgets_pkey PRIMARY KEY (id);


--
-- Name: user_ad_budgets user_ad_budgets_user_id_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.user_ad_budgets
    ADD CONSTRAINT user_ad_budgets_user_id_key UNIQUE (user_id);


--
-- Name: websites websites_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.websites
    ADD CONSTRAINT websites_pkey PRIMARY KEY (id);


--
-- Name: whatsapp_campaigns whatsapp_campaigns_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.whatsapp_campaigns
    ADD CONSTRAINT whatsapp_campaigns_pkey PRIMARY KEY (id);


--
-- Name: workspace_members workspace_members_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.workspace_members
    ADD CONSTRAINT workspace_members_pkey PRIMARY KEY (id);


--
-- Name: workspace_members workspace_members_workspace_id_user_id_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.workspace_members
    ADD CONSTRAINT workspace_members_workspace_id_user_id_key UNIQUE (workspace_id, user_id);


--
-- Name: workspaces workspaces_invite_code_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.workspaces
    ADD CONSTRAINT workspaces_invite_code_key UNIQUE (invite_code);


--
-- Name: workspaces workspaces_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.workspaces
    ADD CONSTRAINT workspaces_pkey PRIMARY KEY (id);


--
-- Name: ix_system_prompts_service_key; Type: INDEX; Schema: public; Owner: postgres
--

CREATE UNIQUE INDEX ix_system_prompts_service_key ON public.system_prompts USING btree (service_key);


--
-- Name: activity_logs activity_logs_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: activity_logs activity_logs_workspace_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.activity_logs
    ADD CONSTRAINT activity_logs_workspace_id_fkey FOREIGN KEY (workspace_id) REFERENCES public.workspaces(id);


--
-- Name: ad_audit_logs ad_audit_logs_ad_campaign_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ad_audit_logs
    ADD CONSTRAINT ad_audit_logs_ad_campaign_id_fkey FOREIGN KEY (ad_campaign_id) REFERENCES public.ad_campaigns(id);


--
-- Name: ad_audit_logs ad_audit_logs_admin_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ad_audit_logs
    ADD CONSTRAINT ad_audit_logs_admin_id_fkey FOREIGN KEY (admin_id) REFERENCES public.users(id);


--
-- Name: ad_audit_logs ad_audit_logs_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: ad_budget_wallet ad_budget_wallet_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ad_budget_wallet
    ADD CONSTRAINT ad_budget_wallet_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);


--
-- Name: ad_campaign_metrics ad_campaign_metrics_ad_campaign_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ad_campaign_metrics
    ADD CONSTRAINT ad_campaign_metrics_ad_campaign_id_fkey FOREIGN KEY (ad_campaign_id) REFERENCES public.ad_campaigns(id);


--
-- Name: ad_campaigns ad_campaigns_campaign_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ad_campaigns
    ADD CONSTRAINT ad_campaigns_campaign_id_fkey FOREIGN KEY (campaign_id) REFERENCES public.campaigns(id);


--
-- Name: ad_campaigns ad_campaigns_reviewed_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ad_campaigns
    ADD CONSTRAINT ad_campaigns_reviewed_by_fkey FOREIGN KEY (reviewed_by) REFERENCES public.users(id);


--
-- Name: ad_campaigns ad_campaigns_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: advisor_chats advisor_chats_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.advisor_chats
    ADD CONSTRAINT advisor_chats_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: advisor_chats advisor_chats_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: audit_logs audit_logs_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: background_tasks background_tasks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: campaign_metrics campaign_metrics_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.campaign_metrics
    ADD CONSTRAINT campaign_metrics_post_id_fkey FOREIGN KEY (post_id) REFERENCES public.campaign_posts(id);


--
-- Name: campaign_posts campaign_posts_campaign_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.campaign_posts
    ADD CONSTRAINT campaign_posts_campaign_id_fkey FOREIGN KEY (campaign_id) REFERENCES public.campaigns(id);


--
-- Name: campaigns campaigns_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.campaigns
    ADD CONSTRAINT campaigns_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: campaigns campaigns_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: cofounder_profiles cofounder_profiles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: company_registrations company_registrations_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.company_registrations
    ADD CONSTRAINT company_registrations_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: company_registrations company_registrations_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: competitor_monitors competitor_monitors_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.competitor_monitors
    ADD CONSTRAINT competitor_monitors_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: competitor_monitors competitor_monitors_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: factory_partners factory_partners_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: gamma_presentations gamma_presentations_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.gamma_presentations
    ADD CONSTRAINT gamma_presentations_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: gamma_presentations gamma_presentations_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: incubator_applications incubator_applications_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.incubator_applications
    ADD CONSTRAINT incubator_applications_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: incubator_applications incubator_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: investor_contacts investor_contacts_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.investor_contacts
    ADD CONSTRAINT investor_contacts_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: investor_contacts investor_contacts_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: kanban_cards kanban_cards_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.kanban_cards
    ADD CONSTRAINT kanban_cards_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: kanban_cards kanban_cards_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: kpi_entries kpi_entries_kpi_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.kpi_entries
    ADD CONSTRAINT kpi_entries_kpi_id_fkey FOREIGN KEY (kpi_id) REFERENCES public.project_kpis(id);


--
-- Name: legal_documents legal_documents_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.legal_documents
    ADD CONSTRAINT legal_documents_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: legal_documents legal_documents_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: market_alerts market_alerts_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.market_alerts
    ADD CONSTRAINT market_alerts_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: market_alerts market_alerts_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: marketplace_inquiries marketplace_inquiries_listing_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.marketplace_inquiries
    ADD CONSTRAINT marketplace_inquiries_listing_id_fkey FOREIGN KEY (listing_id) REFERENCES public.marketplace_listings(id);


--
-- Name: marketplace_inquiries marketplace_inquiries_sender_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.marketplace_inquiries
    ADD CONSTRAINT marketplace_inquiries_sender_id_fkey FOREIGN KEY (sender_id) REFERENCES public.users(id);


--
-- Name: marketplace_listings marketplace_listings_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.marketplace_listings
    ADD CONSTRAINT marketplace_listings_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: marketplace_listings marketplace_listings_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: marketplace_reviews marketplace_reviews_buyer_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.marketplace_reviews
    ADD CONSTRAINT marketplace_reviews_buyer_id_fkey FOREIGN KEY (buyer_id) REFERENCES public.users(id);


--
-- Name: marketplace_reviews marketplace_reviews_listing_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.marketplace_reviews
    ADD CONSTRAINT marketplace_reviews_listing_id_fkey FOREIGN KEY (listing_id) REFERENCES public.marketplace_listings(id);


--
-- Name: marketplace_reviews marketplace_reviews_purchase_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.marketplace_reviews
    ADD CONSTRAINT marketplace_reviews_purchase_id_fkey FOREIGN KEY (purchase_id) REFERENCES public.marketplace_purchases(id);


--
-- Name: milestone_tasks milestone_tasks_milestone_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.milestone_tasks
    ADD CONSTRAINT milestone_tasks_milestone_id_fkey FOREIGN KEY (milestone_id) REFERENCES public.project_milestones(id);


--
-- Name: notifications notifications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: project_kpis project_kpis_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.project_kpis
    ADD CONSTRAINT project_kpis_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: project_kpis project_kpis_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: project_milestones project_milestones_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.project_milestones
    ADD CONSTRAINT project_milestones_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: project_milestones project_milestones_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: prototype_messages prototype_messages_request_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.prototype_messages
    ADD CONSTRAINT prototype_messages_request_id_fkey FOREIGN KEY (request_id) REFERENCES public.prototype_requests(id);


--
-- Name: prototype_messages prototype_messages_sender_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.prototype_messages
    ADD CONSTRAINT prototype_messages_sender_id_fkey FOREIGN KEY (sender_id) REFERENCES public.users(id);


--
-- Name: prototype_quotes prototype_quotes_factory_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.prototype_quotes
    ADD CONSTRAINT prototype_quotes_factory_id_fkey FOREIGN KEY (factory_id) REFERENCES public.factory_partners(id);


--
-- Name: prototype_quotes prototype_quotes_request_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.prototype_quotes
    ADD CONSTRAINT prototype_quotes_request_id_fkey FOREIGN KEY (request_id) REFERENCES public.prototype_requests(id);


--
-- Name: prototype_requests prototype_requests_factory_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.prototype_requests
    ADD CONSTRAINT prototype_requests_factory_id_fkey FOREIGN KEY (factory_id) REFERENCES public.factory_partners(id);


--
-- Name: prototype_requests prototype_requests_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.prototype_requests
    ADD CONSTRAINT prototype_requests_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: prototype_requests prototype_requests_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: referrals referrals_referred_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.referrals
    ADD CONSTRAINT referrals_referred_id_fkey FOREIGN KEY (referred_id) REFERENCES public.users(id);


--
-- Name: referrals referrals_referrer_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.referrals
    ADD CONSTRAINT referrals_referrer_id_fkey FOREIGN KEY (referrer_id) REFERENCES public.users(id);


--
-- Name: report_notebooks report_notebooks_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.report_notebooks
    ADD CONSTRAINT report_notebooks_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: report_versions report_versions_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.report_versions
    ADD CONSTRAINT report_versions_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: search_index search_index_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.search_index
    ADD CONSTRAINT search_index_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: subscriptions subscriptions_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: subscriptions subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: system_prompts system_prompts_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.system_prompts
    ADD CONSTRAINT system_prompts_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);


--
-- Name: user_ad_budgets user_ad_budgets_set_by_admin_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.user_ad_budgets
    ADD CONSTRAINT user_ad_budgets_set_by_admin_id_fkey FOREIGN KEY (set_by_admin_id) REFERENCES public.users(id);


--
-- Name: user_ad_budgets user_ad_budgets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: websites websites_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.websites
    ADD CONSTRAINT websites_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.reports(id);


--
-- Name: websites websites_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: whatsapp_campaigns whatsapp_campaigns_instance_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.whatsapp_campaigns
    ADD CONSTRAINT whatsapp_campaigns_instance_id_fkey FOREIGN KEY (instance_id) REFERENCES public.whatsapp_instances(id);


--
-- Name: whatsapp_campaigns whatsapp_campaigns_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: workspace_members workspace_members_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- Name: workspace_members workspace_members_workspace_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.workspace_members
    ADD CONSTRAINT workspace_members_workspace_id_fkey FOREIGN KEY (workspace_id) REFERENCES public.workspaces(id);


--
-- Name: workspaces workspaces_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.workspaces
    ADD CONSTRAINT workspaces_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES public.users(id);