--
-- PostgreSQL database dump
--

-- Dumped from database version 16.3 (Debian 16.3-1.pgdg120+1)
-- Dumped by pg_dump version 16.3 (Debian 16.3-1.pgdg120+1)

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

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


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

COMMENT ON SCHEMA public IS '';


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

CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA public;


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

COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions';


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

CREATE TYPE public."ApprovalState" AS ENUM (
    'UNKNOWN',
    'FREE',
    'REQUIRED',
    'REQUESTED',
    'APPROVED'
);


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

CREATE TYPE public."CostTypeVariant" AS ENUM (
    'NACHTZUSCHLAG',
    'WOCHENENDZUSCHLAG',
    'FEIERTAGSZUSCHLAG',
    'DESINFEKTIONSZUSCHLAG',
    'KILOMETERZUSCHLAG',
    'FAHRZEUGZUSCHLAG',
    'TSWDIFFERENZIERUNG',
    'GRUNDPREIS',
    'GRUNDPREIS_ZEIT',
    'PRIVATVERSICHERUNG',
    'TRAGEHILFE'
);


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

CREATE TYPE public."TicketState" AS ENUM (
    'CREATED',
    'APPROVAL_REQUIRED',
    'READY',
    'DONE',
    'BILLABLE',
    'ARCHIVED'
);


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

CREATE TYPE public."TicketValidationState" AS ENUM (
    'CREATED',
    'USER_INTERACTION_REQUIRED',
    'TD_UNCERTAIN',
    'DOCUMENTS_MISSING',
    'ARCHIVED'
);


SET default_tablespace = '';

SET default_table_access_method = heap;

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

CREATE TABLE public."Anomaly" (
    id text NOT NULL,
    type text NOT NULL,
    description text NOT NULL,
    "groupKey" text NOT NULL,
    "groupDescription" text NOT NULL,
    "associatedEntities" jsonb DEFAULT '{}'::jsonb,
    "workedOnBy" text NOT NULL,
    "sleepTimer" integer NOT NULL,
    "sleepSince" timestamp(3) without time zone,
    "resolvedAt" timestamp(3) without time zone,
    "manuallyResolved" boolean DEFAULT false NOT NULL,
    "createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);


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

CREATE TABLE public."AttendanceRegistration" (
    "attendanceRegistrationId" integer NOT NULL,
    "employeeId" integer NOT NULL,
    "personnelNumber" text,
    "dateTime" timestamp(3) without time zone NOT NULL,
    event text NOT NULL
);


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

CREATE TABLE public."AttendanceRegistrationSource" (
    "internalId" uuid DEFAULT gen_random_uuid() NOT NULL,
    "insertedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    "jobId" text NOT NULL,
    "attendanceRegistrationId" text,
    "employeeId" text,
    "personnelNumber" text,
    "dateTime" text,
    event text
);


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

CREATE TABLE public."AttendanceRegistrationStaging" (
    "internalId" uuid DEFAULT gen_random_uuid() NOT NULL,
    "attendanceRegistrationId" integer NOT NULL,
    "employeeId" integer NOT NULL,
    "dateTime" timestamp(3) without time zone NOT NULL,
    event text NOT NULL,
    "personnelNumber" text DEFAULT ''::text
);


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

CREATE TABLE public."AvicennaTenant" (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    "healthInsuranceNumber" text NOT NULL,
    name text NOT NULL
);


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

CREATE TABLE public."CostType" (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    description text NOT NULL,
    variant public."CostTypeVariant" NOT NULL,
    "costAmount" integer NOT NULL,
    "timeRange" text,
    "kmInclusive" integer,
    "excludeCarNames" text[],
    "infectionType" text,
    "tariffId" uuid
);


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

CREATE TABLE public."DyflexisEmployee" (
    "internalId" uuid DEFAULT gen_random_uuid() NOT NULL,
    id integer NOT NULL,
    firstname text NOT NULL,
    surname text NOT NULL,
    "contractStart" timestamp(3) without time zone NOT NULL,
    "contractEnd" timestamp(3) without time zone,
    "contractDaysWeek" integer DEFAULT 0 NOT NULL,
    "contractHoursWeek" double precision NOT NULL,
    "contractSalaryHour" double precision NOT NULL,
    "contractTypeName" text
);


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

CREATE TABLE public."Employee" (
    id text NOT NULL,
    name text NOT NULL,
    surname text NOT NULL,
    "personnelNumber" text,
    mobile text,
    qualification text,
    "occuptationalHealthExamination" timestamp(3) without time zone,
    "personTransportCertificate" timestamp(3) without time zone
);


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

CREATE TABLE public."EmployeeDispoLiveSource" (
    "internalId" uuid DEFAULT gen_random_uuid() NOT NULL,
    "insertedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    "jobId" text NOT NULL,
    id text,
    "pScheinAblaufDatum" text,
    name text,
    surname text,
    "persId" text,
    "importPersId" text,
    qualifikation text
);


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

CREATE TABLE public."EmployeeDispoLiveStaging" (
    "internalId" uuid DEFAULT gen_random_uuid() NOT NULL,
    id text NOT NULL,
    name text,
    surname text,
    "personnelNumber" text,
    qualification text,
    "personTransportCertificate" timestamp(3) without time zone
);


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

CREATE TABLE public."EmployeeDyflexisSource" (
    "internalId" uuid DEFAULT gen_random_uuid() NOT NULL,
    "insertedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    "jobId" text NOT NULL,
    id text,
    firstname text,
    surname text,
    contract_id text,
    contract_start text,
    contract_end text,
    contract_hours_week text,
    contract_salary_hour text,
    contract_type_name text
);


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

CREATE TABLE public."EmployeeDyflexisStaging" (
    "internalId" uuid DEFAULT gen_random_uuid() NOT NULL,
    id integer NOT NULL,
    firstname text NOT NULL,
    surname text NOT NULL,
    "contractStart" timestamp(3) without time zone NOT NULL,
    "contractEnd" timestamp(3) without time zone NOT NULL,
    "contractHoursWeek" double precision NOT NULL,
    "contractSalaryHour" double precision NOT NULL,
    "contractTypeName" text
);


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

CREATE TABLE public."Holiday" (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    date timestamp(3) without time zone NOT NULL,
    locked boolean NOT NULL,
    "excludedFromPayroll" boolean NOT NULL,
    "employeeId" integer NOT NULL
);


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

CREATE TABLE public."Patient" (
    id text NOT NULL,
    surname text,
    name text,
    street text,
    zip text,
    city text,
    birthday timestamp(3) without time zone,
    "healthinsuranceId" text,
    healthinsurance text,
    "careDegree" text,
    "disabilityMark1" text,
    "disabilityMark2" text
);


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

CREATE TABLE public."PatientSource" (
    "internalId" uuid DEFAULT gen_random_uuid() NOT NULL,
    "insertedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    "jobId" text NOT NULL,
    id text,
    surname text,
    name text,
    street text,
    zip text,
    city text,
    birthday text,
    "kkId" text,
    krankenkasse text,
    pflegestufe text,
    behinderung1 text,
    behinderung2 text
);


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

CREATE TABLE public."PatientStaging" (
    "internalId" uuid DEFAULT gen_random_uuid() NOT NULL,
    id text,
    surname text,
    name text,
    street text,
    zip text,
    city text,
    birthday timestamp(3) without time zone,
    "healthinsuranceId" text,
    healthinsurance text,
    "careDegree" text,
    "disabilityMark1" text,
    "disabilityMark2" text
);


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

CREATE TABLE public."PlannedTime" (
    id text NOT NULL,
    "userId" text NOT NULL,
    firstname text,
    surname text,
    "startDate" timestamp(3) without time zone,
    "endDate" timestamp(3) without time zone,
    department text,
    pause integer NOT NULL,
    duration integer NOT NULL,
    note text
);


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

CREATE TABLE public."PlannedTimeSource" (
    "internalId" uuid DEFAULT gen_random_uuid() NOT NULL,
    "insertedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    "jobId" text NOT NULL,
    id text,
    user_id text,
    firstname text,
    surname text,
    department_id text,
    department_name text,
    start_date text,
    end_date text,
    pauze text,
    duration text,
    deleted text,
    mark text
);


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

CREATE TABLE public."PlannedTimeStaging" (
    "internalId" uuid DEFAULT gen_random_uuid() NOT NULL,
    id integer NOT NULL,
    "employeeId" integer NOT NULL,
    firstname text,
    surname text,
    "departmentName" text,
    "startDate" timestamp(3) without time zone NOT NULL,
    "endDate" timestamp(3) without time zone NOT NULL,
    deleted boolean NOT NULL,
    mark text,
    pause integer NOT NULL,
    duration integer NOT NULL
);


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

CREATE TABLE public."Sickdays" (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    start timestamp(3) without time zone NOT NULL,
    "end" timestamp(3) without time zone NOT NULL,
    hours double precision NOT NULL,
    days integer NOT NULL,
    note text,
    locked boolean NOT NULL,
    "employeeId" integer NOT NULL
);


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

CREATE TABLE public."SolutionTarget" (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    name text NOT NULL,
    "anomalyId" text
);


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

CREATE TABLE public."SolutionTargetStep" (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    description text NOT NULL,
    "solutionTargetId" uuid
);


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

CREATE TABLE public."Tariff" (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    "validFrom" timestamp(3) without time zone,
    "validTo" timestamp(3) without time zone,
    "tariffGroupId" uuid
);


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

CREATE TABLE public."TariffGroup" (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    description text NOT NULL,
    "ordinanceType" text NOT NULL
);


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

CREATE TABLE public."Ticket" (
    id uuid NOT NULL,
    "patientId" uuid,
    stage text NOT NULL,
    "approvalRequirement" text NOT NULL,
    "approvalStatus" text NOT NULL,
    "approvalRequestedAt" timestamp(3) without time zone,
    "approvalLastInteractionAt" timestamp(3) without time zone,
    "approvalReminderCount" integer DEFAULT 0 NOT NULL,
    "hasPhysicalTransportDocument" boolean DEFAULT false NOT NULL,
    "hasDigitalTransportDocument" boolean DEFAULT false NOT NULL,
    "updatedAt" timestamp(3) without time zone,
    "createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    "currentState" public."TicketValidationState",
    notes text[],
    errors text[],
    "isUrgent" boolean DEFAULT false NOT NULL,
    urgency timestamp(3) without time zone DEFAULT '2099-12-31 23:59:59.999'::timestamp without time zone NOT NULL,
    "approvalState" public."ApprovalState",
    "documentInfo" jsonb DEFAULT '{"approval": {"isNeeded": null, "answeredFrom": "", "whoRequested": ""}, "tdLocation": ""}'::jsonb
);


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

CREATE TABLE public."TicketStateHistory" (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    state public."TicketValidationState" NOT NULL,
    "createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    "ticketId" uuid NOT NULL
);


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

CREATE TABLE public."Tour" (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    done boolean NOT NULL,
    direction text NOT NULL,
    "carName" text,
    "operationId" text NOT NULL,
    "driverId" text,
    "driverName" text,
    "codriverId" text,
    "codriverName" text,
    "patientId" text,
    "patientName" text,
    "patientSurname" text,
    "patientStreet" text,
    "patientZip" text,
    "patientCity" text,
    "healthInsurance" text,
    "healthInsuranceNumber" text,
    type text,
    category text,
    "transportType" text,
    "ordinanceType" text,
    "rangeEndDate" timestamp(3) without time zone,
    "startInstitution" text,
    "startStreet" text,
    "startZip" text,
    "startCity" text,
    "targetInstitution" text,
    "targetStreet" text,
    "targetZip" text,
    "targetCity" text,
    "startDate" timestamp(3) without time zone NOT NULL,
    "check" integer DEFAULT 0 NOT NULL,
    "occupiedKm" double precision,
    "totalKm" double precision,
    "startBegin" text,
    "startEnd" text,
    target text,
    "targetBegin" text,
    empty text,
    "hasInfection" boolean DEFAULT false NOT NULL,
    "infectionName" text,
    "revenueDispoLive" double precision,
    "billDate" timestamp(3) without time zone,
    "billNumber" text,
    revenue double precision DEFAULT 0 NOT NULL,
    "consumptionCosts" double precision DEFAULT 0 NOT NULL,
    "revenueDeviation" double precision DEFAULT 0 NOT NULL,
    "overRTW" boolean DEFAULT false NOT NULL,
    "companyName" text,
    schwerlast boolean DEFAULT false NOT NULL,
    "createdAt" timestamp(3) without time zone,
    "updatedAt" timestamp(3) without time zone,
    "deletedAt" timestamp(3) without time zone,
    "ticketId" uuid
);


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

CREATE TABLE public."TourFile" (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    "tourId" text NOT NULL,
    "ticketId" text NOT NULL,
    "storagePath" text NOT NULL,
    "originalFilename" text NOT NULL,
    "mimeType" text NOT NULL,
    "fileSizeBytes" integer NOT NULL,
    "dlUploadStatus" text DEFAULT 'pending'::text NOT NULL,
    "createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP
);


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

CREATE TABLE public."TourSource" (
    "internalId" uuid DEFAULT gen_random_uuid() NOT NULL,
    "insertedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    "jobId" text NOT NULL,
    id text,
    "check" text,
    "createTime" text,
    "lastUpdate" text,
    "empfangenVonId" text,
    endgen text,
    "serienId" text,
    "serienKategorName" text,
    "serienKategorie" text,
    "zadStatus" text,
    "abrDate" text,
    "abrNum" text,
    "abrTime" text,
    "ausrueckZeit" text,
    "startTime" text,
    "startDate" text,
    date text,
    date_iso text,
    dauergenehmigung text,
    direction text,
    "distanceValue" text,
    "besetztKm" text,
    gefahren text,
    "gesamtPreis" text,
    infektion text,
    "itDesc" text,
    "itKrz" text,
    "itName" text,
    "kkId" text,
    krankenkasse text,
    "patId" text,
    "patName" text,
    "patSurname" text,
    "patStreet" text,
    "patZip" text,
    "patCity" text,
    "startInstitution" text,
    "startStreet" text,
    "startZip" text,
    "startCity" text,
    "targetInstitution" text,
    "targetStreet" text,
    "targetZip" text,
    "targetCity" text,
    "transportKrz" text,
    "transportName" text,
    transportart text,
    "verordnungsId" text,
    "verordnungsName" text,
    type text,
    "startBegin" text,
    "startEnd" text,
    frei text,
    ziel text,
    "zielBegin" text,
    "endTime" text,
    "endDate" text,
    "einsatzNummer" text,
    "carName" text,
    "carNo" text,
    "beifahrerName" text,
    beifahrer text,
    "fahrerName" text,
    fahrer text,
    color text,
    "overRTW" text,
    "companyName" text,
    schwerlast text
);


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

CREATE TABLE public."TourStaging" (
    "internalId" uuid DEFAULT gen_random_uuid() NOT NULL,
    id text,
    done boolean,
    direction text,
    "carName" text,
    "operationId" text,
    "driverId" text,
    "driverName" text,
    "codriverId" text,
    "codriverName" text,
    "patientId" text,
    "patientName" text,
    "patientSurname" text,
    "patientStreet" text,
    "patientZip" text,
    "patientCity" text,
    "healthInsurance" text,
    "healthInsuranceNumber" text,
    type text,
    category text,
    "transportType" text,
    "ordinanceType" text,
    "rangeEndDate" timestamp(3) without time zone,
    "startInstitution" text,
    "startStreet" text,
    "startZip" text,
    "startCity" text,
    "targetInstitution" text,
    "targetStreet" text,
    "targetZip" text,
    "targetCity" text,
    "startDate" timestamp(3) without time zone,
    "check" integer DEFAULT 0 NOT NULL,
    "occupiedKm" double precision,
    "totalKm" double precision,
    "startBegin" text,
    "startEnd" text,
    target text,
    "targetBegin" text,
    empty text,
    "hasInfection" boolean DEFAULT false NOT NULL,
    "infectionName" text,
    "revenueDispoLive" double precision,
    "billDate" timestamp(3) without time zone,
    "billNumber" text,
    revenue double precision DEFAULT 0 NOT NULL,
    "revenueDeviation" double precision DEFAULT 0 NOT NULL,
    "consumptionCosts" double precision DEFAULT 0 NOT NULL,
    "overRTW" boolean DEFAULT false NOT NULL,
    "companyName" text,
    schwerlast boolean DEFAULT false NOT NULL,
    "createdAt" timestamp(3) without time zone,
    "updatedAt" timestamp(3) without time zone
);


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

CREATE TABLE public."Trace" (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    type text NOT NULL,
    "entityKey" text NOT NULL,
    "createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);


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

CREATE TABLE public."WorkTime" (
    id text NOT NULL,
    "userId" text NOT NULL,
    firstname text NOT NULL,
    surname text NOT NULL,
    "startDate" timestamp(3) without time zone,
    "endDate" timestamp(3) without time zone,
    department text,
    pause integer NOT NULL,
    duration integer NOT NULL
);


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

CREATE TABLE public."WorkTimeSource" (
    "internalId" uuid DEFAULT gen_random_uuid() NOT NULL,
    "insertedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    "jobId" text NOT NULL,
    id text,
    user_id text,
    firstname text,
    surname text,
    department_id text,
    department_name text,
    start_date text,
    end_date text,
    pauze text,
    duration text
);


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

CREATE TABLE public."WorkTimeStaging" (
    "internalId" uuid DEFAULT gen_random_uuid() NOT NULL,
    id integer NOT NULL,
    "employeeId" integer NOT NULL,
    firstname text NOT NULL,
    surname text NOT NULL,
    "departmentName" text,
    "startDate" timestamp(3) without time zone NOT NULL,
    "endDate" timestamp(3) without time zone NOT NULL,
    pause integer NOT NULL,
    duration integer NOT NULL
);


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

CREATE TABLE public."_AvicennaTenantToTariffGroup" (
    "A" uuid NOT NULL,
    "B" uuid NOT NULL
);


--
-- Name: Anomaly Anomaly_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."Anomaly"
    ADD CONSTRAINT "Anomaly_pkey" PRIMARY KEY (id);


--
-- Name: AttendanceRegistrationSource AttendanceRegistrationSource_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."AttendanceRegistrationSource"
    ADD CONSTRAINT "AttendanceRegistrationSource_pkey" PRIMARY KEY ("internalId");


--
-- Name: AttendanceRegistrationStaging AttendanceRegistrationStaging_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."AttendanceRegistrationStaging"
    ADD CONSTRAINT "AttendanceRegistrationStaging_pkey" PRIMARY KEY ("internalId");


--
-- Name: AttendanceRegistration AttendanceRegistration_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."AttendanceRegistration"
    ADD CONSTRAINT "AttendanceRegistration_pkey" PRIMARY KEY ("attendanceRegistrationId");


--
-- Name: AvicennaTenant AvicennaTenant_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."AvicennaTenant"
    ADD CONSTRAINT "AvicennaTenant_pkey" PRIMARY KEY (id);


--
-- Name: DyflexisEmployee DyflexisEmployee_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."DyflexisEmployee"
    ADD CONSTRAINT "DyflexisEmployee_pkey" PRIMARY KEY ("internalId");


--
-- Name: EmployeeDispoLiveSource EmployeeDispoLiveSource_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."EmployeeDispoLiveSource"
    ADD CONSTRAINT "EmployeeDispoLiveSource_pkey" PRIMARY KEY ("internalId");


--
-- Name: EmployeeDispoLiveStaging EmployeeDispoLiveStaging_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."EmployeeDispoLiveStaging"
    ADD CONSTRAINT "EmployeeDispoLiveStaging_pkey" PRIMARY KEY ("internalId");


--
-- Name: EmployeeDyflexisSource EmployeeDyflexisSource_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."EmployeeDyflexisSource"
    ADD CONSTRAINT "EmployeeDyflexisSource_pkey" PRIMARY KEY ("internalId");


--
-- Name: EmployeeDyflexisStaging EmployeeDyflexisStaging_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."EmployeeDyflexisStaging"
    ADD CONSTRAINT "EmployeeDyflexisStaging_pkey" PRIMARY KEY ("internalId");


--
-- Name: Employee Employee_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."Employee"
    ADD CONSTRAINT "Employee_pkey" PRIMARY KEY (id);


--
-- Name: Holiday Holiday_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."Holiday"
    ADD CONSTRAINT "Holiday_pkey" PRIMARY KEY (id);


--
-- Name: PatientSource PatientSource_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."PatientSource"
    ADD CONSTRAINT "PatientSource_pkey" PRIMARY KEY ("internalId");


--
-- Name: PatientStaging PatientStaging_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."PatientStaging"
    ADD CONSTRAINT "PatientStaging_pkey" PRIMARY KEY ("internalId");


--
-- Name: Patient Patient_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."Patient"
    ADD CONSTRAINT "Patient_pkey" PRIMARY KEY (id);


--
-- Name: PlannedTimeSource PlannedTimeSource_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."PlannedTimeSource"
    ADD CONSTRAINT "PlannedTimeSource_pkey" PRIMARY KEY ("internalId");


--
-- Name: PlannedTimeStaging PlannedTimeStaging_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."PlannedTimeStaging"
    ADD CONSTRAINT "PlannedTimeStaging_pkey" PRIMARY KEY ("internalId");


--
-- Name: PlannedTime PlannedTime_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."PlannedTime"
    ADD CONSTRAINT "PlannedTime_pkey" PRIMARY KEY (id);


--
-- Name: Sickdays Sickdays_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."Sickdays"
    ADD CONSTRAINT "Sickdays_pkey" PRIMARY KEY (id);


--
-- Name: SolutionTargetStep SolutionTargetStep_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."SolutionTargetStep"
    ADD CONSTRAINT "SolutionTargetStep_pkey" PRIMARY KEY (id);


--
-- Name: SolutionTarget SolutionTarget_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."SolutionTarget"
    ADD CONSTRAINT "SolutionTarget_pkey" PRIMARY KEY (id);


--
-- Name: TariffGroup TariffGroup_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."TariffGroup"
    ADD CONSTRAINT "TariffGroup_pkey" PRIMARY KEY (id);


--
-- Name: Tariff Tariff_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."Tariff"
    ADD CONSTRAINT "Tariff_pkey" PRIMARY KEY (id);


--
-- Name: TicketStateHistory TicketStateHistory_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."TicketStateHistory"
    ADD CONSTRAINT "TicketStateHistory_pkey" PRIMARY KEY (id);


--
-- Name: Ticket Ticket_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."Ticket"
    ADD CONSTRAINT "Ticket_pkey" PRIMARY KEY (id);


--
-- Name: TourFile TourFile_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."TourFile"
    ADD CONSTRAINT "TourFile_pkey" PRIMARY KEY (id);


--
-- Name: TourSource TourSource_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."TourSource"
    ADD CONSTRAINT "TourSource_pkey" PRIMARY KEY ("internalId");


--
-- Name: TourStaging TourStaging_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."TourStaging"
    ADD CONSTRAINT "TourStaging_pkey" PRIMARY KEY ("internalId");


--
-- Name: Tour Tour_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."Tour"
    ADD CONSTRAINT "Tour_pkey" PRIMARY KEY (id);


--
-- Name: Trace Trace_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."Trace"
    ADD CONSTRAINT "Trace_pkey" PRIMARY KEY (id);


--
-- Name: WorkTimeSource WorkTimeSource_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."WorkTimeSource"
    ADD CONSTRAINT "WorkTimeSource_pkey" PRIMARY KEY ("internalId");


--
-- Name: WorkTimeStaging WorkTimeStaging_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."WorkTimeStaging"
    ADD CONSTRAINT "WorkTimeStaging_pkey" PRIMARY KEY ("internalId");


--
-- Name: WorkTime WorkTime_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."WorkTime"
    ADD CONSTRAINT "WorkTime_pkey" PRIMARY KEY (id);


--
-- Name: _AvicennaTenantToTariffGroup _AvicennaTenantToTariffGroup_AB_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."_AvicennaTenantToTariffGroup"
    ADD CONSTRAINT "_AvicennaTenantToTariffGroup_AB_pkey" PRIMARY KEY ("A", "B");


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

CREATE UNIQUE INDEX "CostType_id_key" ON public."CostType" USING btree (id);


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

CREATE UNIQUE INDEX "TourFile_tourId_ticketId_key" ON public."TourFile" USING btree ("tourId", "ticketId");


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

CREATE UNIQUE INDEX "Tour_operationId_key" ON public."Tour" USING btree ("operationId");


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

CREATE INDEX "_AvicennaTenantToTariffGroup_B_index" ON public."_AvicennaTenantToTariffGroup" USING btree ("B");


--
-- Name: CostType CostType_tariffId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."CostType"
    ADD CONSTRAINT "CostType_tariffId_fkey" FOREIGN KEY ("tariffId") REFERENCES public."Tariff"(id) ON UPDATE CASCADE ON DELETE SET NULL;


--
-- Name: SolutionTargetStep SolutionTargetStep_solutionTargetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."SolutionTargetStep"
    ADD CONSTRAINT "SolutionTargetStep_solutionTargetId_fkey" FOREIGN KEY ("solutionTargetId") REFERENCES public."SolutionTarget"(id) ON UPDATE CASCADE ON DELETE SET NULL;


--
-- Name: SolutionTarget SolutionTarget_anomalyId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."SolutionTarget"
    ADD CONSTRAINT "SolutionTarget_anomalyId_fkey" FOREIGN KEY ("anomalyId") REFERENCES public."Anomaly"(id) ON UPDATE CASCADE ON DELETE SET NULL;


--
-- Name: Tariff Tariff_tariffGroupId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."Tariff"
    ADD CONSTRAINT "Tariff_tariffGroupId_fkey" FOREIGN KEY ("tariffGroupId") REFERENCES public."TariffGroup"(id) ON UPDATE CASCADE ON DELETE SET NULL;


--
-- Name: TicketStateHistory TicketStateHistory_ticketId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."TicketStateHistory"
    ADD CONSTRAINT "TicketStateHistory_ticketId_fkey" FOREIGN KEY ("ticketId") REFERENCES public."Ticket"(id) ON UPDATE CASCADE ON DELETE RESTRICT;


--
-- Name: Tour Tour_ticketId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."Tour"
    ADD CONSTRAINT "Tour_ticketId_fkey" FOREIGN KEY ("ticketId") REFERENCES public."Ticket"(id) ON UPDATE CASCADE ON DELETE SET NULL;


--
-- Name: _AvicennaTenantToTariffGroup _AvicennaTenantToTariffGroup_A_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."_AvicennaTenantToTariffGroup"
    ADD CONSTRAINT "_AvicennaTenantToTariffGroup_A_fkey" FOREIGN KEY ("A") REFERENCES public."AvicennaTenant"(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: _AvicennaTenantToTariffGroup _AvicennaTenantToTariffGroup_B_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public."_AvicennaTenantToTariffGroup"
    ADD CONSTRAINT "_AvicennaTenantToTariffGroup_B_fkey" FOREIGN KEY ("B") REFERENCES public."TariffGroup"(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- PostgreSQL database dump complete
--

