--
-- PostgreSQL database dump
--

-- Dumped from database version 17.0
-- Dumped by pg_dump version 17.2

-- Started on 2025-12-21 03:25:29

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_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;

--
-- TOC entry 5 (class 2615 OID 33545)
-- Name: public; Type: SCHEMA; Schema: -; Owner: postgres
--

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


ALTER SCHEMA public OWNER TO postgres;

--
-- TOC entry 5231 (class 0 OID 0)
-- Dependencies: 5
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--

COMMENT ON SCHEMA public IS '';


SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- TOC entry 217 (class 1259 OID 33547)
-- Name: agent_bank_account; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.agent_bank_account (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    account_number character varying(50) NOT NULL,
    bank character varying(100) NOT NULL,
    branch_code character varying(20) NOT NULL,
    is_primary boolean NOT NULL,
    agent_id uuid NOT NULL
);


ALTER TABLE public.agent_bank_account OWNER TO postgres;

--
-- TOC entry 218 (class 1259 OID 33552)
-- Name: agent_contract; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.agent_contract (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    base_salary_ref numeric(19,2),
    contract_type character varying(50) NOT NULL,
    end_date date,
    is_active boolean NOT NULL,
    start_date date NOT NULL,
    weekly_hours numeric(5,2),
    agent_id uuid NOT NULL,
    org_unit_id uuid,
    position_id uuid,
    salary_category_id uuid,
    salary_grade_id uuid,
    salary_step_id uuid,
    legal_act_reference character varying(100)
);


ALTER TABLE public.agent_contract OWNER TO postgres;

--
-- TOC entry 219 (class 1259 OID 33557)
-- Name: agent_deduction_rule; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.agent_deduction_rule (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    amount_fixed numeric(19,2),
    percentage numeric(5,2),
    valid_from date NOT NULL,
    valid_to date,
    agent_id uuid NOT NULL,
    deduction_type_id uuid NOT NULL
);


ALTER TABLE public.agent_deduction_rule OWNER TO postgres;

--
-- TOC entry 220 (class 1259 OID 33562)
-- Name: agent_status_history; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.agent_status_history (
    id uuid NOT NULL,
    changed_at timestamp(6) without time zone NOT NULL,
    changed_by character varying(100),
    new_status character varying(20) NOT NULL,
    previous_status character varying(20),
    reason character varying(500),
    agent_id uuid NOT NULL,
    event_type character varying(50),
    new_functional_situation character varying(50),
    previous_functional_situation character varying(50),
    change_log character varying(1000)
);


ALTER TABLE public.agent_status_history OWNER TO postgres;

--
-- TOC entry 221 (class 1259 OID 33569)
-- Name: agents; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.agents (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    address character varying(500),
    bi_number character varying(20) NOT NULL,
    birth_date date NOT NULL,
    email character varying(100),
    full_name character varying(200) NOT NULL,
    hire_date date NOT NULL,
    matricula character varying(20) NOT NULL,
    nationality character varying(50),
    nif character varying(20) NOT NULL,
    org_unit_id uuid,
    phone character varying(20),
    position_id uuid,
    status character varying(20) NOT NULL,
    termination_date date,
    appointment_type character varying(50) NOT NULL,
    functional_situation character varying(50) NOT NULL,
    literary_qualification character varying(100),
    posse_date date,
    salary_category_id uuid,
    salary_grade_id uuid,
    salary_step_id uuid,
    eligible_dependents_count integer
);


ALTER TABLE public.agents OWNER TO postgres;

--
-- TOC entry 222 (class 1259 OID 33576)
-- Name: audit_log; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.audit_log (
    id uuid NOT NULL,
    action character varying(50) NOT NULL,
    created_at timestamp(6) with time zone NOT NULL,
    description character varying(1000),
    entity character varying(100) NOT NULL,
    entity_id uuid,
    module character varying(50) NOT NULL,
    user_id uuid NOT NULL,
    username character varying(100)
);


ALTER TABLE public.audit_log OWNER TO postgres;

--
-- TOC entry 223 (class 1259 OID 33583)
-- Name: bank; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.bank (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    code character varying(20) NOT NULL,
    name character varying(200) NOT NULL,
    swift_code character varying(20)
);


ALTER TABLE public.bank OWNER TO postgres;

--
-- TOC entry 224 (class 1259 OID 33588)
-- Name: budget_allocation; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.budget_allocation (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    adjustment_amount numeric(19,2) NOT NULL,
    initial_amount numeric(19,2) NOT NULL,
    budget_line_id uuid NOT NULL
);


ALTER TABLE public.budget_allocation OWNER TO postgres;

--
-- TOC entry 225 (class 1259 OID 33593)
-- Name: budget_execution; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.budget_execution (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    amount numeric(19,2) NOT NULL,
    movement_type character varying(50) NOT NULL,
    period_id bigint,
    reference_id uuid,
    source_module character varying(50) NOT NULL,
    budget_line_id uuid NOT NULL
);


ALTER TABLE public.budget_execution OWNER TO postgres;

--
-- TOC entry 226 (class 1259 OID 33598)
-- Name: budget_line; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.budget_line (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    code character varying(50) NOT NULL,
    description character varying(500) NOT NULL,
    economic_class character varying(100) NOT NULL,
    ministry_id uuid NOT NULL,
    org_unit_id uuid NOT NULL,
    fiscal_year_id uuid NOT NULL
);


ALTER TABLE public.budget_line OWNER TO postgres;

--
-- TOC entry 248 (class 1259 OID 33953)
-- Name: career_events; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.career_events (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    cargo_amount numeric(19,2),
    created_by_user character varying(255),
    document_ref character varying(100),
    effective_date date NOT NULL,
    event_type character varying(50) NOT NULL,
    exercicio_amount numeric(19,2),
    new_category uuid,
    new_grade uuid,
    new_org_unit uuid,
    new_position uuid,
    new_step uuid,
    previous_category uuid,
    previous_grade uuid,
    previous_org_unit uuid,
    previous_position uuid,
    previous_step uuid,
    publication_date date,
    reason character varying(500),
    total_base_amount numeric(19,2),
    agent_id uuid NOT NULL,
    CONSTRAINT career_events_event_type_check CHECK (((event_type)::text = ANY (ARRAY[('ADMISSAO'::character varying)::text, ('NOMEACAO_PROVISORIA'::character varying)::text, ('NOMEACAO_DEFINITIVA'::character varying)::text, ('PROMOCAO'::character varying)::text, ('PROGRESSAO'::character varying)::text, ('SUBSTITUICAO'::character varying)::text, ('TRANSFERENCIA'::character varying)::text, ('RECLASSIFICACAO'::character varying)::text, ('COMISSAO_SERVICO'::character varying)::text, ('DESTACAMENTO'::character varying)::text, ('REQUISICAO'::character varying)::text, ('SUSPENSAO'::character varying)::text, ('TERMINATION'::character varying)::text, ('RETIFICACAO'::character varying)::text])))
);


ALTER TABLE public.career_events OWNER TO postgres;

--
-- TOC entry 227 (class 1259 OID 33605)
-- Name: deduction_type; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.deduction_type (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    code character varying(50) NOT NULL,
    mandatory boolean NOT NULL,
    name character varying(200) NOT NULL,
    economic_class_code character varying(20)
);


ALTER TABLE public.deduction_type OWNER TO postgres;

--
-- TOC entry 228 (class 1259 OID 33610)
-- Name: earning_type; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.earning_type (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    code character varying(50) NOT NULL,
    name character varying(200) NOT NULL,
    taxable boolean NOT NULL,
    economic_class_code character varying(20)
);


ALTER TABLE public.earning_type OWNER TO postgres;

--
-- TOC entry 229 (class 1259 OID 33615)
-- Name: fiscal_year; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.fiscal_year (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    end_date date NOT NULL,
    start_date date NOT NULL,
    status character varying(20) NOT NULL,
    year integer NOT NULL
);


ALTER TABLE public.fiscal_year OWNER TO postgres;

--
-- TOC entry 250 (class 1259 OID 33982)
-- Name: global_deduction_rule; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.global_deduction_rule (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    active boolean NOT NULL,
    amount_fixed numeric(19,2),
    percentage numeric(5,4) NOT NULL,
    valid_from date NOT NULL,
    valid_to date,
    deduction_type_id uuid NOT NULL
);


ALTER TABLE public.global_deduction_rule OWNER TO postgres;

--
-- TOC entry 230 (class 1259 OID 33620)
-- Name: ministry; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.ministry (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    acronym character varying(20),
    code character varying(50) NOT NULL,
    description character varying(255),
    is_active boolean NOT NULL,
    logo text,
    name character varying(200) NOT NULL
);


ALTER TABLE public.ministry OWNER TO postgres;

--
-- TOC entry 231 (class 1259 OID 33627)
-- Name: org_unit; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.org_unit (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    acronym character varying(20),
    address character varying(255),
    code character varying(50) NOT NULL,
    email character varying(100),
    is_active boolean NOT NULL,
    name character varying(200) NOT NULL,
    phone character varying(20),
    unit_type character varying(50) NOT NULL,
    ministry_id uuid NOT NULL,
    parent_unit_id uuid
);


ALTER TABLE public.org_unit OWNER TO postgres;

--
-- TOC entry 232 (class 1259 OID 33634)
-- Name: payment_batch; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.payment_batch (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    ministry_id uuid,
    period_id bigint,
    status character varying(20) NOT NULL
);


ALTER TABLE public.payment_batch OWNER TO postgres;

--
-- TOC entry 233 (class 1259 OID 33639)
-- Name: payment_order; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.payment_order (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    agent_id uuid,
    bank_account_id uuid,
    budget_line_id uuid,
    gross_amount numeric(19,2) NOT NULL,
    net_amount numeric(19,2) NOT NULL,
    payroll_run_id bigint,
    status character varying(20) NOT NULL,
    payment_batch_id uuid NOT NULL
);


ALTER TABLE public.payment_order OWNER TO postgres;

--
-- TOC entry 234 (class 1259 OID 33644)
-- Name: payments; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.payments (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    amount numeric(19,2) NOT NULL,
    beneficiary character varying(200) NOT NULL,
    beneficiary_document character varying(50),
    budget_execution_id uuid,
    description character varying(500),
    due_date date NOT NULL,
    notes character varying(500),
    paid_date date,
    payment_date date NOT NULL,
    payment_method character varying(100),
    payment_number character varying(50) NOT NULL,
    status character varying(50) NOT NULL
);


ALTER TABLE public.payments OWNER TO postgres;

--
-- TOC entry 235 (class 1259 OID 33651)
-- Name: payroll_item; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.payroll_item (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    agent_id uuid NOT NULL,
    budget_line_id uuid,
    description character varying(500),
    line_type character varying(20) NOT NULL,
    quantity numeric(10,2),
    total_amount numeric(19,2) NOT NULL,
    unit_amount numeric(19,2),
    deduction_type_id uuid,
    earning_type_id uuid,
    payroll_run_id uuid NOT NULL
);


ALTER TABLE public.payroll_item OWNER TO postgres;

--
-- TOC entry 236 (class 1259 OID 33658)
-- Name: payroll_period; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.payroll_period (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    end_date date NOT NULL,
    fiscal_year integer NOT NULL,
    month integer NOT NULL,
    start_date date NOT NULL,
    status character varying(20) NOT NULL
);


ALTER TABLE public.payroll_period OWNER TO postgres;

--
-- TOC entry 237 (class 1259 OID 33663)
-- Name: payroll_run; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.payroll_run (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    ministry_id uuid,
    org_unit_id uuid,
    run_type character varying(50) NOT NULL,
    status character varying(20) NOT NULL,
    period_id uuid NOT NULL
);


ALTER TABLE public.payroll_run OWNER TO postgres;

--
-- TOC entry 249 (class 1259 OID 33961)
-- Name: performance_evaluations; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.performance_evaluations (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    evaluation_date date,
    observations character varying(255),
    qualitative_mention character varying(50) NOT NULL,
    reference_year integer NOT NULL,
    score double precision NOT NULL,
    agent_id uuid NOT NULL
);


ALTER TABLE public.performance_evaluations OWNER TO postgres;

--
-- TOC entry 238 (class 1259 OID 33668)
-- Name: permissions; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.permissions (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    code character varying(100) NOT NULL,
    description character varying(200) NOT NULL,
    module character varying(50)
);


ALTER TABLE public.permissions OWNER TO postgres;

--
-- TOC entry 239 (class 1259 OID 33673)
-- Name: position; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public."position" (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    code character varying(50) NOT NULL,
    is_active boolean NOT NULL,
    level character varying(50),
    title character varying(200) NOT NULL,
    org_unit_id uuid NOT NULL
);


ALTER TABLE public."position" OWNER TO postgres;

--
-- TOC entry 240 (class 1259 OID 33678)
-- Name: role; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.role (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    code character varying(50) NOT NULL,
    description character varying(500),
    name character varying(200) NOT NULL
);


ALTER TABLE public.role OWNER TO postgres;

--
-- TOC entry 241 (class 1259 OID 33685)
-- Name: salary_category; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.salary_category (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    code character varying(50) NOT NULL,
    name character varying(200) NOT NULL
);


ALTER TABLE public.salary_category OWNER TO postgres;

--
-- TOC entry 242 (class 1259 OID 33690)
-- Name: salary_grade; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.salary_grade (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    code character varying(50) NOT NULL,
    name character varying(200) NOT NULL,
    category_id uuid NOT NULL
);


ALTER TABLE public.salary_grade OWNER TO postgres;

--
-- TOC entry 243 (class 1259 OID 33695)
-- Name: salary_grid; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.salary_grid (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    base_amount numeric(19,2) NOT NULL,
    valid_from date NOT NULL,
    valid_to date,
    step_id uuid NOT NULL
);


ALTER TABLE public.salary_grid OWNER TO postgres;

--
-- TOC entry 244 (class 1259 OID 33700)
-- Name: salary_step; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.salary_step (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    step_number integer NOT NULL,
    grade_id uuid NOT NULL
);


ALTER TABLE public.salary_step OWNER TO postgres;

--
-- TOC entry 251 (class 1259 OID 33987)
-- Name: tax_bracket; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.tax_bracket (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    created_by uuid,
    updated_by uuid,
    excess_deduction numeric(19,2) NOT NULL,
    lower_limit numeric(19,2) NOT NULL,
    rate_percentage numeric(5,4) NOT NULL,
    upper_limit numeric(19,2),
    valid_from date NOT NULL,
    valid_to date,
    deduction_type_id uuid NOT NULL
);


ALTER TABLE public.tax_bracket OWNER TO postgres;

--
-- TOC entry 245 (class 1259 OID 33705)
-- Name: treasury_payment; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.treasury_payment (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    message character varying(1000),
    paid_at timestamp(6) with time zone,
    status character varying(20) NOT NULL,
    transaction_ref character varying(100),
    payment_order_id uuid NOT NULL
);


ALTER TABLE public.treasury_payment OWNER TO postgres;

--
-- TOC entry 246 (class 1259 OID 33712)
-- Name: user_account; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.user_account (
    id uuid NOT NULL,
    created_at timestamp(6) with time zone NOT NULL,
    email character varying(100) NOT NULL,
    full_name character varying(200) NOT NULL,
    is_active boolean NOT NULL,
    password_hash character varying(255) NOT NULL,
    updated_at timestamp(6) with time zone NOT NULL,
    username character varying(50) NOT NULL
);


ALTER TABLE public.user_account OWNER TO postgres;

--
-- TOC entry 247 (class 1259 OID 33719)
-- Name: user_role; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.user_role (
    id uuid NOT NULL,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    version bigint,
    role_id uuid NOT NULL,
    user_id uuid NOT NULL
);


ALTER TABLE public.user_role OWNER TO postgres;

--
-- TOC entry 5191 (class 0 OID 33547)
-- Dependencies: 217
-- Data for Name: agent_bank_account; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.agent_bank_account (id, created_at, updated_at, version, created_by, updated_by, account_number, bank, branch_code, is_primary, agent_id) FROM stdin;
\.


--
-- TOC entry 5192 (class 0 OID 33552)
-- Dependencies: 218
-- Data for Name: agent_contract; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.agent_contract (id, created_at, updated_at, version, created_by, updated_by, base_salary_ref, contract_type, end_date, is_active, start_date, weekly_hours, agent_id, org_unit_id, position_id, salary_category_id, salary_grade_id, salary_step_id, legal_act_reference) FROM stdin;
\.


--
-- TOC entry 5193 (class 0 OID 33557)
-- Dependencies: 219
-- Data for Name: agent_deduction_rule; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.agent_deduction_rule (id, created_at, updated_at, version, created_by, updated_by, amount_fixed, percentage, valid_from, valid_to, agent_id, deduction_type_id) FROM stdin;
\.


--
-- TOC entry 5194 (class 0 OID 33562)
-- Dependencies: 220
-- Data for Name: agent_status_history; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.agent_status_history (id, changed_at, changed_by, new_status, previous_status, reason, agent_id, event_type, new_functional_situation, previous_functional_situation, change_log) FROM stdin;
f4ff054b-d84b-4ee5-819b-bc2dc1b67ecd	2025-12-19 19:02:07.870837	system	ACTIVE	ACTIVE		3f152e16-cfd1-44ef-8476-2d836031dfbd	EDIT	ATIVIDADE_NO_QUADRO	ATIVIDADE_NO_QUADRO	NIF atualizado. BI atualizado. Nº Dependentes atualizado. 
32b88db3-f014-4494-a646-946ee7e32fbc	2025-12-19 19:10:32.235119	system	ACTIVE	ACTIVE		3f152e16-cfd1-44ef-8476-2d836031dfbd	EDIT	ATIVIDADE_NO_QUADRO	ATIVIDADE_NO_QUADRO	NIF: [110000055] -> [110000058]. BI: [9763456798] -> [9763456797]. 
27a36324-1a28-481d-81c8-00559befda1a	2025-12-19 19:26:48.646018	system	ACTIVE	ACTIVE		3f152e16-cfd1-44ef-8476-2d836031dfbd	PROGRESSAO	ATIVIDADE_NO_QUADRO	ATIVIDADE_NO_QUADRO	Estrutura salarial/carreira alterada. 
\.


--
-- TOC entry 5195 (class 0 OID 33569)
-- Dependencies: 221
-- Data for Name: agents; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.agents (id, created_at, updated_at, version, created_by, updated_by, address, bi_number, birth_date, email, full_name, hire_date, matricula, nationality, nif, org_unit_id, phone, position_id, status, termination_date, appointment_type, functional_situation, literary_qualification, posse_date, salary_category_id, salary_grade_id, salary_step_id, eligible_dependents_count) FROM stdin;
3f152e16-cfd1-44ef-8476-2d836031dfbd	2025-12-19 02:37:22.357127	2025-12-19 19:26:48.868616	8	\N	\N	Bissau, Bairro Militar	9763456797	1991-01-15	ibanoraa@gmail.com	Idrissa Banora	2024-12-19	2025001	Guineense	110000058	52bd259d-c29f-4c93-aed2-3de68d53bcdf	+245955521197	b814bed1-7715-4e9c-8824-e7eb0466c74a	ACTIVE	\N	DEFINITIVA	ATIVIDADE_NO_QUADRO	MESTRADO	2024-12-19	c83f3337-223d-451c-b3c9-79cceef09fac	48541c97-7ff9-4583-b6ec-ec7bf1dda522	b1e3e4a6-8bb6-481c-934a-5b4f87568f17	0
35e22a8e-024c-457b-ae67-796f39edfed2	2025-12-20 23:58:42.614143	2025-12-21 00:04:38.276403	1	\N	\N	Bissau, Bairro Ajuda	9763456760	1991-01-15	romeu@mef.gw	Romeu da Costa	2025-09-20	2025/RH/002	Guineense	110000055	29187330-9d35-4616-95f3-9ce151514e87	+245955521193	2e9e452f-44ed-42c4-aa0b-21de7b16d74b	ACTIVE	\N	PROVISORIA	ATIVIDADE_NO_QUADRO	LICENCIATURA	2025-12-20	c83f3337-223d-451c-b3c9-79cceef09fac	48541c97-7ff9-4583-b6ec-ec7bf1dda522	b1e3e4a6-8bb6-481c-934a-5b4f87568f17	0
0beb4324-fc9e-456f-9373-22fbd4d1138c	2025-12-21 01:14:54.203831	2025-12-21 01:28:47.01653	2	\N	\N	Bissau, Bairro São Paulo	9763456712	1980-12-21	braima@dgci.mef.gw	Braima Nhamadjo	2024-11-21	2025/RH/003	Guineense	1100000234	29187330-9d35-4616-95f3-9ce151514e87	+245955522020	ddaa4872-9eba-4cda-b786-dc4956f5696d	ACTIVE	\N	PROVISORIA	ATIVIDADE_NO_QUADRO	MESTRADO	2024-12-21	c83f3337-223d-451c-b3c9-79cceef09fac	48541c97-7ff9-4583-b6ec-ec7bf1dda522	b1e3e4a6-8bb6-481c-934a-5b4f87568f17	1
a1a1a1a1-a1a1-a1a1-a1a1-a1a1a1a1a1a1	2025-12-21 03:04:19.951742	2025-12-21 03:04:19.951742	\N	\N	\N	Bairro de Penha, Bissau	BI123456	1975-03-15	amilcar.silva@minfin.gov.gw	Amilcar Cabral Silva	2020-01-15	2020/001	Guineense	100123456	44444444-4444-4444-4444-444444444444	+245 955 123 456	88888888-8888-8888-8888-888888888888	ACTIVE	\N	NOMEACAO_DEFINITIVA	ACTIVE	LICENCIATURA	2020-02-01	c83f3337-223d-451c-b3c9-79cceef09fac	48541c97-7ff9-4583-b6ec-ec7bf1dda522	ffffffff-ffff-ffff-ffff-ffffffffffff	2
b2b2b2b2-b2b2-b2b2-b2b2-b2b2b2b2b2b2	2025-12-21 03:04:19.951742	2025-12-21 03:04:19.951742	\N	\N	\N	Bairro Militar, Bissau	BI234567	1988-07-22	francisca.gomes@minfin.gov.gw	Francisca Pereira Gomes	2021-03-10	2021/045	Guineense	100234567	55555555-5555-5555-5555-555555555555	+245 955 234 567	99999999-9999-9999-9999-999999999999	ACTIVE	\N	NOMEACAO_DEFINITIVA	ACTIVE	MESTRADO	2021-04-01	c83f3337-223d-451c-b3c9-79cceef09fac	48541c97-7ff9-4583-b6ec-ec7bf1dda522	eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee	1
c3c3c3c3-c3c3-c3c3-c3c3-c3c3c3c3c3c3	2025-12-21 03:04:19.951742	2025-12-21 03:04:19.951742	\N	\N	\N	Bairro de Antula, Bissau	BI345678	1982-11-30	joao.mendes@minsaude.gov.gw	Dr. Joao Vieira Mendes	2019-06-01	2019/089	Guineense	100345678	66666666-6666-6666-6666-666666666666	+245 955 345 678	aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa	ACTIVE	\N	NOMEACAO_DEFINITIVA	ACTIVE	DOUTORAMENTO	2019-07-01	c83f3337-223d-451c-b3c9-79cceef09fac	48541c97-7ff9-4583-b6ec-ec7bf1dda522	ffffffff-ffff-ffff-ffff-ffffffffffff	3
d4d4d4d4-d4d4-d4d4-d4d4-d4d4d4d4d4d4	2025-12-21 03:04:19.951742	2025-12-21 03:04:19.951742	\N	\N	\N	Bairro de Quelele, Bissau	BI456789	1990-05-18	maria.correia@minedu.gov.gw	Maria da Luz Correia	2022-09-01	2022/112	Guineense	100456789	77777777-7777-7777-7777-777777777777	+245 955 456 789	bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb	ACTIVE	\N	NOMEACAO_PROVISORIA	ACTIVE	LICENCIATURA	2022-10-01	c83f3337-223d-451c-b3c9-79cceef09fac	48541c97-7ff9-4583-b6ec-ec7bf1dda522	b1e3e4a6-8bb6-481c-934a-5b4f87568f17	0
e5e5e5e5-e5e5-e5e5-e5e5-e5e5e5e5e5e5	2025-12-21 03:04:19.951742	2025-12-21 03:04:19.951742	\N	\N	\N	Bairro de Chao de Papel, Bissau	BI567890	1995-09-12	samba.djalo@minfin.gov.gw	Samba Djalo	2024-11-01	2024/201	Guineense	100567890	44444444-4444-4444-4444-444444444444	+245 955 567 890	99999999-9999-9999-9999-999999999999	ACTIVE	\N	NOMEACAO_PROVISORIA	ACTIVE	LICENCIATURA	2024-12-01	c83f3337-223d-451c-b3c9-79cceef09fac	48541c97-7ff9-4583-b6ec-ec7bf1dda522	b1e3e4a6-8bb6-481c-934a-5b4f87568f17	0
\.


--
-- TOC entry 5196 (class 0 OID 33576)
-- Dependencies: 222
-- Data for Name: audit_log; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.audit_log (id, action, created_at, description, entity, entity_id, module, user_id, username) FROM stdin;
\.


--
-- TOC entry 5197 (class 0 OID 33583)
-- Dependencies: 223
-- Data for Name: bank; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.bank (id, created_at, updated_at, version, code, name, swift_code) FROM stdin;
32f71904-2e70-4df1-a53f-eb62b45ae70f	2025-12-21 02:11:51.49895	2025-12-21 02:11:51.49895	0	001	Banco da África Ocidental	BAO
cccccccc-cccc-cccc-cccc-cccccccccccc	2025-12-21 03:04:19.944998	2025-12-21 03:04:19.944998	\N	BCEAO	Banco Central dos Estados da Africa Ocidental	BCAOXXXX
dddddddd-dddd-dddd-dddd-dddddddddddd	2025-12-21 03:04:19.944998	2025-12-21 03:04:19.944998	\N	BRS	Banco Regional de Solidariedade	BRSXGWGW
\.


--
-- TOC entry 5198 (class 0 OID 33588)
-- Dependencies: 224
-- Data for Name: budget_allocation; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.budget_allocation (id, created_at, updated_at, version, adjustment_amount, initial_amount, budget_line_id) FROM stdin;
\.


--
-- TOC entry 5199 (class 0 OID 33593)
-- Dependencies: 225
-- Data for Name: budget_execution; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.budget_execution (id, created_at, updated_at, version, amount, movement_type, period_id, reference_id, source_module, budget_line_id) FROM stdin;
\.


--
-- TOC entry 5200 (class 0 OID 33598)
-- Dependencies: 226
-- Data for Name: budget_line; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.budget_line (id, created_at, updated_at, version, code, description, economic_class, ministry_id, org_unit_id, fiscal_year_id) FROM stdin;
f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1f1	2025-12-21 03:04:19.951742	2025-12-21 03:04:19.951742	\N	2025-MINFIN-311100	Vencimentos Base - Financas	311100	11111111-1111-1111-1111-111111111111	44444444-4444-4444-4444-444444444444	cd5bfd27-3a6e-40af-94cd-df7452154748
f2f2f2f2-f2f2-f2f2-f2f2-f2f2f2f2f2f2	2025-12-21 03:04:19.951742	2025-12-21 03:04:19.951742	\N	2025-MINSAUDE-311100	Vencimentos Base - Saude	311100	22222222-2222-2222-2222-222222222222	66666666-6666-6666-6666-666666666666	cd5bfd27-3a6e-40af-94cd-df7452154748
f3f3f3f3-f3f3-f3f3-f3f3-f3f3f3f3f3f3	2025-12-21 03:04:19.951742	2025-12-21 03:04:19.951742	\N	2025-MINEDU-311100	Vencimentos Base - Educacao	311100	33333333-3333-3333-3333-333333333333	77777777-7777-7777-7777-777777777777	cd5bfd27-3a6e-40af-94cd-df7452154748
\.


--
-- TOC entry 5222 (class 0 OID 33953)
-- Dependencies: 248
-- Data for Name: career_events; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.career_events (id, created_at, updated_at, version, created_by, updated_by, cargo_amount, created_by_user, document_ref, effective_date, event_type, exercicio_amount, new_category, new_grade, new_org_unit, new_position, new_step, previous_category, previous_grade, previous_org_unit, previous_position, previous_step, publication_date, reason, total_base_amount, agent_id) FROM stdin;
f0a3b916-81cd-42fc-b771-7296c75db6b5	2025-12-19 19:26:48.84382	2025-12-19 19:26:48.84382	0	\N	\N	75000.00	system	Despacho nº 1/2025	2025-12-19	PROGRESSAO	15000.00	c83f3337-223d-451c-b3c9-79cceef09fac	48541c97-7ff9-4583-b6ec-ec7bf1dda522	52bd259d-c29f-4c93-aed2-3de68d53bcdf	b814bed1-7715-4e9c-8824-e7eb0466c74a	b1e3e4a6-8bb6-481c-934a-5b4f87568f17	c83f3337-223d-451c-b3c9-79cceef09fac	48541c97-7ff9-4583-b6ec-ec7bf1dda522	52bd259d-c29f-4c93-aed2-3de68d53bcdf	b814bed1-7715-4e9c-8824-e7eb0466c74a	3964f7b2-3ae6-495d-a49b-4856c9d11075	\N		90000.00	3f152e16-cfd1-44ef-8476-2d836031dfbd
4c37cbf8-65e8-4c59-8403-f1540db84563	2025-12-20 23:58:42.644493	2025-12-20 23:58:42.644493	0	\N	\N	\N	system	\N	2025-12-20	ADMISSAO	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	Admissão inicial no sistema	\N	35e22a8e-024c-457b-ae67-796f39edfed2
7674cc7e-123e-4ae4-89ba-04e59cde7a99	2025-12-21 00:04:38.276403	2025-12-21 00:04:38.276403	0	\N	\N	75000.00	system	\N	2025-12-21	ADMISSAO	15000.00	c83f3337-223d-451c-b3c9-79cceef09fac	48541c97-7ff9-4583-b6ec-ec7bf1dda522	29187330-9d35-4616-95f3-9ce151514e87	2e9e452f-44ed-42c4-aa0b-21de7b16d74b	b1e3e4a6-8bb6-481c-934a-5b4f87568f17	\N	\N	\N	\N	\N	\N	Atualização automática via registo de contrato: NOMEAÇÃO_DEFINITIVA	90000.00	35e22a8e-024c-457b-ae67-796f39edfed2
eb676aa4-d629-4bab-af6b-7864dcef45d0	2025-12-21 01:14:54.238878	2025-12-21 01:14:54.238878	0	\N	\N	\N	system	\N	2024-11-21	ADMISSAO	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	Admissão inicial no sistema	\N	0beb4324-fc9e-456f-9373-22fbd4d1138c
7370110f-2d16-4c45-adb9-87664dfb3b22	2025-12-21 01:28:47.007229	2025-12-21 01:28:47.007229	0	\N	\N	\N	system	Decreteo nº 12/2025	2024-12-21	ADMISSAO	\N	c83f3337-223d-451c-b3c9-79cceef09fac	48541c97-7ff9-4583-b6ec-ec7bf1dda522	29187330-9d35-4616-95f3-9ce151514e87	ddaa4872-9eba-4cda-b786-dc4956f5696d	b1e3e4a6-8bb6-481c-934a-5b4f87568f17	\N	\N	\N	\N	\N	2025-12-21	Ato Administrativo: Decreteo nº 12/2025 (NOMEAÇÃO_DEFINITIVA)	\N	0beb4324-fc9e-456f-9373-22fbd4d1138c
5d65915f-d92c-4369-94de-0e2812f20194	2025-12-21 01:52:43.388962	2025-12-21 01:52:43.388962	0	\N	\N	75000.00	system	Decreteo nº 12/2025	2025-12-21	RETIFICACAO	15000.00	c83f3337-223d-451c-b3c9-79cceef09fac	48541c97-7ff9-4583-b6ec-ec7bf1dda522	29187330-9d35-4616-95f3-9ce151514e87	2e9e452f-44ed-42c4-aa0b-21de7b16d74b	b1e3e4a6-8bb6-481c-934a-5b4f87568f17	\N	\N	\N	\N	\N	2025-12-21	Retificação de Ato Administrativo: Decreteo nº 12/2025	90000.00	35e22a8e-024c-457b-ae67-796f39edfed2
\.


--
-- TOC entry 5201 (class 0 OID 33605)
-- Dependencies: 227
-- Data for Name: deduction_type; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.deduction_type (id, created_at, updated_at, version, created_by, updated_by, code, mandatory, name, economic_class_code) FROM stdin;
46f12721-2f05-46e2-aded-f732f1eb9e4b	2025-12-20 23:00:47.16862	2025-12-20 23:00:47.16862	0	\N	\N	INPS	f	Segurança Social (INPS)	312100
ecd41d84-7e62-48ba-afe7-79b725289f49	2025-12-20 23:00:47.188358	2025-12-20 23:00:47.188358	0	\N	\N	IRPS	f	Imposto Profissional (IRPS)	\N
d84662a0-b13e-465d-bf81-413e2d3ae2b0	2025-12-20 23:00:47.193772	2025-12-20 23:00:47.193772	0	\N	\N	SELO	f	Imposto de Selo	\N
\.


--
-- TOC entry 5202 (class 0 OID 33610)
-- Dependencies: 228
-- Data for Name: earning_type; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.earning_type (id, created_at, updated_at, version, created_by, updated_by, code, name, taxable, economic_class_code) FROM stdin;
dd772630-42c8-4568-8a21-7fff65744bf2	2025-12-20 23:00:47.077312	2025-12-20 23:00:47.077312	0	\N	\N	SALARIO_BASE	Vencimento Base	t	311100
695ddcfd-df43-494a-bc44-0e5a6fc7e484	2025-12-20 23:00:47.163223	2025-12-20 23:00:47.163223	0	\N	\N	ABONO_FAMILIA	Abono de Família	f	312101
\.


--
-- TOC entry 5203 (class 0 OID 33615)
-- Dependencies: 229
-- Data for Name: fiscal_year; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.fiscal_year (id, created_at, updated_at, version, end_date, start_date, status, year) FROM stdin;
cd5bfd27-3a6e-40af-94cd-df7452154748	2025-12-20 23:00:47.263782	2025-12-20 23:00:47.263782	0	2025-12-31	2025-01-01	OPEN	2025
\.


--
-- TOC entry 5224 (class 0 OID 33982)
-- Dependencies: 250
-- Data for Name: global_deduction_rule; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.global_deduction_rule (id, created_at, updated_at, version, created_by, updated_by, active, amount_fixed, percentage, valid_from, valid_to, deduction_type_id) FROM stdin;
f86b9e7f-98f8-4ceb-aa39-9053b477f035	2025-12-20 23:00:47.216998	2025-12-20 23:00:47.216998	0	\N	\N	t	\N	0.0700	2024-01-01	\N	46f12721-2f05-46e2-aded-f732f1eb9e4b
c4209f51-c7d5-4bb2-b38e-4cee423514c1	2025-12-20 23:00:47.239304	2025-12-20 23:00:47.239304	0	\N	\N	t	\N	0.0030	2024-01-01	\N	d84662a0-b13e-465d-bf81-413e2d3ae2b0
e30a82a6-007c-4a04-b48a-cb789215a55b	2025-12-21 02:35:36.87085	2025-12-21 02:35:36.87085	\N	\N	\N	t	\N	0.0700	2024-01-01	\N	46f12721-2f05-46e2-aded-f732f1eb9e4b
48e97a1f-30d8-4300-ad95-bbdd2fac284b	2025-12-21 02:35:36.87085	2025-12-21 02:35:36.87085	\N	\N	\N	t	\N	0.0030	2024-01-01	\N	d84662a0-b13e-465d-bf81-413e2d3ae2b0
\.


--
-- TOC entry 5204 (class 0 OID 33620)
-- Dependencies: 230
-- Data for Name: ministry; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.ministry (id, created_at, updated_at, version, acronym, code, description, is_active, logo, name) FROM stdin;
6e32517f-5dbc-416a-9632-d920175b8cdd	2025-12-19 02:28:07.446337	2025-12-19 02:28:07.446337	0	MEF	MIN-001		t	data:image/jpeg;base64,[encoded data, 66000 characters]	Ministério das Finânças
\.


--
-- TOC entry 5205 (class 0 OID 33627)
-- Dependencies: 231
-- Data for Name: org_unit; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.org_unit (id, created_at, updated_at, version, acronym, address, code, email, is_active, name, phone, unit_type, ministry_id, parent_unit_id) FROM stdin;
52bd259d-c29f-4c93-aed2-3de68d53bcdf	2025-12-19 02:32:51.181456	2025-12-19 02:32:51.181456	0	SEOAF	Av. Nino Viera	SEC-001	seoa@mef.gw	t	Secretaria de Estado do Orçamento e Assuntos Fiscais	+245956006060	SECRETARIAT	6e32517f-5dbc-416a-9632-d920175b8cdd	\N
29187330-9d35-4616-95f3-9ce151514e87	2025-12-21 00:02:42.207881	2025-12-21 00:02:42.207881	0	DGI	Av. Nino Viera	DIR-003	mef@mef.gw	t	Direcão de Informatica e estatistica	+245956006060	DIRECTORATE	6e32517f-5dbc-416a-9632-d920175b8cdd	52bd259d-c29f-4c93-aed2-3de68d53bcdf
\.


--
-- TOC entry 5206 (class 0 OID 33634)
-- Dependencies: 232
-- Data for Name: payment_batch; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.payment_batch (id, created_at, updated_at, version, created_by, ministry_id, period_id, status) FROM stdin;
\.


--
-- TOC entry 5207 (class 0 OID 33639)
-- Dependencies: 233
-- Data for Name: payment_order; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.payment_order (id, created_at, updated_at, version, agent_id, bank_account_id, budget_line_id, gross_amount, net_amount, payroll_run_id, status, payment_batch_id) FROM stdin;
\.


--
-- TOC entry 5208 (class 0 OID 33644)
-- Dependencies: 234
-- Data for Name: payments; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.payments (id, created_at, updated_at, version, created_by, updated_by, amount, beneficiary, beneficiary_document, budget_execution_id, description, due_date, notes, paid_date, payment_date, payment_method, payment_number, status) FROM stdin;
\.


--
-- TOC entry 5209 (class 0 OID 33651)
-- Dependencies: 235
-- Data for Name: payroll_item; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.payroll_item (id, created_at, updated_at, version, created_by, updated_by, agent_id, budget_line_id, description, line_type, quantity, total_amount, unit_amount, deduction_type_id, earning_type_id, payroll_run_id) FROM stdin;
\.


--
-- TOC entry 5210 (class 0 OID 33658)
-- Dependencies: 236
-- Data for Name: payroll_period; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.payroll_period (id, created_at, updated_at, version, created_by, updated_by, end_date, fiscal_year, month, start_date, status) FROM stdin;
c20e44b8-775c-400d-9672-2e55adcdf02b	2025-12-20 23:00:47.273994	2025-12-20 23:00:47.273994	0	\N	\N	2025-12-31	2025	12	2025-12-01	OPEN
\.


--
-- TOC entry 5211 (class 0 OID 33663)
-- Dependencies: 237
-- Data for Name: payroll_run; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.payroll_run (id, created_at, updated_at, version, created_by, updated_by, ministry_id, org_unit_id, run_type, status, period_id) FROM stdin;
\.


--
-- TOC entry 5223 (class 0 OID 33961)
-- Dependencies: 249
-- Data for Name: performance_evaluations; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.performance_evaluations (id, created_at, updated_at, version, created_by, updated_by, evaluation_date, observations, qualitative_mention, reference_year, score, agent_id) FROM stdin;
\.


--
-- TOC entry 5212 (class 0 OID 33668)
-- Dependencies: 238
-- Data for Name: permissions; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.permissions (id, created_at, updated_at, version, created_by, updated_by, code, description, module) FROM stdin;
\.


--
-- TOC entry 5213 (class 0 OID 33673)
-- Dependencies: 239
-- Data for Name: position; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public."position" (id, created_at, updated_at, version, code, is_active, level, title, org_unit_id) FROM stdin;
b814bed1-7715-4e9c-8824-e7eb0466c74a	2025-12-19 02:34:44.344045	2025-12-19 02:34:44.344045	0	CAR-001	t	L1	Secretario de estado	52bd259d-c29f-4c93-aed2-3de68d53bcdf
2e9e452f-44ed-42c4-aa0b-21de7b16d74b	2025-12-21 00:03:57.017536	2025-12-21 00:03:57.017536	0	CAR-003	t	L2	Director Geral	29187330-9d35-4616-95f3-9ce151514e87
ddaa4872-9eba-4cda-b786-dc4956f5696d	2025-12-21 01:02:54.5064	2025-12-21 01:02:54.5064	0	CAR-004	t	L3	Desenvolvedor de sistemas	29187330-9d35-4616-95f3-9ce151514e87
\.


--
-- TOC entry 5214 (class 0 OID 33678)
-- Dependencies: 240
-- Data for Name: role; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.role (id, created_at, updated_at, version, code, description, name) FROM stdin;
c5831c93-5907-4a8f-8221-bea58a07f4bd	2025-12-19 00:29:28.264805	2025-12-19 00:29:28.264805	0	ADMIN	Perfil de administrador com acesso total ao sistema	Administrador
\.


--
-- TOC entry 5215 (class 0 OID 33685)
-- Dependencies: 241
-- Data for Name: salary_category; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.salary_category (id, created_at, updated_at, version, created_by, updated_by, code, name) FROM stdin;
c83f3337-223d-451c-b3c9-79cceef09fac	2025-12-19 02:24:40.108443	2025-12-19 02:24:40.108443	0	\N	\N	TS	Técnico Superior
f33722c1-efc5-4c30-b7d6-1b8ab464399f	2025-12-19 02:25:52.862332	2025-12-19 02:25:52.862332	0	\N	\N	Tecnico	Técnico
\.


--
-- TOC entry 5216 (class 0 OID 33690)
-- Dependencies: 242
-- Data for Name: salary_grade; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.salary_grade (id, created_at, updated_at, version, created_by, updated_by, code, name, category_id) FROM stdin;
48541c97-7ff9-4583-b6ec-ec7bf1dda522	2025-12-19 02:24:54.405533	2025-12-19 02:24:54.405533	0	\N	\N	A	1ª Classe	c83f3337-223d-451c-b3c9-79cceef09fac
851fadd4-c71f-45d4-a3d1-755e210498e0	2025-12-19 02:26:10.11572	2025-12-19 02:26:10.11572	0	\N	\N	B	1ª Classe	f33722c1-efc5-4c30-b7d6-1b8ab464399f
b8b5afdf-a4f6-4b3b-a77e-49da584cea62	2025-12-19 17:32:53.61739	2025-12-21 02:28:51.3572	1	\N	\N	B	2ª Classe	c83f3337-223d-451c-b3c9-79cceef09fac
\.


--
-- TOC entry 5217 (class 0 OID 33695)
-- Dependencies: 243
-- Data for Name: salary_grid; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.salary_grid (id, created_at, updated_at, version, created_by, updated_by, base_amount, valid_from, valid_to, step_id) FROM stdin;
d832205a-fbd5-4994-826e-8c91e62c40dc	2025-12-19 02:25:17.200561	2025-12-19 02:25:17.200561	0	\N	\N	90000.00	2025-12-19	\N	b1e3e4a6-8bb6-481c-934a-5b4f87568f17
05af84fb-5633-4057-8aa0-f14901961710	2025-12-19 02:26:25.765622	2025-12-19 02:26:25.765622	0	\N	\N	70000.00	2025-12-19	\N	e893eceb-e4fe-4dbe-868d-aec2c9b4cbbf
10101010-1010-1010-1010-101010101010	2025-12-21 03:04:19.951742	2025-12-21 03:04:19.951742	\N	\N	\N	550000.00	2024-01-01	\N	eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee
20202020-2020-2020-2020-202020202020	2025-12-21 03:04:19.951742	2025-12-21 03:04:19.951742	\N	\N	\N	600000.00	2024-01-01	\N	ffffffff-ffff-ffff-ffff-ffffffffffff
\.


--
-- TOC entry 5218 (class 0 OID 33700)
-- Dependencies: 244
-- Data for Name: salary_step; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.salary_step (id, created_at, updated_at, version, created_by, updated_by, step_number, grade_id) FROM stdin;
b1e3e4a6-8bb6-481c-934a-5b4f87568f17	2025-12-19 02:24:57.872261	2025-12-19 02:24:57.872261	0	\N	\N	1	48541c97-7ff9-4583-b6ec-ec7bf1dda522
e893eceb-e4fe-4dbe-868d-aec2c9b4cbbf	2025-12-19 02:26:13.015114	2025-12-19 02:26:13.015114	0	\N	\N	1	851fadd4-c71f-45d4-a3d1-755e210498e0
eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee	2025-12-21 03:04:19.951742	2025-12-21 03:04:19.951742	\N	\N	\N	2	48541c97-7ff9-4583-b6ec-ec7bf1dda522
ffffffff-ffff-ffff-ffff-ffffffffffff	2025-12-21 03:04:19.951742	2025-12-21 03:04:19.951742	\N	\N	\N	3	48541c97-7ff9-4583-b6ec-ec7bf1dda522
\.


--
-- TOC entry 5225 (class 0 OID 33987)
-- Dependencies: 251
-- Data for Name: tax_bracket; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.tax_bracket (id, created_at, updated_at, version, created_by, updated_by, excess_deduction, lower_limit, rate_percentage, upper_limit, valid_from, valid_to, deduction_type_id) FROM stdin;
a90c8abe-3249-4fa5-aefe-fe3821544a70	2025-12-21 02:35:36.87085	2025-12-21 02:35:36.87085	\N	\N	\N	0.00	0.00	0.0000	50000.00	2024-01-01	\N	ecd41d84-7e62-48ba-afe7-79b725289f49
d41206e7-a9ac-4fc8-92e4-1a6cd2fbd518	2025-12-21 02:35:36.87085	2025-12-21 02:35:36.87085	\N	\N	\N	5000.00	50001.00	0.1000	150000.00	2024-01-01	\N	ecd41d84-7e62-48ba-afe7-79b725289f49
5cbd1254-5501-42fb-96c0-c040c147f729	2025-12-21 02:35:36.87085	2025-12-21 02:35:36.87085	\N	\N	\N	12500.00	150001.00	0.1500	250000.00	2024-01-01	\N	ecd41d84-7e62-48ba-afe7-79b725289f49
6bff0f07-4644-4554-8547-b41962b2a8c0	2025-12-21 02:35:36.87085	2025-12-21 02:35:36.87085	\N	\N	\N	25000.00	250001.00	0.2000	500000.00	2024-01-01	\N	ecd41d84-7e62-48ba-afe7-79b725289f49
96f75a1a-21ff-4214-a25f-afe6821b4e16	2025-12-21 02:35:36.87085	2025-12-21 02:35:36.87085	\N	\N	\N	50000.00	500001.00	0.2500	\N	2024-01-01	\N	ecd41d84-7e62-48ba-afe7-79b725289f49
\.


--
-- TOC entry 5219 (class 0 OID 33705)
-- Dependencies: 245
-- Data for Name: treasury_payment; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.treasury_payment (id, created_at, updated_at, version, message, paid_at, status, transaction_ref, payment_order_id) FROM stdin;
\.


--
-- TOC entry 5220 (class 0 OID 33712)
-- Dependencies: 246
-- Data for Name: user_account; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.user_account (id, created_at, email, full_name, is_active, password_hash, updated_at, username) FROM stdin;
f821c5f8-8724-47cf-8f1a-dc5c0d14f4ce	2025-12-19 00:29:28.407757+00	admin@sigefp.gov.gw	Administrador do Sistema	t	$2a$10$bB5XhWBR.YFNui34mAcilucHjC9Q1tqx9.yJBuIEOzlurAb3NeOPu	2025-12-19 00:29:28.407757+00	admin
\.


--
-- TOC entry 5221 (class 0 OID 33719)
-- Dependencies: 247
-- Data for Name: user_role; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.user_role (id, created_at, updated_at, version, role_id, user_id) FROM stdin;
12b3bf77-d5bb-429f-bb30-b50014205730	2025-12-19 00:29:28.494255	2025-12-19 00:29:28.494255	0	c5831c93-5907-4a8f-8221-bea58a07f4bd	f821c5f8-8724-47cf-8f1a-dc5c0d14f4ce
\.


--
-- TOC entry 4832 (class 2606 OID 33551)
-- Name: agent_bank_account agent_bank_account_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.agent_bank_account
    ADD CONSTRAINT agent_bank_account_pkey PRIMARY KEY (id);


--
-- TOC entry 4836 (class 2606 OID 33556)
-- Name: agent_contract agent_contract_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.agent_contract
    ADD CONSTRAINT agent_contract_pkey PRIMARY KEY (id);


--
-- TOC entry 4841 (class 2606 OID 33561)
-- Name: agent_deduction_rule agent_deduction_rule_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.agent_deduction_rule
    ADD CONSTRAINT agent_deduction_rule_pkey PRIMARY KEY (id);


--
-- TOC entry 4846 (class 2606 OID 33568)
-- Name: agent_status_history agent_status_history_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.agent_status_history
    ADD CONSTRAINT agent_status_history_pkey PRIMARY KEY (id);


--
-- TOC entry 4850 (class 2606 OID 33575)
-- Name: agents agents_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.agents
    ADD CONSTRAINT agents_pkey PRIMARY KEY (id);


--
-- TOC entry 4862 (class 2606 OID 33582)
-- Name: audit_log audit_log_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.audit_log
    ADD CONSTRAINT audit_log_pkey PRIMARY KEY (id);


--
-- TOC entry 4869 (class 2606 OID 33587)
-- Name: bank bank_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.bank
    ADD CONSTRAINT bank_pkey PRIMARY KEY (id);


--
-- TOC entry 4875 (class 2606 OID 33592)
-- Name: budget_allocation budget_allocation_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.budget_allocation
    ADD CONSTRAINT budget_allocation_pkey PRIMARY KEY (id);


--
-- TOC entry 4879 (class 2606 OID 33597)
-- Name: budget_execution budget_execution_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.budget_execution
    ADD CONSTRAINT budget_execution_pkey PRIMARY KEY (id);


--
-- TOC entry 4885 (class 2606 OID 33604)
-- Name: budget_line budget_line_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.budget_line
    ADD CONSTRAINT budget_line_pkey PRIMARY KEY (id);


--
-- TOC entry 5007 (class 2606 OID 33960)
-- Name: career_events career_events_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.career_events
    ADD CONSTRAINT career_events_pkey PRIMARY KEY (id);


--
-- TOC entry 4893 (class 2606 OID 33609)
-- Name: deduction_type deduction_type_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.deduction_type
    ADD CONSTRAINT deduction_type_pkey PRIMARY KEY (id);


--
-- TOC entry 4898 (class 2606 OID 33614)
-- Name: earning_type earning_type_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.earning_type
    ADD CONSTRAINT earning_type_pkey PRIMARY KEY (id);


--
-- TOC entry 4903 (class 2606 OID 33619)
-- Name: fiscal_year fiscal_year_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.fiscal_year
    ADD CONSTRAINT fiscal_year_pkey PRIMARY KEY (id);


--
-- TOC entry 5016 (class 2606 OID 33986)
-- Name: global_deduction_rule global_deduction_rule_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.global_deduction_rule
    ADD CONSTRAINT global_deduction_rule_pkey PRIMARY KEY (id);


--
-- TOC entry 5002 (class 2606 OID 33835)
-- Name: user_role idx_user_role_unique; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.user_role
    ADD CONSTRAINT idx_user_role_unique UNIQUE (user_id, role_id);


--
-- TOC entry 4910 (class 2606 OID 33626)
-- Name: ministry ministry_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ministry
    ADD CONSTRAINT ministry_pkey PRIMARY KEY (id);


--
-- TOC entry 4917 (class 2606 OID 33633)
-- Name: org_unit org_unit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.org_unit
    ADD CONSTRAINT org_unit_pkey PRIMARY KEY (id);


--
-- TOC entry 4925 (class 2606 OID 33638)
-- Name: payment_batch payment_batch_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.payment_batch
    ADD CONSTRAINT payment_batch_pkey PRIMARY KEY (id);


--
-- TOC entry 4931 (class 2606 OID 33643)
-- Name: payment_order payment_order_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.payment_order
    ADD CONSTRAINT payment_order_pkey PRIMARY KEY (id);


--
-- TOC entry 4936 (class 2606 OID 33650)
-- Name: payments payments_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.payments
    ADD CONSTRAINT payments_pkey PRIMARY KEY (id);


--
-- TOC entry 4943 (class 2606 OID 33657)
-- Name: payroll_item payroll_item_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.payroll_item
    ADD CONSTRAINT payroll_item_pkey PRIMARY KEY (id);


--
-- TOC entry 4947 (class 2606 OID 33662)
-- Name: payroll_period payroll_period_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.payroll_period
    ADD CONSTRAINT payroll_period_pkey PRIMARY KEY (id);


--
-- TOC entry 4953 (class 2606 OID 33667)
-- Name: payroll_run payroll_run_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.payroll_run
    ADD CONSTRAINT payroll_run_pkey PRIMARY KEY (id);


--
-- TOC entry 5014 (class 2606 OID 33965)
-- Name: performance_evaluations performance_evaluations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.performance_evaluations
    ADD CONSTRAINT performance_evaluations_pkey PRIMARY KEY (id);


--
-- TOC entry 4956 (class 2606 OID 33672)
-- Name: permissions permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.permissions
    ADD CONSTRAINT permissions_pkey PRIMARY KEY (id);


--
-- TOC entry 4962 (class 2606 OID 33677)
-- Name: position position_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public."position"
    ADD CONSTRAINT position_pkey PRIMARY KEY (id);


--
-- TOC entry 4967 (class 2606 OID 33684)
-- Name: role role_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.role
    ADD CONSTRAINT role_pkey PRIMARY KEY (id);


--
-- TOC entry 4972 (class 2606 OID 33689)
-- Name: salary_category salary_category_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.salary_category
    ADD CONSTRAINT salary_category_pkey PRIMARY KEY (id);


--
-- TOC entry 4978 (class 2606 OID 33694)
-- Name: salary_grade salary_grade_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.salary_grade
    ADD CONSTRAINT salary_grade_pkey PRIMARY KEY (id);


--
-- TOC entry 4982 (class 2606 OID 33699)
-- Name: salary_grid salary_grid_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.salary_grid
    ADD CONSTRAINT salary_grid_pkey PRIMARY KEY (id);


--
-- TOC entry 4986 (class 2606 OID 33704)
-- Name: salary_step salary_step_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.salary_step
    ADD CONSTRAINT salary_step_pkey PRIMARY KEY (id);


--
-- TOC entry 5018 (class 2606 OID 33991)
-- Name: tax_bracket tax_bracket_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tax_bracket
    ADD CONSTRAINT tax_bracket_pkey PRIMARY KEY (id);


--
-- TOC entry 4991 (class 2606 OID 33711)
-- Name: treasury_payment treasury_payment_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.treasury_payment
    ADD CONSTRAINT treasury_payment_pkey PRIMARY KEY (id);


--
-- TOC entry 4856 (class 2606 OID 33739)
-- Name: agents uk_5cnbejq0n97i068p6kwjjye2r; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.agents
    ADD CONSTRAINT uk_5cnbejq0n97i068p6kwjjye2r UNIQUE (bi_number);


--
-- TOC entry 4858 (class 2606 OID 33741)
-- Name: agents uk_5v98727qw781hfgda7jveucbk; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.agents
    ADD CONSTRAINT uk_5v98727qw781hfgda7jveucbk UNIQUE (matricula);


--
-- TOC entry 4891 (class 2606 OID 33763)
-- Name: budget_line uk_7ba7hmd2j7uifqr1vx9isos3r; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.budget_line
    ADD CONSTRAINT uk_7ba7hmd2j7uifqr1vx9isos3r UNIQUE (code);


--
-- TOC entry 4958 (class 2606 OID 33806)
-- Name: permissions uk_7lcb6glmvwlro3p2w2cewxtvd; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.permissions
    ADD CONSTRAINT uk_7lcb6glmvwlro3p2w2cewxtvd UNIQUE (code);


--
-- TOC entry 4912 (class 2606 OID 33776)
-- Name: ministry uk_83iwgw34u385ui1vbr8mscji7; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ministry
    ADD CONSTRAINT uk_83iwgw34u385ui1vbr8mscji7 UNIQUE (code);


--
-- TOC entry 4974 (class 2606 OID 33816)
-- Name: salary_category uk_a2uiutk8usaygd0svu72uekxc; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.salary_category
    ADD CONSTRAINT uk_a2uiutk8usaygd0svu72uekxc UNIQUE (code);


--
-- TOC entry 4860 (class 2606 OID 33743)
-- Name: agents uk_adrjt4pp42prf55q8v0mdji20; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.agents
    ADD CONSTRAINT uk_adrjt4pp42prf55q8v0mdji20 UNIQUE (nif);


--
-- TOC entry 4964 (class 2606 OID 33810)
-- Name: position uk_aqoegu9tj6s7t7f31abslcng; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public."position"
    ADD CONSTRAINT uk_aqoegu9tj6s7t7f31abslcng UNIQUE (code);


--
-- TOC entry 4907 (class 2606 OID 33773)
-- Name: fiscal_year uk_b8kivk0q21ddg7c8uyyrppgp3; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.fiscal_year
    ADD CONSTRAINT uk_b8kivk0q21ddg7c8uyyrppgp3 UNIQUE (year);


--
-- TOC entry 4969 (class 2606 OID 33813)
-- Name: role uk_c36say97xydpmgigg38qv5l2p; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.role
    ADD CONSTRAINT uk_c36say97xydpmgigg38qv5l2p UNIQUE (code);


--
-- TOC entry 4938 (class 2606 OID 33794)
-- Name: payments uk_c6nxg52ow66u8ut91bytspy64; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.payments
    ADD CONSTRAINT uk_c6nxg52ow66u8ut91bytspy64 UNIQUE (payment_number);


--
-- TOC entry 4995 (class 2606 OID 33831)
-- Name: user_account uk_castjbvpeeus0r8lbpehiu0e4; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.user_account
    ADD CONSTRAINT uk_castjbvpeeus0r8lbpehiu0e4 UNIQUE (username);


--
-- TOC entry 4919 (class 2606 OID 33781)
-- Name: org_unit uk_dbulgjjuqg5u8v5swy61shro9; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.org_unit
    ADD CONSTRAINT uk_dbulgjjuqg5u8v5swy61shro9 UNIQUE (code);


--
-- TOC entry 4997 (class 2606 OID 33829)
-- Name: user_account uk_hl02wv5hym99ys465woijmfib; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.user_account
    ADD CONSTRAINT uk_hl02wv5hym99ys465woijmfib UNIQUE (email);


--
-- TOC entry 4901 (class 2606 OID 33769)
-- Name: earning_type uk_kpykvrx7jixjgf1fn3ktearb8; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.earning_type
    ADD CONSTRAINT uk_kpykvrx7jixjgf1fn3ktearb8 UNIQUE (code);


--
-- TOC entry 4873 (class 2606 OID 33751)
-- Name: bank uk_nc70mw7kj0k56c4pjpl6b0xwt; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.bank
    ADD CONSTRAINT uk_nc70mw7kj0k56c4pjpl6b0xwt UNIQUE (code);


--
-- TOC entry 4896 (class 2606 OID 33766)
-- Name: deduction_type uk_vunf3mg2s5dgm8njjo97np6m; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.deduction_type
    ADD CONSTRAINT uk_vunf3mg2s5dgm8njjo97np6m UNIQUE (code);


--
-- TOC entry 4999 (class 2606 OID 33718)
-- Name: user_account user_account_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.user_account
    ADD CONSTRAINT user_account_pkey PRIMARY KEY (id);


--
-- TOC entry 5005 (class 2606 OID 33723)
-- Name: user_role user_role_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.user_role
    ADD CONSTRAINT user_role_pkey PRIMARY KEY (id);


--
-- TOC entry 4851 (class 1259 OID 33735)
-- Name: idx_agent_bi; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_agent_bi ON public.agents USING btree (bi_number);


--
-- TOC entry 4852 (class 1259 OID 33736)
-- Name: idx_agent_matricula; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_agent_matricula ON public.agents USING btree (matricula);


--
-- TOC entry 4853 (class 1259 OID 33734)
-- Name: idx_agent_nif; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_agent_nif ON public.agents USING btree (nif);


--
-- TOC entry 4854 (class 1259 OID 33737)
-- Name: idx_agent_status; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_agent_status ON public.agents USING btree (status);


--
-- TOC entry 4863 (class 1259 OID 33747)
-- Name: idx_audit_created; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_audit_created ON public.audit_log USING btree (created_at);


--
-- TOC entry 4864 (class 1259 OID 33746)
-- Name: idx_audit_entity; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_audit_entity ON public.audit_log USING btree (entity, entity_id);


--
-- TOC entry 4865 (class 1259 OID 33745)
-- Name: idx_audit_module; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_audit_module ON public.audit_log USING btree (module);


--
-- TOC entry 4866 (class 1259 OID 33744)
-- Name: idx_audit_user; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_audit_user ON public.audit_log USING btree (user_id);


--
-- TOC entry 4867 (class 1259 OID 33981)
-- Name: idx_audit_user_id; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_audit_user_id ON public.audit_log USING btree (user_id);


--
-- TOC entry 4833 (class 1259 OID 33724)
-- Name: idx_bank_account_agent; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_bank_account_agent ON public.agent_bank_account USING btree (agent_id);


--
-- TOC entry 4834 (class 1259 OID 33725)
-- Name: idx_bank_account_primary; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_bank_account_primary ON public.agent_bank_account USING btree (agent_id, is_primary);


--
-- TOC entry 4870 (class 1259 OID 33748)
-- Name: idx_bank_code; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_bank_code ON public.bank USING btree (code);


--
-- TOC entry 4871 (class 1259 OID 33749)
-- Name: idx_bank_swift; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_bank_swift ON public.bank USING btree (swift_code);


--
-- TOC entry 4876 (class 1259 OID 33753)
-- Name: idx_budget_allocation_created; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_budget_allocation_created ON public.budget_allocation USING btree (created_at);


--
-- TOC entry 4877 (class 1259 OID 33752)
-- Name: idx_budget_allocation_line; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_budget_allocation_line ON public.budget_allocation USING btree (budget_line_id);


--
-- TOC entry 4880 (class 1259 OID 33756)
-- Name: idx_budget_execution_created; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_budget_execution_created ON public.budget_execution USING btree (created_at);


--
-- TOC entry 4881 (class 1259 OID 33754)
-- Name: idx_budget_execution_line; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_budget_execution_line ON public.budget_execution USING btree (budget_line_id);


--
-- TOC entry 4882 (class 1259 OID 33755)
-- Name: idx_budget_execution_period; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_budget_execution_period ON public.budget_execution USING btree (period_id);


--
-- TOC entry 4883 (class 1259 OID 33757)
-- Name: idx_budget_execution_source; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_budget_execution_source ON public.budget_execution USING btree (source_module, reference_id);


--
-- TOC entry 4886 (class 1259 OID 33758)
-- Name: idx_budget_line_code; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_budget_line_code ON public.budget_line USING btree (code);


--
-- TOC entry 4887 (class 1259 OID 33759)
-- Name: idx_budget_line_fiscal_year; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_budget_line_fiscal_year ON public.budget_line USING btree (fiscal_year_id);


--
-- TOC entry 4888 (class 1259 OID 33760)
-- Name: idx_budget_line_ministry; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_budget_line_ministry ON public.budget_line USING btree (ministry_id);


--
-- TOC entry 4889 (class 1259 OID 33761)
-- Name: idx_budget_line_org_unit; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_budget_line_org_unit ON public.budget_line USING btree (org_unit_id);


--
-- TOC entry 5008 (class 1259 OID 33966)
-- Name: idx_career_event_agent; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_career_event_agent ON public.career_events USING btree (agent_id);


--
-- TOC entry 5009 (class 1259 OID 33968)
-- Name: idx_career_event_date; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_career_event_date ON public.career_events USING btree (effective_date);


--
-- TOC entry 5010 (class 1259 OID 33967)
-- Name: idx_career_event_type; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_career_event_type ON public.career_events USING btree (event_type);


--
-- TOC entry 4837 (class 1259 OID 33728)
-- Name: idx_contract_active; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_contract_active ON public.agent_contract USING btree (is_active);


--
-- TOC entry 4838 (class 1259 OID 33726)
-- Name: idx_contract_agent; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_contract_agent ON public.agent_contract USING btree (agent_id);


--
-- TOC entry 4839 (class 1259 OID 33727)
-- Name: idx_contract_dates; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_contract_dates ON public.agent_contract USING btree (start_date, end_date);


--
-- TOC entry 4842 (class 1259 OID 33729)
-- Name: idx_deduction_rule_agent; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_deduction_rule_agent ON public.agent_deduction_rule USING btree (agent_id);


--
-- TOC entry 4843 (class 1259 OID 33730)
-- Name: idx_deduction_rule_type; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_deduction_rule_type ON public.agent_deduction_rule USING btree (deduction_type_id);


--
-- TOC entry 4844 (class 1259 OID 33731)
-- Name: idx_deduction_rule_validity; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_deduction_rule_validity ON public.agent_deduction_rule USING btree (valid_from, valid_to);


--
-- TOC entry 4894 (class 1259 OID 33764)
-- Name: idx_deduction_type_code; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_deduction_type_code ON public.deduction_type USING btree (code);


--
-- TOC entry 4899 (class 1259 OID 33767)
-- Name: idx_earning_type_code; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_earning_type_code ON public.earning_type USING btree (code);


--
-- TOC entry 5011 (class 1259 OID 33969)
-- Name: idx_evaluation_agent; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_evaluation_agent ON public.performance_evaluations USING btree (agent_id);


--
-- TOC entry 5012 (class 1259 OID 33970)
-- Name: idx_evaluation_year; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_evaluation_year ON public.performance_evaluations USING btree (reference_year);


--
-- TOC entry 4904 (class 1259 OID 33771)
-- Name: idx_fiscal_year_status; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_fiscal_year_status ON public.fiscal_year USING btree (status);


--
-- TOC entry 4905 (class 1259 OID 33770)
-- Name: idx_fiscal_year_year; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_fiscal_year_year ON public.fiscal_year USING btree (year);


--
-- TOC entry 4847 (class 1259 OID 33732)
-- Name: idx_history_agent_id; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_history_agent_id ON public.agent_status_history USING btree (agent_id);


--
-- TOC entry 4848 (class 1259 OID 33733)
-- Name: idx_history_changed_at; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_history_changed_at ON public.agent_status_history USING btree (changed_at);


--
-- TOC entry 4908 (class 1259 OID 33774)
-- Name: idx_ministry_code; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_ministry_code ON public.ministry USING btree (code);


--
-- TOC entry 4913 (class 1259 OID 33777)
-- Name: idx_org_unit_code; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_org_unit_code ON public.org_unit USING btree (code);


--
-- TOC entry 4914 (class 1259 OID 33778)
-- Name: idx_org_unit_ministry; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_org_unit_ministry ON public.org_unit USING btree (ministry_id);


--
-- TOC entry 4915 (class 1259 OID 33779)
-- Name: idx_org_unit_parent; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_org_unit_parent ON public.org_unit USING btree (parent_unit_id);


--
-- TOC entry 4920 (class 1259 OID 33785)
-- Name: idx_payment_batch_created; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payment_batch_created ON public.payment_batch USING btree (created_at);


--
-- TOC entry 4921 (class 1259 OID 33783)
-- Name: idx_payment_batch_ministry; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payment_batch_ministry ON public.payment_batch USING btree (ministry_id);


--
-- TOC entry 4922 (class 1259 OID 33782)
-- Name: idx_payment_batch_period; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payment_batch_period ON public.payment_batch USING btree (period_id);


--
-- TOC entry 4923 (class 1259 OID 33784)
-- Name: idx_payment_batch_status; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payment_batch_status ON public.payment_batch USING btree (status);


--
-- TOC entry 4932 (class 1259 OID 33791)
-- Name: idx_payment_date; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payment_date ON public.payments USING btree (payment_date);


--
-- TOC entry 4933 (class 1259 OID 33790)
-- Name: idx_payment_number; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payment_number ON public.payments USING btree (payment_number);


--
-- TOC entry 4926 (class 1259 OID 33788)
-- Name: idx_payment_order_agent; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payment_order_agent ON public.payment_order USING btree (agent_id);


--
-- TOC entry 4927 (class 1259 OID 33786)
-- Name: idx_payment_order_batch; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payment_order_batch ON public.payment_order USING btree (payment_batch_id);


--
-- TOC entry 4928 (class 1259 OID 33787)
-- Name: idx_payment_order_payroll_run; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payment_order_payroll_run ON public.payment_order USING btree (payroll_run_id);


--
-- TOC entry 4929 (class 1259 OID 33789)
-- Name: idx_payment_order_status; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payment_order_status ON public.payment_order USING btree (status);


--
-- TOC entry 4934 (class 1259 OID 33792)
-- Name: idx_payment_status; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payment_status ON public.payments USING btree (status);


--
-- TOC entry 4939 (class 1259 OID 33796)
-- Name: idx_payroll_item_agent; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payroll_item_agent ON public.payroll_item USING btree (agent_id);


--
-- TOC entry 4940 (class 1259 OID 33795)
-- Name: idx_payroll_item_run; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payroll_item_run ON public.payroll_item USING btree (payroll_run_id);


--
-- TOC entry 4941 (class 1259 OID 33797)
-- Name: idx_payroll_item_type; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payroll_item_type ON public.payroll_item USING btree (line_type);


--
-- TOC entry 4944 (class 1259 OID 33798)
-- Name: idx_payroll_period_fiscal; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payroll_period_fiscal ON public.payroll_period USING btree (fiscal_year, month);


--
-- TOC entry 4945 (class 1259 OID 33799)
-- Name: idx_payroll_period_status; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payroll_period_status ON public.payroll_period USING btree (status);


--
-- TOC entry 4948 (class 1259 OID 33801)
-- Name: idx_payroll_run_ministry; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payroll_run_ministry ON public.payroll_run USING btree (ministry_id);


--
-- TOC entry 4949 (class 1259 OID 33802)
-- Name: idx_payroll_run_org_unit; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payroll_run_org_unit ON public.payroll_run USING btree (org_unit_id);


--
-- TOC entry 4950 (class 1259 OID 33800)
-- Name: idx_payroll_run_period; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payroll_run_period ON public.payroll_run USING btree (period_id);


--
-- TOC entry 4951 (class 1259 OID 33803)
-- Name: idx_payroll_run_status; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_payroll_run_status ON public.payroll_run USING btree (status);


--
-- TOC entry 4954 (class 1259 OID 33804)
-- Name: idx_permission_code; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_permission_code ON public.permissions USING btree (code);


--
-- TOC entry 4959 (class 1259 OID 33807)
-- Name: idx_position_code; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_position_code ON public."position" USING btree (code);


--
-- TOC entry 4960 (class 1259 OID 33808)
-- Name: idx_position_org_unit; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_position_org_unit ON public."position" USING btree (org_unit_id);


--
-- TOC entry 4965 (class 1259 OID 33811)
-- Name: idx_role_code; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_role_code ON public.role USING btree (code);


--
-- TOC entry 4970 (class 1259 OID 33814)
-- Name: idx_salary_category_code; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_salary_category_code ON public.salary_category USING btree (code);


--
-- TOC entry 4975 (class 1259 OID 33818)
-- Name: idx_salary_grade_category; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_salary_grade_category ON public.salary_grade USING btree (category_id);


--
-- TOC entry 4976 (class 1259 OID 33817)
-- Name: idx_salary_grade_code; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_salary_grade_code ON public.salary_grade USING btree (code);


--
-- TOC entry 4979 (class 1259 OID 33819)
-- Name: idx_salary_grid_step; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_salary_grid_step ON public.salary_grid USING btree (step_id);


--
-- TOC entry 4980 (class 1259 OID 33820)
-- Name: idx_salary_grid_validity; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_salary_grid_validity ON public.salary_grid USING btree (valid_from, valid_to);


--
-- TOC entry 4983 (class 1259 OID 33821)
-- Name: idx_salary_step_grade; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_salary_step_grade ON public.salary_step USING btree (grade_id);


--
-- TOC entry 4984 (class 1259 OID 33822)
-- Name: idx_salary_step_number; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_salary_step_number ON public.salary_step USING btree (grade_id, step_number);


--
-- TOC entry 4987 (class 1259 OID 33823)
-- Name: idx_treasury_payment_order; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_treasury_payment_order ON public.treasury_payment USING btree (payment_order_id);


--
-- TOC entry 4988 (class 1259 OID 33825)
-- Name: idx_treasury_payment_paid; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_treasury_payment_paid ON public.treasury_payment USING btree (paid_at);


--
-- TOC entry 4989 (class 1259 OID 33824)
-- Name: idx_treasury_payment_status; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_treasury_payment_status ON public.treasury_payment USING btree (status);


--
-- TOC entry 4992 (class 1259 OID 33826)
-- Name: idx_user_email; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_user_email ON public.user_account USING btree (email);


--
-- TOC entry 5000 (class 1259 OID 33833)
-- Name: idx_user_role_role; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_user_role_role ON public.user_role USING btree (role_id);


--
-- TOC entry 5003 (class 1259 OID 33832)
-- Name: idx_user_role_user; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_user_role_user ON public.user_role USING btree (user_id);


--
-- TOC entry 4993 (class 1259 OID 33827)
-- Name: idx_user_username; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_user_username ON public.user_account USING btree (username);


--
-- TOC entry 5031 (class 2606 OID 33896)
-- Name: payroll_item fk45qpwh97cpwd5iuibij19m9fq; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.payroll_item
    ADD CONSTRAINT fk45qpwh97cpwd5iuibij19m9fq FOREIGN KEY (deduction_type_id) REFERENCES public.deduction_type(id);


--
-- TOC entry 5021 (class 2606 OID 33846)
-- Name: agent_deduction_rule fk5j7rqee6x13ueyrfbv59do11r; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.agent_deduction_rule
    ADD CONSTRAINT fk5j7rqee6x13ueyrfbv59do11r FOREIGN KEY (agent_id) REFERENCES public.agents(id);


--
-- TOC entry 5034 (class 2606 OID 33911)
-- Name: payroll_run fk62ga7hprxnjn4djtto0som3gw; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.payroll_run
    ADD CONSTRAINT fk62ga7hprxnjn4djtto0som3gw FOREIGN KEY (period_id) REFERENCES public.payroll_period(id);


--
-- TOC entry 5040 (class 2606 OID 33946)
-- Name: user_role fk7ojmv1m1vrxfl3kvt5bi5ur73; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.user_role
    ADD CONSTRAINT fk7ojmv1m1vrxfl3kvt5bi5ur73 FOREIGN KEY (user_id) REFERENCES public.user_account(id);


--
-- TOC entry 5024 (class 2606 OID 33861)
-- Name: audit_log fk7sviolp1kqlltq032ekwqjmx5; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.audit_log
    ADD CONSTRAINT fk7sviolp1kqlltq032ekwqjmx5 FOREIGN KEY (user_id) REFERENCES public.user_account(id);


--
-- TOC entry 5045 (class 2606 OID 33997)
-- Name: tax_bracket fk87emn6qquqbed74580dmgmaqe; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tax_bracket
    ADD CONSTRAINT fk87emn6qquqbed74580dmgmaqe FOREIGN KEY (deduction_type_id) REFERENCES public.deduction_type(id);


--
-- TOC entry 5038 (class 2606 OID 33931)
-- Name: salary_step fk926cwp5ji8b06qiiiiv3sqlja; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.salary_step
    ADD CONSTRAINT fk926cwp5ji8b06qiiiiv3sqlja FOREIGN KEY (grade_id) REFERENCES public.salary_grade(id);


--
-- TOC entry 5041 (class 2606 OID 33941)
-- Name: user_role fka68196081fvovjhkek5m97n3y; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.user_role
    ADD CONSTRAINT fka68196081fvovjhkek5m97n3y FOREIGN KEY (role_id) REFERENCES public.role(id);


--
-- TOC entry 5035 (class 2606 OID 33916)
-- Name: position fkbbn7jvjl8cvllximprtblfd2t; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public."position"
    ADD CONSTRAINT fkbbn7jvjl8cvllximprtblfd2t FOREIGN KEY (org_unit_id) REFERENCES public.org_unit(id);


--
-- TOC entry 5023 (class 2606 OID 33856)
-- Name: agent_status_history fkc1r2r4wol8cf0h43whsvm7nsp; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.agent_status_history
    ADD CONSTRAINT fkc1r2r4wol8cf0h43whsvm7nsp FOREIGN KEY (agent_id) REFERENCES public.agents(id);


--
-- TOC entry 5028 (class 2606 OID 33886)
-- Name: org_unit fkf6be4ocgeajh37jkn215h7xa; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.org_unit
    ADD CONSTRAINT fkf6be4ocgeajh37jkn215h7xa FOREIGN KEY (parent_unit_id) REFERENCES public.org_unit(id);


--
-- TOC entry 5032 (class 2606 OID 33906)
-- Name: payroll_item fkf6n1gq50mjyf80yvm0gdhj9h2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.payroll_item
    ADD CONSTRAINT fkf6n1gq50mjyf80yvm0gdhj9h2 FOREIGN KEY (payroll_run_id) REFERENCES public.payroll_run(id);


--
-- TOC entry 5042 (class 2606 OID 33971)
-- Name: career_events fkgyfkvk2ltql9to48flashbbxn; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.career_events
    ADD CONSTRAINT fkgyfkvk2ltql9to48flashbbxn FOREIGN KEY (agent_id) REFERENCES public.agents(id);


--
-- TOC entry 5039 (class 2606 OID 33936)
-- Name: treasury_payment fkh9jrbff9k11eugtcv5mh8dxlh; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.treasury_payment
    ADD CONSTRAINT fkh9jrbff9k11eugtcv5mh8dxlh FOREIGN KEY (payment_order_id) REFERENCES public.payment_order(id);


--
-- TOC entry 5026 (class 2606 OID 33871)
-- Name: budget_execution fkhk3hwn5k0efpc9vae02hcf0fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.budget_execution
    ADD CONSTRAINT fkhk3hwn5k0efpc9vae02hcf0fk FOREIGN KEY (budget_line_id) REFERENCES public.budget_line(id);


--
-- TOC entry 5030 (class 2606 OID 33891)
-- Name: payment_order fkho61cbt8m42tj18ibltl833kn; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.payment_order
    ADD CONSTRAINT fkho61cbt8m42tj18ibltl833kn FOREIGN KEY (payment_batch_id) REFERENCES public.payment_batch(id);


--
-- TOC entry 5022 (class 2606 OID 33851)
-- Name: agent_deduction_rule fkkhxq3dxsh4s437ewbw7lobl3x; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.agent_deduction_rule
    ADD CONSTRAINT fkkhxq3dxsh4s437ewbw7lobl3x FOREIGN KEY (deduction_type_id) REFERENCES public.deduction_type(id);


--
-- TOC entry 5043 (class 2606 OID 33976)
-- Name: performance_evaluations fkkqsoyl90c8x5iy8kpp0hvut8r; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.performance_evaluations
    ADD CONSTRAINT fkkqsoyl90c8x5iy8kpp0hvut8r FOREIGN KEY (agent_id) REFERENCES public.agents(id);


--
-- TOC entry 5036 (class 2606 OID 33921)
-- Name: salary_grade fklkqjnuarrekti8ryxjlb9wacm; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.salary_grade
    ADD CONSTRAINT fklkqjnuarrekti8ryxjlb9wacm FOREIGN KEY (category_id) REFERENCES public.salary_category(id);


--
-- TOC entry 5044 (class 2606 OID 33992)
-- Name: global_deduction_rule fkoblnubxgi890abe96g8ng80ml; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.global_deduction_rule
    ADD CONSTRAINT fkoblnubxgi890abe96g8ng80ml FOREIGN KEY (deduction_type_id) REFERENCES public.deduction_type(id);


--
-- TOC entry 5027 (class 2606 OID 33876)
-- Name: budget_line fkowlsgo4wr667t5y2jh0boy4i9; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.budget_line
    ADD CONSTRAINT fkowlsgo4wr667t5y2jh0boy4i9 FOREIGN KEY (fiscal_year_id) REFERENCES public.fiscal_year(id);


--
-- TOC entry 5037 (class 2606 OID 33926)
-- Name: salary_grid fkp5hmgwt4jmj3cq97df6g6eujs; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.salary_grid
    ADD CONSTRAINT fkp5hmgwt4jmj3cq97df6g6eujs FOREIGN KEY (step_id) REFERENCES public.salary_step(id);


--
-- TOC entry 5019 (class 2606 OID 33836)
-- Name: agent_bank_account fkpdk4lg29knasd7vtt41pj67hw; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.agent_bank_account
    ADD CONSTRAINT fkpdk4lg29knasd7vtt41pj67hw FOREIGN KEY (agent_id) REFERENCES public.agents(id);


--
-- TOC entry 5029 (class 2606 OID 33881)
-- Name: org_unit fkpyt0inqtsdo0ll94wp37rhky9; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.org_unit
    ADD CONSTRAINT fkpyt0inqtsdo0ll94wp37rhky9 FOREIGN KEY (ministry_id) REFERENCES public.ministry(id);


--
-- TOC entry 5020 (class 2606 OID 33841)
-- Name: agent_contract fkslqfmiu5le08qchwc2r03agpw; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.agent_contract
    ADD CONSTRAINT fkslqfmiu5le08qchwc2r03agpw FOREIGN KEY (agent_id) REFERENCES public.agents(id);


--
-- TOC entry 5025 (class 2606 OID 33866)
-- Name: budget_allocation fksxsu8mpck5k3xtalryod5kib1; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.budget_allocation
    ADD CONSTRAINT fksxsu8mpck5k3xtalryod5kib1 FOREIGN KEY (budget_line_id) REFERENCES public.budget_line(id);


--
-- TOC entry 5033 (class 2606 OID 33901)
-- Name: payroll_item fkt2wr0bdlfgohk9k3ut67tvwhs; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.payroll_item
    ADD CONSTRAINT fkt2wr0bdlfgohk9k3ut67tvwhs FOREIGN KEY (earning_type_id) REFERENCES public.earning_type(id);


--
-- TOC entry 5232 (class 0 OID 0)
-- Dependencies: 5
-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: postgres
--

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


-- Completed on 2025-12-21 03:25:29

--
-- PostgreSQL database dump complete
--

