--
-- PostgreSQL database dump
--

-- Dumped from database version 15.8
-- Dumped by pg_dump version 15.8

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

--
-- Name: data; Type: SCHEMA; Schema: -; Owner: service_finder_app
--

CREATE SCHEMA data;


ALTER SCHEMA data OWNER TO service_finder_app;

--
-- Name: public; Type: SCHEMA; Schema: -; Owner: service_finder_app
--

-- *not* creating schema, since initdb creates it


ALTER SCHEMA public OWNER TO service_finder_app;

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

CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA data;


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

COMMENT ON EXTENSION postgis IS 'PostGIS geometry and geography spatial types and functions';


--
-- Name: actionstatus; Type: TYPE; Schema: data; Owner: service_finder_app
--

CREATE TYPE data.actionstatus AS ENUM (
    'pending',
    'approved',
    'rejected',
    'expired'
);


ALTER TYPE data.actionstatus OWNER TO service_finder_app;

--
-- Name: logseverity; Type: TYPE; Schema: data; Owner: kincses
--

CREATE TYPE data.logseverity AS ENUM (
    'info',
    'warning',
    'critical',
    'emergency'
);


ALTER TYPE data.logseverity OWNER TO kincses;

--
-- Name: orgtype; Type: TYPE; Schema: data; Owner: service_finder_app
--

CREATE TYPE data.orgtype AS ENUM (
    'individual',
    'service',
    'service_provider',
    'fleet_owner',
    'club',
    'business'
);


ALTER TYPE data.orgtype OWNER TO service_finder_app;

--
-- Name: orguserrole; Type: TYPE; Schema: data; Owner: service_finder_app
--

CREATE TYPE data.orguserrole AS ENUM (
    'OWNER',
    'ADMIN',
    'FLEET_MANAGER',
    'DRIVER',
    'MECHANIC',
    'RECEPTIONIST'
);


ALTER TYPE data.orguserrole OWNER TO service_finder_app;

--
-- Name: userrole; Type: TYPE; Schema: data; Owner: service_finder_app
--

CREATE TYPE data.userrole AS ENUM (
    'admin',
    'user',
    'service',
    'fleet_manager',
    'driver',
    'superadmin'
);


ALTER TYPE data.userrole OWNER TO service_finder_app;

--
-- Name: emailtype; Type: TYPE; Schema: public; Owner: kincses
--

CREATE TYPE public.emailtype AS ENUM (
    'REGISTRATION',
    'PASSWORD_RESET',
    'GDPR_NOTICE'
);


ALTER TYPE public.emailtype OWNER TO kincses;

--
-- Name: orgtype; Type: TYPE; Schema: public; Owner: kincses
--

CREATE TYPE public.orgtype AS ENUM (
    'PRIVATE',
    'COMPANY',
    'SERVICE'
);


ALTER TYPE public.orgtype OWNER TO kincses;

--
-- Name: orguserrole; Type: TYPE; Schema: public; Owner: kincses
--

CREATE TYPE public.orguserrole AS ENUM (
    'OWNER',
    'ADMIN',
    'FLEET_MANAGER',
    'DRIVER',
    'owner',
    'manager',
    'driver',
    'service'
);


ALTER TYPE public.orguserrole OWNER TO kincses;

--
-- Name: uitheme; Type: TYPE; Schema: public; Owner: kincses
--

CREATE TYPE public.uitheme AS ENUM (
    'LIGHT',
    'DARK',
    'SYSTEM'
);


ALTER TYPE public.uitheme OWNER TO kincses;

--
-- Name: userrole; Type: TYPE; Schema: public; Owner: kincses
--

CREATE TYPE public.userrole AS ENUM (
    'owner_old',
    'ADMIN',
    'FLEET_MANAGER',
    'DRIVER',
    'owner',
    'admin',
    'user'
);


ALTER TYPE public.userrole OWNER TO kincses;

--
-- Name: validationstatus; Type: TYPE; Schema: public; Owner: kincses
--

CREATE TYPE public.validationstatus AS ENUM (
    'NOT_VALIDATED',
    'PENDING',
    'VALIDATED',
    'REJECTED'
);


ALTER TYPE public.validationstatus OWNER TO kincses;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: addresses; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.addresses (
    id uuid NOT NULL,
    postal_code_id integer,
    street_name character varying(200) NOT NULL,
    street_type character varying(50) NOT NULL,
    house_number character varying(50) NOT NULL,
    stairwell character varying(20),
    floor character varying(20),
    door character varying(20),
    parcel_id character varying(50),
    full_address_text text,
    created_at timestamp with time zone DEFAULT now(),
    latitude double precision,
    longitude double precision
);


ALTER TABLE data.addresses OWNER TO service_finder_app;

--
-- Name: asset_assignments; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.asset_assignments (
    id uuid NOT NULL,
    asset_id uuid NOT NULL,
    organization_id integer NOT NULL,
    assigned_at timestamp with time zone DEFAULT now(),
    released_at timestamp with time zone,
    status character varying(30)
);


ALTER TABLE data.asset_assignments OWNER TO service_finder_app;

--
-- Name: asset_costs; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.asset_costs (
    id uuid NOT NULL,
    asset_id uuid NOT NULL,
    organization_id integer NOT NULL,
    driver_id integer,
    cost_type character varying(50) NOT NULL,
    date timestamp with time zone DEFAULT now(),
    mileage_at_cost integer,
    data jsonb DEFAULT '{}'::jsonb,
    amount_local numeric(18,2) NOT NULL,
    currency_local character varying(3) NOT NULL,
    amount_eur numeric(18,2),
    net_amount_local numeric(18,2),
    vat_rate numeric(5,2),
    exchange_rate_used numeric(18,6)
);


ALTER TABLE data.asset_costs OWNER TO service_finder_app;

--
-- Name: asset_events; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.asset_events (
    id uuid NOT NULL,
    asset_id uuid NOT NULL,
    event_type character varying(50) NOT NULL,
    recorded_mileage integer,
    data jsonb DEFAULT '{}'::jsonb
);


ALTER TABLE data.asset_events OWNER TO service_finder_app;

--
-- Name: asset_financials; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.asset_financials (
    id integer NOT NULL,
    asset_id uuid,
    acquisition_price numeric(18,2),
    acquisition_date timestamp without time zone,
    financing_type character varying,
    residual_value_estimate numeric(18,2)
);


ALTER TABLE data.asset_financials OWNER TO service_finder_app;

--
-- Name: asset_financials_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.asset_financials_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.asset_financials_id_seq OWNER TO service_finder_app;

--
-- Name: asset_financials_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.asset_financials_id_seq OWNED BY data.asset_financials.id;


--
-- Name: asset_reviews; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.asset_reviews (
    id integer NOT NULL,
    asset_id uuid NOT NULL,
    user_id integer NOT NULL,
    overall_rating integer,
    criteria_scores jsonb DEFAULT '{}'::jsonb,
    comment text,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE data.asset_reviews OWNER TO service_finder_app;

--
-- Name: asset_reviews_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.asset_reviews_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.asset_reviews_id_seq OWNER TO service_finder_app;

--
-- Name: asset_reviews_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.asset_reviews_id_seq OWNED BY data.asset_reviews.id;


--
-- Name: asset_telemetry; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.asset_telemetry (
    id integer NOT NULL,
    asset_id uuid,
    current_mileage integer,
    mileage_unit character varying(10),
    vqi_score numeric(5,2),
    dbs_score numeric(5,2)
);


ALTER TABLE data.asset_telemetry OWNER TO service_finder_app;

--
-- Name: asset_telemetry_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.asset_telemetry_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.asset_telemetry_id_seq OWNER TO service_finder_app;

--
-- Name: asset_telemetry_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.asset_telemetry_id_seq OWNED BY data.asset_telemetry.id;


--
-- Name: assets; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.assets (
    id uuid NOT NULL,
    vin character varying(17) NOT NULL,
    license_plate character varying(20),
    name character varying,
    year_of_manufacture integer,
    catalog_id integer,
    is_verified boolean,
    status character varying(20),
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone,
    current_organization_id integer,
    verification_method character varying(20),
    verification_notes text,
    catalog_match_score numeric(5,2)
);


ALTER TABLE data.assets OWNER TO service_finder_app;

--
-- Name: audit_logs; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.audit_logs (
    id integer NOT NULL,
    user_id integer,
    target_type character varying,
    target_id character varying,
    action character varying NOT NULL,
    "timestamp" timestamp with time zone DEFAULT now(),
    severity data.logseverity NOT NULL,
    old_data json,
    new_data json,
    ip_address character varying(45),
    user_agent text
);


ALTER TABLE data.audit_logs OWNER TO service_finder_app;

--
-- Name: audit_logs_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

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


ALTER TABLE data.audit_logs_id_seq OWNER TO service_finder_app;

--
-- Name: audit_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

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


--
-- Name: badges; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.badges (
    id integer NOT NULL,
    name character varying NOT NULL,
    description character varying NOT NULL,
    icon_url character varying
);


ALTER TABLE data.badges OWNER TO service_finder_app;

--
-- Name: badges_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.badges_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.badges_id_seq OWNER TO service_finder_app;

--
-- Name: badges_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.badges_id_seq OWNED BY data.badges.id;


--
-- Name: credit_logs; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.credit_logs (
    id integer NOT NULL,
    org_id integer,
    amount numeric(10,2),
    description character varying,
    created_at timestamp without time zone DEFAULT now()
);


ALTER TABLE data.credit_logs OWNER TO service_finder_app;

--
-- Name: credit_logs_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.credit_logs_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.credit_logs_id_seq OWNER TO service_finder_app;

--
-- Name: credit_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.credit_logs_id_seq OWNED BY data.credit_logs.id;


--
-- Name: documents; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.documents (
    id uuid NOT NULL,
    parent_type character varying(20) NOT NULL,
    parent_id character varying(50) NOT NULL,
    doc_type character varying(50),
    original_name character varying(255) NOT NULL,
    file_hash character varying(64) NOT NULL,
    file_ext character varying(10),
    mime_type character varying(100),
    file_size integer,
    has_thumbnail boolean,
    thumbnail_path character varying(255),
    uploaded_by integer,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE data.documents OWNER TO service_finder_app;

--
-- Name: exchange_rates; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.exchange_rates (
    id integer NOT NULL,
    base_currency character varying(3),
    target_currency character varying(3),
    rate numeric(18,6) NOT NULL
);


ALTER TABLE data.exchange_rates OWNER TO service_finder_app;

--
-- Name: exchange_rates_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.exchange_rates_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.exchange_rates_id_seq OWNER TO service_finder_app;

--
-- Name: exchange_rates_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.exchange_rates_id_seq OWNED BY data.exchange_rates.id;


--
-- Name: expertise_tags; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.expertise_tags (
    id integer NOT NULL,
    key character varying(50),
    name_hu character varying(100),
    category character varying(30)
);


ALTER TABLE data.expertise_tags OWNER TO service_finder_app;

--
-- Name: expertise_tags_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.expertise_tags_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.expertise_tags_id_seq OWNER TO service_finder_app;

--
-- Name: expertise_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.expertise_tags_id_seq OWNED BY data.expertise_tags.id;


--
-- Name: geo_postal_codes; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.geo_postal_codes (
    id integer NOT NULL,
    country_code character varying(5),
    zip_code character varying(10) NOT NULL,
    city character varying(100) NOT NULL
);


ALTER TABLE data.geo_postal_codes OWNER TO service_finder_app;

--
-- Name: geo_postal_codes_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.geo_postal_codes_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.geo_postal_codes_id_seq OWNER TO service_finder_app;

--
-- Name: geo_postal_codes_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.geo_postal_codes_id_seq OWNED BY data.geo_postal_codes.id;


--
-- Name: geo_street_types; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.geo_street_types (
    id integer NOT NULL,
    name character varying(50) NOT NULL
);


ALTER TABLE data.geo_street_types OWNER TO service_finder_app;

--
-- Name: geo_street_types_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.geo_street_types_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.geo_street_types_id_seq OWNER TO service_finder_app;

--
-- Name: geo_street_types_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.geo_street_types_id_seq OWNED BY data.geo_street_types.id;


--
-- Name: geo_streets; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.geo_streets (
    id integer NOT NULL,
    postal_code_id integer,
    name character varying(200) NOT NULL
);


ALTER TABLE data.geo_streets OWNER TO service_finder_app;

--
-- Name: geo_streets_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.geo_streets_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.geo_streets_id_seq OWNER TO service_finder_app;

--
-- Name: geo_streets_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.geo_streets_id_seq OWNED BY data.geo_streets.id;


--
-- Name: level_configs; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.level_configs (
    id integer NOT NULL,
    level_number integer NOT NULL,
    min_points integer NOT NULL,
    rank_name character varying NOT NULL
);


ALTER TABLE data.level_configs OWNER TO service_finder_app;

--
-- Name: level_configs_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.level_configs_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.level_configs_id_seq OWNER TO service_finder_app;

--
-- Name: level_configs_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.level_configs_id_seq OWNED BY data.level_configs.id;


--
-- Name: org_subscriptions; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.org_subscriptions (
    id integer NOT NULL,
    org_id integer,
    tier_id integer,
    valid_from timestamp without time zone DEFAULT now(),
    valid_until timestamp without time zone,
    is_active boolean
);


ALTER TABLE data.org_subscriptions OWNER TO service_finder_app;

--
-- Name: org_subscriptions_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.org_subscriptions_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.org_subscriptions_id_seq OWNER TO service_finder_app;

--
-- Name: org_subscriptions_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.org_subscriptions_id_seq OWNED BY data.org_subscriptions.id;


--
-- Name: organization_financials; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.organization_financials (
    id integer NOT NULL,
    organization_id integer NOT NULL,
    year integer NOT NULL,
    turnover numeric(18,2),
    profit numeric(18,2),
    employee_count integer,
    source character varying(50),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE data.organization_financials OWNER TO service_finder_app;

--
-- Name: organization_financials_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.organization_financials_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.organization_financials_id_seq OWNER TO service_finder_app;

--
-- Name: organization_financials_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.organization_financials_id_seq OWNED BY data.organization_financials.id;


--
-- Name: organization_members; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.organization_members (
    id integer NOT NULL,
    organization_id integer NOT NULL,
    user_id integer,
    role data.orguserrole,
    permissions json DEFAULT '{}'::jsonb,
    person_id bigint,
    is_permanent boolean,
    is_verified boolean
);


ALTER TABLE data.organization_members OWNER TO service_finder_app;

--
-- Name: organization_members_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.organization_members_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.organization_members_id_seq OWNER TO service_finder_app;

--
-- Name: organization_members_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.organization_members_id_seq OWNED BY data.organization_members.id;


--
-- Name: organizations; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.organizations (
    id integer NOT NULL,
    address_id uuid,
    full_name character varying NOT NULL,
    name character varying NOT NULL,
    display_name character varying(50),
    default_currency character varying(3),
    country_code character varying(2),
    language character varying(5),
    address_zip character varying(10),
    address_city character varying(100),
    address_street_name character varying(150),
    address_street_type character varying(50),
    address_house_number character varying(20),
    address_hrsz character varying(50),
    tax_number character varying(20),
    reg_number character varying(50),
    org_type data.orgtype,
    status character varying(30),
    is_deleted boolean,
    notification_settings json DEFAULT '{"notify_owner": true, "alert_days_before": [30, 15, 7, 1]}'::jsonb,
    external_integration_config json DEFAULT '{}'::jsonb,
    owner_id integer,
    is_active boolean,
    is_verified boolean,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone,
    folder_slug character varying(12)
);


ALTER TABLE data.organizations OWNER TO service_finder_app;

--
-- Name: organizations_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.organizations_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.organizations_id_seq OWNER TO service_finder_app;

--
-- Name: organizations_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.organizations_id_seq OWNED BY data.organizations.id;


--
-- Name: pending_actions; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.pending_actions (
    id integer NOT NULL,
    requester_id integer NOT NULL,
    approver_id integer,
    status data.actionstatus NOT NULL,
    action_type character varying(50) NOT NULL,
    payload json NOT NULL,
    reason character varying(255) NOT NULL,
    created_at timestamp with time zone DEFAULT now(),
    expires_at timestamp with time zone,
    processed_at timestamp with time zone
);


ALTER TABLE data.pending_actions OWNER TO service_finder_app;

--
-- Name: pending_actions_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.pending_actions_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.pending_actions_id_seq OWNER TO service_finder_app;

--
-- Name: pending_actions_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.pending_actions_id_seq OWNED BY data.pending_actions.id;


--
-- Name: persons; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.persons (
    id bigint NOT NULL,
    id_uuid uuid NOT NULL,
    address_id uuid,
    last_name character varying NOT NULL,
    first_name character varying NOT NULL,
    phone character varying,
    identity_docs json DEFAULT '{}'::jsonb,
    is_active boolean NOT NULL,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone,
    mothers_last_name character varying,
    mothers_first_name character varying,
    birth_place character varying,
    birth_date timestamp without time zone,
    ice_contact json DEFAULT '{}'::jsonb,
    is_ghost boolean DEFAULT true NOT NULL
);


ALTER TABLE data.persons OWNER TO service_finder_app;

--
-- Name: persons_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.persons_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.persons_id_seq OWNER TO service_finder_app;

--
-- Name: persons_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.persons_id_seq OWNED BY data.persons.id;


--
-- Name: point_rules; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.point_rules (
    id integer NOT NULL,
    action_key character varying NOT NULL,
    points integer NOT NULL,
    description character varying,
    is_active boolean NOT NULL
);


ALTER TABLE data.point_rules OWNER TO service_finder_app;

--
-- Name: point_rules_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.point_rules_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.point_rules_id_seq OWNER TO service_finder_app;

--
-- Name: point_rules_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.point_rules_id_seq OWNED BY data.point_rules.id;


--
-- Name: points_ledger; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.points_ledger (
    id integer NOT NULL,
    user_id integer NOT NULL,
    points integer NOT NULL,
    reason character varying NOT NULL,
    created_at timestamp without time zone NOT NULL,
    penalty_change integer DEFAULT 0 NOT NULL
);


ALTER TABLE data.points_ledger OWNER TO service_finder_app;

--
-- Name: points_ledger_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.points_ledger_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.points_ledger_id_seq OWNER TO service_finder_app;

--
-- Name: points_ledger_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.points_ledger_id_seq OWNED BY data.points_ledger.id;


--
-- Name: ratings; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.ratings (
    id uuid NOT NULL,
    author_id integer NOT NULL,
    target_type character varying(20) NOT NULL,
    target_id uuid NOT NULL,
    score integer NOT NULL,
    comment character varying
);


ALTER TABLE data.ratings OWNER TO service_finder_app;

--
-- Name: regional_settings; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.regional_settings (
    id integer NOT NULL,
    country_code character varying NOT NULL,
    currency character varying NOT NULL,
    is_active boolean NOT NULL
);


ALTER TABLE data.regional_settings OWNER TO service_finder_app;

--
-- Name: regional_settings_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.regional_settings_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.regional_settings_id_seq OWNER TO service_finder_app;

--
-- Name: regional_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.regional_settings_id_seq OWNED BY data.regional_settings.id;


--
-- Name: service_expertises; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.service_expertises (
    service_id integer NOT NULL,
    expertise_id integer NOT NULL,
    validation_level integer DEFAULT 0
);


ALTER TABLE data.service_expertises OWNER TO service_finder_app;

--
-- Name: service_profiles; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.service_profiles (
    id integer NOT NULL,
    organization_id integer,
    location data.geometry(Point,4326),
    trust_score integer DEFAULT 30,
    is_verified boolean DEFAULT false,
    verification_log json DEFAULT '{}'::jsonb,
    opening_hours json DEFAULT '{}'::jsonb,
    contact_phone character varying,
    website character varying,
    bio text,
    status character varying(20) DEFAULT 'ghost'::character varying,
    last_audit_at timestamp with time zone DEFAULT now(),
    google_place_id character varying(100),
    rating double precision,
    user_ratings_total integer,
    specialization_tags jsonb DEFAULT '{}'::jsonb
);


ALTER TABLE data.service_profiles OWNER TO service_finder_app;

--
-- Name: service_profiles_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.service_profiles_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.service_profiles_id_seq OWNER TO service_finder_app;

--
-- Name: service_profiles_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.service_profiles_id_seq OWNED BY data.service_profiles.id;


--
-- Name: service_specialties; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.service_specialties (
    id integer NOT NULL,
    parent_id integer,
    name character varying NOT NULL,
    slug character varying
);


ALTER TABLE data.service_specialties OWNER TO service_finder_app;

--
-- Name: service_specialties_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.service_specialties_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.service_specialties_id_seq OWNER TO service_finder_app;

--
-- Name: service_specialties_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.service_specialties_id_seq OWNED BY data.service_specialties.id;


--
-- Name: social_accounts; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.social_accounts (
    id integer NOT NULL,
    user_id integer NOT NULL,
    provider character varying(50) NOT NULL,
    social_id character varying(255) NOT NULL,
    email character varying(255) NOT NULL,
    extra_data json DEFAULT '{}'::jsonb,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE data.social_accounts OWNER TO service_finder_app;

--
-- Name: social_accounts_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

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


ALTER TABLE data.social_accounts_id_seq OWNER TO service_finder_app;

--
-- Name: social_accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

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


--
-- Name: subscription_tiers; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.subscription_tiers (
    id integer NOT NULL,
    name character varying,
    rules json,
    is_custom boolean
);


ALTER TABLE data.subscription_tiers OWNER TO service_finder_app;

--
-- Name: subscription_tiers_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.subscription_tiers_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.subscription_tiers_id_seq OWNER TO service_finder_app;

--
-- Name: subscription_tiers_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.subscription_tiers_id_seq OWNED BY data.subscription_tiers.id;


--
-- Name: system_parameters; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.system_parameters (
    key character varying(50) NOT NULL,
    value json NOT NULL,
    is_active boolean,
    description character varying,
    updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE data.system_parameters OWNER TO service_finder_app;

--
-- Name: translations; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.translations (
    id integer NOT NULL,
    key character varying(100) NOT NULL,
    lang_code character varying(5) NOT NULL,
    value text NOT NULL,
    is_published boolean
);


ALTER TABLE data.translations OWNER TO service_finder_app;

--
-- Name: translations_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.translations_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.translations_id_seq OWNER TO service_finder_app;

--
-- Name: translations_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.translations_id_seq OWNED BY data.translations.id;


--
-- Name: user_badges; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.user_badges (
    id integer NOT NULL,
    user_id integer NOT NULL,
    badge_id integer NOT NULL,
    earned_at timestamp without time zone NOT NULL
);


ALTER TABLE data.user_badges OWNER TO service_finder_app;

--
-- Name: user_badges_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.user_badges_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.user_badges_id_seq OWNER TO service_finder_app;

--
-- Name: user_badges_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.user_badges_id_seq OWNED BY data.user_badges.id;


--
-- Name: user_stats; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.user_stats (
    user_id integer NOT NULL,
    total_xp integer NOT NULL,
    social_points integer NOT NULL,
    current_level integer NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    penalty_points integer DEFAULT 0 NOT NULL,
    restriction_level integer DEFAULT 0 NOT NULL
);


ALTER TABLE data.user_stats OWNER TO service_finder_app;

--
-- Name: users; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.users (
    id integer NOT NULL,
    email character varying NOT NULL,
    hashed_password character varying,
    role data.userrole,
    is_active boolean,
    is_deleted boolean,
    person_id bigint,
    created_at timestamp with time zone DEFAULT now(),
    scope_level character varying(30) DEFAULT 'individual'::character varying,
    scope_id character varying(50),
    custom_permissions json DEFAULT '{}'::jsonb,
    preferred_language character varying(5) DEFAULT 'hu'::character varying,
    region_code character varying(5) DEFAULT 'HU'::character varying,
    folder_slug character varying(12),
    refresh_token_hash character varying(255),
    two_factor_secret character varying(100),
    two_factor_enabled boolean,
    preferred_currency character varying(3) DEFAULT 'HUF'::character varying
);


ALTER TABLE data.users OWNER TO service_finder_app;

--
-- Name: users_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

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


ALTER TABLE data.users_id_seq OWNER TO service_finder_app;

--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

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


--
-- Name: vehicle_catalog; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.vehicle_catalog (
    id integer NOT NULL,
    make character varying NOT NULL,
    model character varying NOT NULL,
    generation character varying,
    year_from integer,
    year_to integer,
    vehicle_class character varying,
    fuel_type character varying,
    engine_code character varying,
    factory_data jsonb DEFAULT '{}'::jsonb,
    engine_variant character varying
);


ALTER TABLE data.vehicle_catalog OWNER TO service_finder_app;

--
-- Name: vehicle_catalog_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.vehicle_catalog_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.vehicle_catalog_id_seq OWNER TO service_finder_app;

--
-- Name: vehicle_catalog_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.vehicle_catalog_id_seq OWNED BY data.vehicle_catalog.id;


--
-- Name: vehicle_ownerships; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.vehicle_ownerships (
    id integer NOT NULL,
    vehicle_id uuid NOT NULL,
    user_id integer NOT NULL,
    start_date date NOT NULL,
    end_date date,
    notes text
);


ALTER TABLE data.vehicle_ownerships OWNER TO service_finder_app;

--
-- Name: vehicle_ownerships_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.vehicle_ownerships_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.vehicle_ownerships_id_seq OWNER TO service_finder_app;

--
-- Name: vehicle_ownerships_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.vehicle_ownerships_id_seq OWNED BY data.vehicle_ownerships.id;


--
-- Name: verification_tokens; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.verification_tokens (
    id integer NOT NULL,
    token uuid NOT NULL,
    user_id integer NOT NULL,
    token_type character varying(20) NOT NULL,
    created_at timestamp with time zone DEFAULT now(),
    expires_at timestamp with time zone NOT NULL,
    is_used boolean
);


ALTER TABLE data.verification_tokens OWNER TO service_finder_app;

--
-- Name: verification_tokens_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.verification_tokens_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.verification_tokens_id_seq OWNER TO service_finder_app;

--
-- Name: verification_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.verification_tokens_id_seq OWNED BY data.verification_tokens.id;


--
-- Name: wallets; Type: TABLE; Schema: data; Owner: service_finder_app
--

CREATE TABLE data.wallets (
    id integer NOT NULL,
    user_id integer,
    coin_balance numeric(18,2),
    credit_balance numeric(18,2),
    currency character varying(3)
);


ALTER TABLE data.wallets OWNER TO service_finder_app;

--
-- Name: wallets_id_seq; Type: SEQUENCE; Schema: data; Owner: service_finder_app
--

CREATE SEQUENCE data.wallets_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE data.wallets_id_seq OWNER TO service_finder_app;

--
-- Name: wallets_id_seq; Type: SEQUENCE OWNED BY; Schema: data; Owner: service_finder_app
--

ALTER SEQUENCE data.wallets_id_seq OWNED BY data.wallets.id;


--
-- Name: alembic_version; Type: TABLE; Schema: public; Owner: service_finder_app
--

CREATE TABLE public.alembic_version (
    version_num character varying(32) NOT NULL
);


ALTER TABLE public.alembic_version OWNER TO service_finder_app;

--
-- Name: asset_financials id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_financials ALTER COLUMN id SET DEFAULT nextval('data.asset_financials_id_seq'::regclass);


--
-- Name: asset_reviews id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_reviews ALTER COLUMN id SET DEFAULT nextval('data.asset_reviews_id_seq'::regclass);


--
-- Name: asset_telemetry id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_telemetry ALTER COLUMN id SET DEFAULT nextval('data.asset_telemetry_id_seq'::regclass);


--
-- Name: audit_logs id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

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


--
-- Name: badges id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.badges ALTER COLUMN id SET DEFAULT nextval('data.badges_id_seq'::regclass);


--
-- Name: credit_logs id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.credit_logs ALTER COLUMN id SET DEFAULT nextval('data.credit_logs_id_seq'::regclass);


--
-- Name: exchange_rates id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.exchange_rates ALTER COLUMN id SET DEFAULT nextval('data.exchange_rates_id_seq'::regclass);


--
-- Name: expertise_tags id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.expertise_tags ALTER COLUMN id SET DEFAULT nextval('data.expertise_tags_id_seq'::regclass);


--
-- Name: geo_postal_codes id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.geo_postal_codes ALTER COLUMN id SET DEFAULT nextval('data.geo_postal_codes_id_seq'::regclass);


--
-- Name: geo_street_types id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.geo_street_types ALTER COLUMN id SET DEFAULT nextval('data.geo_street_types_id_seq'::regclass);


--
-- Name: geo_streets id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.geo_streets ALTER COLUMN id SET DEFAULT nextval('data.geo_streets_id_seq'::regclass);


--
-- Name: level_configs id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.level_configs ALTER COLUMN id SET DEFAULT nextval('data.level_configs_id_seq'::regclass);


--
-- Name: org_subscriptions id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.org_subscriptions ALTER COLUMN id SET DEFAULT nextval('data.org_subscriptions_id_seq'::regclass);


--
-- Name: organization_financials id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.organization_financials ALTER COLUMN id SET DEFAULT nextval('data.organization_financials_id_seq'::regclass);


--
-- Name: organization_members id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.organization_members ALTER COLUMN id SET DEFAULT nextval('data.organization_members_id_seq'::regclass);


--
-- Name: organizations id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.organizations ALTER COLUMN id SET DEFAULT nextval('data.organizations_id_seq'::regclass);


--
-- Name: pending_actions id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.pending_actions ALTER COLUMN id SET DEFAULT nextval('data.pending_actions_id_seq'::regclass);


--
-- Name: persons id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.persons ALTER COLUMN id SET DEFAULT nextval('data.persons_id_seq'::regclass);


--
-- Name: point_rules id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.point_rules ALTER COLUMN id SET DEFAULT nextval('data.point_rules_id_seq'::regclass);


--
-- Name: points_ledger id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.points_ledger ALTER COLUMN id SET DEFAULT nextval('data.points_ledger_id_seq'::regclass);


--
-- Name: regional_settings id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.regional_settings ALTER COLUMN id SET DEFAULT nextval('data.regional_settings_id_seq'::regclass);


--
-- Name: service_profiles id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.service_profiles ALTER COLUMN id SET DEFAULT nextval('data.service_profiles_id_seq'::regclass);


--
-- Name: service_specialties id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.service_specialties ALTER COLUMN id SET DEFAULT nextval('data.service_specialties_id_seq'::regclass);


--
-- Name: social_accounts id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.social_accounts ALTER COLUMN id SET DEFAULT nextval('data.social_accounts_id_seq'::regclass);


--
-- Name: subscription_tiers id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.subscription_tiers ALTER COLUMN id SET DEFAULT nextval('data.subscription_tiers_id_seq'::regclass);


--
-- Name: translations id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.translations ALTER COLUMN id SET DEFAULT nextval('data.translations_id_seq'::regclass);


--
-- Name: user_badges id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.user_badges ALTER COLUMN id SET DEFAULT nextval('data.user_badges_id_seq'::regclass);


--
-- Name: users id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.users ALTER COLUMN id SET DEFAULT nextval('data.users_id_seq'::regclass);


--
-- Name: vehicle_catalog id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.vehicle_catalog ALTER COLUMN id SET DEFAULT nextval('data.vehicle_catalog_id_seq'::regclass);


--
-- Name: vehicle_ownerships id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.vehicle_ownerships ALTER COLUMN id SET DEFAULT nextval('data.vehicle_ownerships_id_seq'::regclass);


--
-- Name: verification_tokens id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.verification_tokens ALTER COLUMN id SET DEFAULT nextval('data.verification_tokens_id_seq'::regclass);


--
-- Name: wallets id; Type: DEFAULT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.wallets ALTER COLUMN id SET DEFAULT nextval('data.wallets_id_seq'::regclass);


--
-- Name: addresses addresses_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.addresses
    ADD CONSTRAINT addresses_pkey PRIMARY KEY (id);


--
-- Name: asset_assignments asset_assignments_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_assignments
    ADD CONSTRAINT asset_assignments_pkey PRIMARY KEY (id);


--
-- Name: asset_costs asset_costs_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_costs
    ADD CONSTRAINT asset_costs_pkey PRIMARY KEY (id);


--
-- Name: asset_events asset_events_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_events
    ADD CONSTRAINT asset_events_pkey PRIMARY KEY (id);


--
-- Name: asset_financials asset_financials_asset_id_key; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_financials
    ADD CONSTRAINT asset_financials_asset_id_key UNIQUE (asset_id);


--
-- Name: asset_financials asset_financials_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_financials
    ADD CONSTRAINT asset_financials_pkey PRIMARY KEY (id);


--
-- Name: asset_reviews asset_reviews_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_reviews
    ADD CONSTRAINT asset_reviews_pkey PRIMARY KEY (id);


--
-- Name: asset_telemetry asset_telemetry_asset_id_key; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_telemetry
    ADD CONSTRAINT asset_telemetry_asset_id_key UNIQUE (asset_id);


--
-- Name: asset_telemetry asset_telemetry_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_telemetry
    ADD CONSTRAINT asset_telemetry_pkey PRIMARY KEY (id);


--
-- Name: assets assets_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.assets
    ADD CONSTRAINT assets_pkey PRIMARY KEY (id);


--
-- Name: audit_logs audit_logs_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

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


--
-- Name: badges badges_name_key; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.badges
    ADD CONSTRAINT badges_name_key UNIQUE (name);


--
-- Name: badges badges_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.badges
    ADD CONSTRAINT badges_pkey PRIMARY KEY (id);


--
-- Name: credit_logs credit_logs_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.credit_logs
    ADD CONSTRAINT credit_logs_pkey PRIMARY KEY (id);


--
-- Name: documents documents_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.documents
    ADD CONSTRAINT documents_pkey PRIMARY KEY (id);


--
-- Name: exchange_rates exchange_rates_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.exchange_rates
    ADD CONSTRAINT exchange_rates_pkey PRIMARY KEY (id);


--
-- Name: exchange_rates exchange_rates_target_currency_key; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.exchange_rates
    ADD CONSTRAINT exchange_rates_target_currency_key UNIQUE (target_currency);


--
-- Name: expertise_tags expertise_tags_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.expertise_tags
    ADD CONSTRAINT expertise_tags_pkey PRIMARY KEY (id);


--
-- Name: geo_postal_codes geo_postal_codes_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.geo_postal_codes
    ADD CONSTRAINT geo_postal_codes_pkey PRIMARY KEY (id);


--
-- Name: geo_street_types geo_street_types_name_key; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.geo_street_types
    ADD CONSTRAINT geo_street_types_name_key UNIQUE (name);


--
-- Name: geo_street_types geo_street_types_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.geo_street_types
    ADD CONSTRAINT geo_street_types_pkey PRIMARY KEY (id);


--
-- Name: geo_streets geo_streets_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.geo_streets
    ADD CONSTRAINT geo_streets_pkey PRIMARY KEY (id);


--
-- Name: level_configs level_configs_level_number_key; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.level_configs
    ADD CONSTRAINT level_configs_level_number_key UNIQUE (level_number);


--
-- Name: level_configs level_configs_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.level_configs
    ADD CONSTRAINT level_configs_pkey PRIMARY KEY (id);


--
-- Name: org_subscriptions org_subscriptions_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.org_subscriptions
    ADD CONSTRAINT org_subscriptions_pkey PRIMARY KEY (id);


--
-- Name: organization_financials organization_financials_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.organization_financials
    ADD CONSTRAINT organization_financials_pkey PRIMARY KEY (id);


--
-- Name: organization_members organization_members_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.organization_members
    ADD CONSTRAINT organization_members_pkey PRIMARY KEY (id);


--
-- Name: organizations organizations_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

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


--
-- Name: pending_actions pending_actions_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.pending_actions
    ADD CONSTRAINT pending_actions_pkey PRIMARY KEY (id);


--
-- Name: persons persons_id_uuid_key; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.persons
    ADD CONSTRAINT persons_id_uuid_key UNIQUE (id_uuid);


--
-- Name: persons persons_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.persons
    ADD CONSTRAINT persons_pkey PRIMARY KEY (id);


--
-- Name: point_rules point_rules_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.point_rules
    ADD CONSTRAINT point_rules_pkey PRIMARY KEY (id);


--
-- Name: points_ledger points_ledger_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.points_ledger
    ADD CONSTRAINT points_ledger_pkey PRIMARY KEY (id);


--
-- Name: ratings ratings_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.ratings
    ADD CONSTRAINT ratings_pkey PRIMARY KEY (id);


--
-- Name: regional_settings regional_settings_country_code_key; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.regional_settings
    ADD CONSTRAINT regional_settings_country_code_key UNIQUE (country_code);


--
-- Name: regional_settings regional_settings_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.regional_settings
    ADD CONSTRAINT regional_settings_pkey PRIMARY KEY (id);


--
-- Name: service_expertises service_expertises_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.service_expertises
    ADD CONSTRAINT service_expertises_pkey PRIMARY KEY (service_id, expertise_id);


--
-- Name: service_profiles service_profiles_google_place_id_key; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.service_profiles
    ADD CONSTRAINT service_profiles_google_place_id_key UNIQUE (google_place_id);


--
-- Name: service_profiles service_profiles_organization_id_key; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.service_profiles
    ADD CONSTRAINT service_profiles_organization_id_key UNIQUE (organization_id);


--
-- Name: service_profiles service_profiles_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.service_profiles
    ADD CONSTRAINT service_profiles_pkey PRIMARY KEY (id);


--
-- Name: service_specialties service_specialties_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.service_specialties
    ADD CONSTRAINT service_specialties_pkey PRIMARY KEY (id);


--
-- Name: service_specialties service_specialties_slug_key; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.service_specialties
    ADD CONSTRAINT service_specialties_slug_key UNIQUE (slug);


--
-- Name: social_accounts social_accounts_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.social_accounts
    ADD CONSTRAINT social_accounts_pkey PRIMARY KEY (id);


--
-- Name: subscription_tiers subscription_tiers_name_key; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.subscription_tiers
    ADD CONSTRAINT subscription_tiers_name_key UNIQUE (name);


--
-- Name: subscription_tiers subscription_tiers_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.subscription_tiers
    ADD CONSTRAINT subscription_tiers_pkey PRIMARY KEY (id);


--
-- Name: system_parameters system_parameters_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.system_parameters
    ADD CONSTRAINT system_parameters_pkey PRIMARY KEY (key);


--
-- Name: translations translations_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.translations
    ADD CONSTRAINT translations_pkey PRIMARY KEY (id);


--
-- Name: social_accounts uix_social_provider_id; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.social_accounts
    ADD CONSTRAINT uix_social_provider_id UNIQUE (provider, social_id);


--
-- Name: vehicle_catalog uix_vehicle_catalog_full; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.vehicle_catalog
    ADD CONSTRAINT uix_vehicle_catalog_full UNIQUE (make, model, year_from, engine_variant, fuel_type);


--
-- Name: translations uq_translation_key_lang; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.translations
    ADD CONSTRAINT uq_translation_key_lang UNIQUE (key, lang_code);


--
-- Name: user_badges user_badges_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.user_badges
    ADD CONSTRAINT user_badges_pkey PRIMARY KEY (id);


--
-- Name: user_stats user_stats_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.user_stats
    ADD CONSTRAINT user_stats_pkey PRIMARY KEY (user_id);


--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

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


--
-- Name: vehicle_catalog vehicle_catalog_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.vehicle_catalog
    ADD CONSTRAINT vehicle_catalog_pkey PRIMARY KEY (id);


--
-- Name: vehicle_ownerships vehicle_ownerships_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.vehicle_ownerships
    ADD CONSTRAINT vehicle_ownerships_pkey PRIMARY KEY (id);


--
-- Name: verification_tokens verification_tokens_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.verification_tokens
    ADD CONSTRAINT verification_tokens_pkey PRIMARY KEY (id);


--
-- Name: verification_tokens verification_tokens_token_key; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.verification_tokens
    ADD CONSTRAINT verification_tokens_token_key UNIQUE (token);


--
-- Name: wallets wallets_pkey; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.wallets
    ADD CONSTRAINT wallets_pkey PRIMARY KEY (id);


--
-- Name: wallets wallets_user_id_key; Type: CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.wallets
    ADD CONSTRAINT wallets_user_id_key UNIQUE (user_id);


--
-- Name: alembic_version alembic_version_pkc; Type: CONSTRAINT; Schema: public; Owner: service_finder_app
--

ALTER TABLE ONLY public.alembic_version
    ADD CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num);


--
-- Name: idx_service_profiles_location; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX idx_service_profiles_location ON data.service_profiles USING gist (location);


--
-- Name: ix_data_assets_license_plate; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_assets_license_plate ON data.assets USING btree (license_plate);


--
-- Name: ix_data_assets_vin; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE UNIQUE INDEX ix_data_assets_vin ON data.assets USING btree (vin);


--
-- Name: ix_data_audit_logs_action; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_audit_logs_action ON data.audit_logs USING btree (action);


--
-- Name: ix_data_audit_logs_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_audit_logs_id ON data.audit_logs USING btree (id);


--
-- Name: ix_data_audit_logs_ip_address; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_audit_logs_ip_address ON data.audit_logs USING btree (ip_address);


--
-- Name: ix_data_audit_logs_target_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_audit_logs_target_id ON data.audit_logs USING btree (target_id);


--
-- Name: ix_data_audit_logs_target_type; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_audit_logs_target_type ON data.audit_logs USING btree (target_type);


--
-- Name: ix_data_audit_logs_timestamp; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_audit_logs_timestamp ON data.audit_logs USING btree ("timestamp");


--
-- Name: ix_data_badges_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_badges_id ON data.badges USING btree (id);


--
-- Name: ix_data_expertise_tags_key; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE UNIQUE INDEX ix_data_expertise_tags_key ON data.expertise_tags USING btree (key);


--
-- Name: ix_data_level_configs_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_level_configs_id ON data.level_configs USING btree (id);


--
-- Name: ix_data_organization_financials_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_organization_financials_id ON data.organization_financials USING btree (id);


--
-- Name: ix_data_organization_members_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_organization_members_id ON data.organization_members USING btree (id);


--
-- Name: ix_data_organizations_folder_slug; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE UNIQUE INDEX ix_data_organizations_folder_slug ON data.organizations USING btree (folder_slug);


--
-- Name: ix_data_organizations_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_organizations_id ON data.organizations USING btree (id);


--
-- Name: ix_data_organizations_tax_number; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE UNIQUE INDEX ix_data_organizations_tax_number ON data.organizations USING btree (tax_number);


--
-- Name: ix_data_pending_actions_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_pending_actions_id ON data.pending_actions USING btree (id);


--
-- Name: ix_data_persons_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_persons_id ON data.persons USING btree (id);


--
-- Name: ix_data_point_rules_action_key; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE UNIQUE INDEX ix_data_point_rules_action_key ON data.point_rules USING btree (action_key);


--
-- Name: ix_data_point_rules_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_point_rules_id ON data.point_rules USING btree (id);


--
-- Name: ix_data_points_ledger_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_points_ledger_id ON data.points_ledger USING btree (id);


--
-- Name: ix_data_regional_settings_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_regional_settings_id ON data.regional_settings USING btree (id);


--
-- Name: ix_data_service_profiles_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_service_profiles_id ON data.service_profiles USING btree (id);


--
-- Name: ix_data_service_profiles_location; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_service_profiles_location ON data.service_profiles USING btree (location);


--
-- Name: ix_data_service_profiles_status; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_service_profiles_status ON data.service_profiles USING btree (status);


--
-- Name: ix_data_social_accounts_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_social_accounts_id ON data.social_accounts USING btree (id);


--
-- Name: ix_data_social_accounts_social_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_social_accounts_social_id ON data.social_accounts USING btree (social_id);


--
-- Name: ix_data_system_parameters_key; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_system_parameters_key ON data.system_parameters USING btree (key);


--
-- Name: ix_data_translations_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_translations_id ON data.translations USING btree (id);


--
-- Name: ix_data_translations_key; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_translations_key ON data.translations USING btree (key);


--
-- Name: ix_data_translations_lang_code; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_translations_lang_code ON data.translations USING btree (lang_code);


--
-- Name: ix_data_user_badges_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_user_badges_id ON data.user_badges USING btree (id);


--
-- Name: ix_data_users_email; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE UNIQUE INDEX ix_data_users_email ON data.users USING btree (email);


--
-- Name: ix_data_users_folder_slug; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE UNIQUE INDEX ix_data_users_folder_slug ON data.users USING btree (folder_slug);


--
-- Name: ix_data_users_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_users_id ON data.users USING btree (id);


--
-- Name: ix_data_vehicle_catalog_engine_variant; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_vehicle_catalog_engine_variant ON data.vehicle_catalog USING btree (engine_variant);


--
-- Name: ix_data_vehicle_catalog_fuel_type; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_vehicle_catalog_fuel_type ON data.vehicle_catalog USING btree (fuel_type);


--
-- Name: ix_data_vehicle_catalog_generation; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_vehicle_catalog_generation ON data.vehicle_catalog USING btree (generation);


--
-- Name: ix_data_vehicle_catalog_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_vehicle_catalog_id ON data.vehicle_catalog USING btree (id);


--
-- Name: ix_data_vehicle_catalog_make; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_vehicle_catalog_make ON data.vehicle_catalog USING btree (make);


--
-- Name: ix_data_vehicle_catalog_model; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_vehicle_catalog_model ON data.vehicle_catalog USING btree (model);


--
-- Name: ix_data_vehicle_ownerships_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_vehicle_ownerships_id ON data.vehicle_ownerships USING btree (id);


--
-- Name: ix_data_verification_tokens_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_verification_tokens_id ON data.verification_tokens USING btree (id);


--
-- Name: ix_data_wallets_id; Type: INDEX; Schema: data; Owner: service_finder_app
--

CREATE INDEX ix_data_wallets_id ON data.wallets USING btree (id);


--
-- Name: addresses addresses_postal_code_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.addresses
    ADD CONSTRAINT addresses_postal_code_id_fkey FOREIGN KEY (postal_code_id) REFERENCES data.geo_postal_codes(id);


--
-- Name: asset_assignments asset_assignments_asset_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_assignments
    ADD CONSTRAINT asset_assignments_asset_id_fkey FOREIGN KEY (asset_id) REFERENCES data.assets(id);


--
-- Name: asset_assignments asset_assignments_organization_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_assignments
    ADD CONSTRAINT asset_assignments_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES data.organizations(id);


--
-- Name: asset_costs asset_costs_asset_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_costs
    ADD CONSTRAINT asset_costs_asset_id_fkey FOREIGN KEY (asset_id) REFERENCES data.assets(id);


--
-- Name: asset_costs asset_costs_driver_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_costs
    ADD CONSTRAINT asset_costs_driver_id_fkey FOREIGN KEY (driver_id) REFERENCES data.users(id);


--
-- Name: asset_costs asset_costs_organization_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_costs
    ADD CONSTRAINT asset_costs_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES data.organizations(id);


--
-- Name: asset_events asset_events_asset_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_events
    ADD CONSTRAINT asset_events_asset_id_fkey FOREIGN KEY (asset_id) REFERENCES data.assets(id);


--
-- Name: asset_financials asset_financials_asset_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_financials
    ADD CONSTRAINT asset_financials_asset_id_fkey FOREIGN KEY (asset_id) REFERENCES data.assets(id);


--
-- Name: asset_reviews asset_reviews_asset_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_reviews
    ADD CONSTRAINT asset_reviews_asset_id_fkey FOREIGN KEY (asset_id) REFERENCES data.assets(id);


--
-- Name: asset_reviews asset_reviews_user_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_reviews
    ADD CONSTRAINT asset_reviews_user_id_fkey FOREIGN KEY (user_id) REFERENCES data.users(id);


--
-- Name: asset_telemetry asset_telemetry_asset_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.asset_telemetry
    ADD CONSTRAINT asset_telemetry_asset_id_fkey FOREIGN KEY (asset_id) REFERENCES data.assets(id);


--
-- Name: assets assets_catalog_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.assets
    ADD CONSTRAINT assets_catalog_id_fkey FOREIGN KEY (catalog_id) REFERENCES data.vehicle_catalog(id);


--
-- Name: assets assets_current_organization_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.assets
    ADD CONSTRAINT assets_current_organization_id_fkey FOREIGN KEY (current_organization_id) REFERENCES data.organizations(id);


--
-- Name: audit_logs audit_logs_user_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

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


--
-- Name: credit_logs credit_logs_org_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.credit_logs
    ADD CONSTRAINT credit_logs_org_id_fkey FOREIGN KEY (org_id) REFERENCES data.organizations(id);


--
-- Name: documents documents_uploaded_by_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.documents
    ADD CONSTRAINT documents_uploaded_by_fkey FOREIGN KEY (uploaded_by) REFERENCES data.users(id);


--
-- Name: geo_streets geo_streets_postal_code_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.geo_streets
    ADD CONSTRAINT geo_streets_postal_code_id_fkey FOREIGN KEY (postal_code_id) REFERENCES data.geo_postal_codes(id);


--
-- Name: org_subscriptions org_subscriptions_org_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.org_subscriptions
    ADD CONSTRAINT org_subscriptions_org_id_fkey FOREIGN KEY (org_id) REFERENCES data.organizations(id);


--
-- Name: org_subscriptions org_subscriptions_tier_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.org_subscriptions
    ADD CONSTRAINT org_subscriptions_tier_id_fkey FOREIGN KEY (tier_id) REFERENCES data.subscription_tiers(id);


--
-- Name: organization_financials organization_financials_organization_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.organization_financials
    ADD CONSTRAINT organization_financials_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES data.organizations(id);


--
-- Name: organization_members organization_members_organization_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.organization_members
    ADD CONSTRAINT organization_members_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES data.organizations(id);


--
-- Name: organization_members organization_members_person_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.organization_members
    ADD CONSTRAINT organization_members_person_id_fkey FOREIGN KEY (person_id) REFERENCES data.persons(id);


--
-- Name: organization_members organization_members_user_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.organization_members
    ADD CONSTRAINT organization_members_user_id_fkey FOREIGN KEY (user_id) REFERENCES data.users(id);


--
-- Name: organizations organizations_address_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.organizations
    ADD CONSTRAINT organizations_address_id_fkey FOREIGN KEY (address_id) REFERENCES data.addresses(id);


--
-- Name: organizations organizations_owner_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.organizations
    ADD CONSTRAINT organizations_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES data.users(id);


--
-- Name: pending_actions pending_actions_approver_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.pending_actions
    ADD CONSTRAINT pending_actions_approver_id_fkey FOREIGN KEY (approver_id) REFERENCES data.users(id);


--
-- Name: pending_actions pending_actions_requester_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.pending_actions
    ADD CONSTRAINT pending_actions_requester_id_fkey FOREIGN KEY (requester_id) REFERENCES data.users(id);


--
-- Name: persons persons_address_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.persons
    ADD CONSTRAINT persons_address_id_fkey FOREIGN KEY (address_id) REFERENCES data.addresses(id);


--
-- Name: points_ledger points_ledger_user_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.points_ledger
    ADD CONSTRAINT points_ledger_user_id_fkey FOREIGN KEY (user_id) REFERENCES data.users(id);


--
-- Name: ratings ratings_author_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.ratings
    ADD CONSTRAINT ratings_author_id_fkey FOREIGN KEY (author_id) REFERENCES data.users(id);


--
-- Name: service_expertises service_expertises_expertise_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.service_expertises
    ADD CONSTRAINT service_expertises_expertise_id_fkey FOREIGN KEY (expertise_id) REFERENCES data.expertise_tags(id);


--
-- Name: service_expertises service_expertises_service_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.service_expertises
    ADD CONSTRAINT service_expertises_service_id_fkey FOREIGN KEY (service_id) REFERENCES data.service_profiles(id);


--
-- Name: service_profiles service_profiles_organization_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.service_profiles
    ADD CONSTRAINT service_profiles_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES data.organizations(id);


--
-- Name: service_specialties service_specialties_parent_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.service_specialties
    ADD CONSTRAINT service_specialties_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES data.service_specialties(id);


--
-- Name: social_accounts social_accounts_user_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.social_accounts
    ADD CONSTRAINT social_accounts_user_id_fkey FOREIGN KEY (user_id) REFERENCES data.users(id) ON DELETE CASCADE;


--
-- Name: user_badges user_badges_badge_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.user_badges
    ADD CONSTRAINT user_badges_badge_id_fkey FOREIGN KEY (badge_id) REFERENCES data.badges(id);


--
-- Name: user_badges user_badges_user_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.user_badges
    ADD CONSTRAINT user_badges_user_id_fkey FOREIGN KEY (user_id) REFERENCES data.users(id);


--
-- Name: user_stats user_stats_user_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.user_stats
    ADD CONSTRAINT user_stats_user_id_fkey FOREIGN KEY (user_id) REFERENCES data.users(id);


--
-- Name: users users_person_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.users
    ADD CONSTRAINT users_person_id_fkey FOREIGN KEY (person_id) REFERENCES data.persons(id);


--
-- Name: vehicle_ownerships vehicle_ownerships_user_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.vehicle_ownerships
    ADD CONSTRAINT vehicle_ownerships_user_id_fkey FOREIGN KEY (user_id) REFERENCES data.users(id);


--
-- Name: vehicle_ownerships vehicle_ownerships_vehicle_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.vehicle_ownerships
    ADD CONSTRAINT vehicle_ownerships_vehicle_id_fkey FOREIGN KEY (vehicle_id) REFERENCES data.assets(id);


--
-- Name: verification_tokens verification_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.verification_tokens
    ADD CONSTRAINT verification_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES data.users(id) ON DELETE CASCADE;


--
-- Name: wallets wallets_user_id_fkey; Type: FK CONSTRAINT; Schema: data; Owner: service_finder_app
--

ALTER TABLE ONLY data.wallets
    ADD CONSTRAINT wallets_user_id_fkey FOREIGN KEY (user_id) REFERENCES data.users(id);


--
-- Name: SCHEMA data; Type: ACL; Schema: -; Owner: service_finder_app
--

GRANT USAGE ON SCHEMA data TO n8n_hunter;
GRANT USAGE ON SCHEMA data TO PUBLIC;


--
-- Name: TABLE addresses; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.addresses TO n8n_hunter;
GRANT ALL ON TABLE data.addresses TO PUBLIC;


--
-- Name: TABLE asset_assignments; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.asset_assignments TO n8n_hunter;
GRANT ALL ON TABLE data.asset_assignments TO PUBLIC;


--
-- Name: TABLE asset_costs; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.asset_costs TO n8n_hunter;
GRANT ALL ON TABLE data.asset_costs TO PUBLIC;


--
-- Name: TABLE asset_events; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.asset_events TO n8n_hunter;
GRANT ALL ON TABLE data.asset_events TO PUBLIC;


--
-- Name: TABLE asset_financials; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.asset_financials TO n8n_hunter;
GRANT ALL ON TABLE data.asset_financials TO PUBLIC;


--
-- Name: TABLE asset_reviews; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.asset_reviews TO n8n_hunter;
GRANT ALL ON TABLE data.asset_reviews TO PUBLIC;


--
-- Name: TABLE asset_telemetry; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.asset_telemetry TO n8n_hunter;
GRANT ALL ON TABLE data.asset_telemetry TO PUBLIC;


--
-- Name: TABLE assets; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.assets TO n8n_hunter;
GRANT ALL ON TABLE data.assets TO PUBLIC;


--
-- Name: TABLE audit_logs; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.audit_logs TO n8n_hunter;
GRANT ALL ON TABLE data.audit_logs TO PUBLIC;


--
-- Name: TABLE badges; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.badges TO n8n_hunter;
GRANT ALL ON TABLE data.badges TO PUBLIC;


--
-- Name: TABLE credit_logs; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.credit_logs TO n8n_hunter;
GRANT ALL ON TABLE data.credit_logs TO PUBLIC;


--
-- Name: TABLE documents; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.documents TO n8n_hunter;
GRANT ALL ON TABLE data.documents TO PUBLIC;


--
-- Name: TABLE exchange_rates; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.exchange_rates TO n8n_hunter;
GRANT ALL ON TABLE data.exchange_rates TO PUBLIC;


--
-- Name: TABLE expertise_tags; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.expertise_tags TO n8n_hunter;
GRANT ALL ON TABLE data.expertise_tags TO PUBLIC;


--
-- Name: TABLE geo_postal_codes; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.geo_postal_codes TO n8n_hunter;
GRANT ALL ON TABLE data.geo_postal_codes TO PUBLIC;


--
-- Name: TABLE geo_street_types; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.geo_street_types TO n8n_hunter;
GRANT ALL ON TABLE data.geo_street_types TO PUBLIC;


--
-- Name: TABLE geo_streets; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.geo_streets TO n8n_hunter;
GRANT ALL ON TABLE data.geo_streets TO PUBLIC;


--
-- Name: TABLE geography_columns; Type: ACL; Schema: data; Owner: service_finder_app
--

REVOKE ALL ON TABLE data.geography_columns FROM kincses;
REVOKE ALL ON TABLE data.geography_columns FROM service_finder_app;
REVOKE SELECT ON TABLE data.geography_columns FROM PUBLIC;
GRANT ALL ON TABLE data.geography_columns TO service_finder_app;
GRANT ALL ON TABLE data.geography_columns TO PUBLIC;
GRANT ALL ON TABLE data.geography_columns TO n8n_hunter;


--
-- Name: TABLE geometry_columns; Type: ACL; Schema: data; Owner: service_finder_app
--

REVOKE ALL ON TABLE data.geometry_columns FROM kincses;
REVOKE ALL ON TABLE data.geometry_columns FROM service_finder_app;
REVOKE SELECT ON TABLE data.geometry_columns FROM PUBLIC;
GRANT ALL ON TABLE data.geometry_columns TO service_finder_app;
GRANT ALL ON TABLE data.geometry_columns TO PUBLIC;
GRANT ALL ON TABLE data.geometry_columns TO n8n_hunter;


--
-- Name: TABLE level_configs; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.level_configs TO n8n_hunter;
GRANT ALL ON TABLE data.level_configs TO PUBLIC;


--
-- Name: TABLE org_subscriptions; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.org_subscriptions TO n8n_hunter;
GRANT ALL ON TABLE data.org_subscriptions TO PUBLIC;


--
-- Name: TABLE organization_financials; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.organization_financials TO n8n_hunter;
GRANT ALL ON TABLE data.organization_financials TO PUBLIC;


--
-- Name: TABLE organization_members; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.organization_members TO n8n_hunter;
GRANT ALL ON TABLE data.organization_members TO PUBLIC;


--
-- Name: TABLE organizations; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.organizations TO n8n_hunter;
GRANT ALL ON TABLE data.organizations TO PUBLIC;


--
-- Name: TABLE pending_actions; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.pending_actions TO n8n_hunter;
GRANT ALL ON TABLE data.pending_actions TO PUBLIC;


--
-- Name: TABLE persons; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.persons TO n8n_hunter;
GRANT ALL ON TABLE data.persons TO PUBLIC;


--
-- Name: TABLE point_rules; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.point_rules TO n8n_hunter;
GRANT ALL ON TABLE data.point_rules TO PUBLIC;


--
-- Name: TABLE points_ledger; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.points_ledger TO n8n_hunter;
GRANT ALL ON TABLE data.points_ledger TO PUBLIC;


--
-- Name: TABLE ratings; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.ratings TO n8n_hunter;
GRANT ALL ON TABLE data.ratings TO PUBLIC;


--
-- Name: TABLE regional_settings; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.regional_settings TO n8n_hunter;
GRANT ALL ON TABLE data.regional_settings TO PUBLIC;


--
-- Name: TABLE service_expertises; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.service_expertises TO n8n_hunter;
GRANT ALL ON TABLE data.service_expertises TO PUBLIC;


--
-- Name: TABLE service_profiles; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.service_profiles TO n8n_hunter;
GRANT ALL ON TABLE data.service_profiles TO PUBLIC;


--
-- Name: TABLE service_specialties; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.service_specialties TO n8n_hunter;
GRANT ALL ON TABLE data.service_specialties TO PUBLIC;


--
-- Name: TABLE social_accounts; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.social_accounts TO n8n_hunter;
GRANT ALL ON TABLE data.social_accounts TO PUBLIC;


--
-- Name: TABLE spatial_ref_sys; Type: ACL; Schema: data; Owner: service_finder_app
--

REVOKE ALL ON TABLE data.spatial_ref_sys FROM kincses;
REVOKE ALL ON TABLE data.spatial_ref_sys FROM service_finder_app;
REVOKE SELECT ON TABLE data.spatial_ref_sys FROM PUBLIC;
GRANT ALL ON TABLE data.spatial_ref_sys TO service_finder_app;
GRANT ALL ON TABLE data.spatial_ref_sys TO PUBLIC;
GRANT ALL ON TABLE data.spatial_ref_sys TO n8n_hunter;


--
-- Name: TABLE subscription_tiers; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.subscription_tiers TO n8n_hunter;
GRANT ALL ON TABLE data.subscription_tiers TO PUBLIC;


--
-- Name: TABLE system_parameters; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.system_parameters TO n8n_hunter;
GRANT ALL ON TABLE data.system_parameters TO PUBLIC;


--
-- Name: TABLE translations; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.translations TO n8n_hunter;
GRANT ALL ON TABLE data.translations TO PUBLIC;


--
-- Name: TABLE user_badges; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.user_badges TO n8n_hunter;
GRANT ALL ON TABLE data.user_badges TO PUBLIC;


--
-- Name: TABLE user_stats; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.user_stats TO n8n_hunter;
GRANT ALL ON TABLE data.user_stats TO PUBLIC;


--
-- Name: TABLE users; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.users TO n8n_hunter;
GRANT ALL ON TABLE data.users TO PUBLIC;


--
-- Name: TABLE vehicle_catalog; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.vehicle_catalog TO n8n_hunter;
GRANT ALL ON TABLE data.vehicle_catalog TO PUBLIC;


--
-- Name: TABLE vehicle_ownerships; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.vehicle_ownerships TO n8n_hunter;
GRANT ALL ON TABLE data.vehicle_ownerships TO PUBLIC;


--
-- Name: TABLE verification_tokens; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.verification_tokens TO n8n_hunter;
GRANT ALL ON TABLE data.verification_tokens TO PUBLIC;


--
-- Name: TABLE wallets; Type: ACL; Schema: data; Owner: service_finder_app
--

GRANT ALL ON TABLE data.wallets TO n8n_hunter;
GRANT ALL ON TABLE data.wallets TO PUBLIC;


--
-- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: data; Owner: kincses
--

ALTER DEFAULT PRIVILEGES FOR ROLE kincses IN SCHEMA data GRANT ALL ON SEQUENCES  TO service_finder_app;


--
-- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: data; Owner: kincses
--

ALTER DEFAULT PRIVILEGES FOR ROLE kincses IN SCHEMA data GRANT ALL ON TABLES  TO service_finder_app;
ALTER DEFAULT PRIVILEGES FOR ROLE kincses IN SCHEMA data GRANT ALL ON TABLES  TO n8n_hunter;


--
-- PostgreSQL database dump complete
--

