diff --git a/db/migrations/0000_brief_dark_beast.sql b/db/migrations/0000_brief_dark_beast.sql new file mode 100644 index 0000000..adfe24f --- /dev/null +++ b/db/migrations/0000_brief_dark_beast.sql @@ -0,0 +1,1312 @@ +CREATE TYPE "public"."credential_types" AS ENUM('mail', 'm365');--> statement-breakpoint +CREATE TYPE "public"."folderfunctions" AS ENUM('none', 'yearSubCategory', 'incomingInvoices', 'invoices', 'quotes', 'confirmationOrders', 'deliveryNotes', 'vehicleData', 'reminders', 'taxData', 'deposit', 'timeEvaluations');--> statement-breakpoint +CREATE TYPE "public"."locked_tenant" AS ENUM('maintenance_tenant', 'maintenance', 'general', 'no_subscription');--> statement-breakpoint +CREATE TYPE "public"."notification_channel" AS ENUM('email', 'inapp', 'sms', 'push', 'webhook');--> statement-breakpoint +CREATE TYPE "public"."notification_severity" AS ENUM('info', 'success', 'warning', 'error');--> statement-breakpoint +CREATE TYPE "public"."notification_status" AS ENUM('queued', 'sent', 'failed', 'read');--> statement-breakpoint +CREATE TYPE "public"."payment_types" AS ENUM('transfer', 'direct_debit');--> statement-breakpoint +CREATE TYPE "public"."texttemplatepositions" AS ENUM('startText', 'endText');--> statement-breakpoint +CREATE TYPE "public"."times_state" AS ENUM('submitted', 'approved', 'draft');--> statement-breakpoint +CREATE TABLE "accounts" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "accounts_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "number" text NOT NULL, + "label" text NOT NULL, + "description" text +); +--> statement-breakpoint +CREATE TABLE "auth_profiles" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "user_id" uuid, + "tenant_id" bigint NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "first_name" text NOT NULL, + "last_name" text NOT NULL, + "full_name" text GENERATED ALWAYS AS (((first_name || ' ') || last_name)) STORED, + "mobile_tel" text, + "fixed_tel" text, + "salutation" text, + "employee_number" text, + "weekly_working_hours" double precision DEFAULT 0, + "annual_paid_leave_days" bigint, + "weekly_regular_working_hours" jsonb DEFAULT '{}', + "clothing_size_top" text, + "clothing_size_bottom" text, + "clothing_size_shoe" text, + "email_signature" text DEFAULT '
Mit freundlichen Grüßen
', + "birthday" date, + "entry_date" date DEFAULT now(), + "automatic_hour_corrections" jsonb DEFAULT '[]', + "recreation_days_compensation" boolean DEFAULT true NOT NULL, + "customer_for_portal" bigint, + "pinned_on_navigation" jsonb DEFAULT '[]' NOT NULL, + "email" text, + "token_id" text, + "weekly_working_days" double precision, + "old_profile_id" uuid, + "temp_config" jsonb, + "state_code" text DEFAULT 'DE-NI', + "contract_type" text, + "position" text, + "qualification" text, + "address_street" text, + "address_zip" text, + "address_city" text, + "active" boolean DEFAULT true NOT NULL +); +--> statement-breakpoint +CREATE TABLE "auth_role_permissions" ( + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "role_id" uuid NOT NULL, + "permission" text NOT NULL +); +--> statement-breakpoint +CREATE TABLE "auth_roles" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "name" text NOT NULL, + "description" text, + "created_by" uuid, + "tenant_id" bigint +); +--> statement-breakpoint +CREATE TABLE "auth_tenant_users" ( + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant_id" bigint NOT NULL, + "user_id" uuid NOT NULL, + "created_by" uuid +); +--> statement-breakpoint +CREATE TABLE "auth_user_roles" ( + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "user_id" uuid NOT NULL, + "role_id" uuid NOT NULL, + "tenant_id" bigint NOT NULL, + "created_by" uuid +); +--> statement-breakpoint +CREATE TABLE "auth_users" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "email" text NOT NULL, + "password_hash" text NOT NULL, + "multi_tenant" boolean DEFAULT true NOT NULL, + "must_change_password" boolean DEFAULT false NOT NULL, + "updated_at" timestamp with time zone, + "ported" boolean DEFAULT true NOT NULL +); +--> statement-breakpoint +CREATE TABLE "bankaccounts" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "bankaccounts_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "name" text, + "iban" text NOT NULL, + "tenant" bigint NOT NULL, + "bankId" text NOT NULL, + "ownerName" text, + "accountId" text NOT NULL, + "balance" double precision, + "expired" boolean DEFAULT false NOT NULL, + "datevNumber" text, + "synced_at" timestamp with time zone DEFAULT now() NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid, + "archived" boolean DEFAULT false NOT NULL +); +--> statement-breakpoint +CREATE TABLE "bankrequisitions" ( + "id" uuid PRIMARY KEY NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "institutionId" text, + "tenant" bigint, + "status" text, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "bankstatements" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "bankstatements_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "account" bigint NOT NULL, + "date" text NOT NULL, + "credIban" text, + "credName" text, + "text" text, + "amount" double precision NOT NULL, + "tenant" bigint NOT NULL, + "debIban" text, + "debName" text, + "gocardlessId" text, + "currency" text, + "valueDate" text, + "incomingInvoice" bigint, + "mandateId" text, + "contract" bigint, + "createdDocument" bigint, + "archived" boolean DEFAULT false NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "checkexecutions" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "check" uuid, + "executed_at" timestamp, + "description" text +); +--> statement-breakpoint +CREATE TABLE "checks" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "vehicle" bigint, + "inventoryitem" bigint, + "tenant" bigint, + "name" text, + "type" text, + "distance" bigint DEFAULT 1, + "distanceUnit" text DEFAULT 'days', + "description" text, + "profiles" jsonb DEFAULT '[]'::jsonb NOT NULL, + "archived" boolean DEFAULT false NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "citys" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "citys_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "name" text, + "short" text, + "long" text, + "geometry" jsonb, + "zip" bigint, + "districtCode" bigint, + "countryName" text, + "countryCode" bigint, + "districtName" text, + "geopoint" text +); +--> statement-breakpoint +CREATE TABLE "contacts" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "contacts_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "firstName" text, + "lastName" text, + "email" text, + "customer" bigint, + "tenant" bigint NOT NULL, + "phoneMobile" text, + "phoneHome" text, + "heroId" text, + "role" text, + "fullName" text, + "salutation" text, + "vendor" bigint, + "active" boolean DEFAULT true NOT NULL, + "birthday" date, + "notes" text, + "profiles" jsonb DEFAULT '[]'::jsonb NOT NULL, + "archived" boolean DEFAULT false NOT NULL, + "title" text, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "contracts" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "contracts_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "name" text NOT NULL, + "customer" bigint NOT NULL, + "notes" text, + "active" boolean DEFAULT true NOT NULL, + "recurring" boolean DEFAULT false NOT NULL, + "rhythm" jsonb, + "startDate" timestamp with time zone, + "endDate" timestamp with time zone, + "signDate" timestamp with time zone, + "duration" text, + "contact" bigint, + "bankingIban" text, + "bankingBIC" text, + "bankingName" text, + "bankingOwner" text, + "sepaRef" text, + "sepaDate" timestamp with time zone, + "paymentType" text, + "invoiceDispatch" text, + "ownFields" jsonb DEFAULT '{}'::jsonb NOT NULL, + "profiles" jsonb DEFAULT '[]'::jsonb NOT NULL, + "archived" boolean DEFAULT false NOT NULL, + "contractNumber" text, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "costcentres" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "number" text NOT NULL, + "name" text NOT NULL, + "vehicle" bigint, + "project" bigint, + "inventoryitem" bigint, + "description" text, + "archived" boolean DEFAULT false NOT NULL, + "profiles" jsonb DEFAULT '[]'::jsonb NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "countrys" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "countrys_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "name" text NOT NULL +); +--> statement-breakpoint +CREATE TABLE "createddocuments" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "createddocuments_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "type" text DEFAULT 'INVOICE' NOT NULL, + "customer" bigint, + "contact" bigint, + "address" jsonb, + "project" bigint, + "documentNumber" text, + "documentDate" text, + "state" text DEFAULT 'Entwurf' NOT NULL, + "info" jsonb, + "createdBy" uuid, + "title" text, + "description" text, + "startText" text, + "endText" text, + "rows" jsonb DEFAULT '[]'::jsonb, + "deliveryDateType" text, + "paymentDays" smallint, + "deliveryDate" text, + "contactPerson" uuid, + "serialConfig" jsonb DEFAULT '{}'::jsonb, + "linkedDocument" bigint, + "agriculture" jsonb, + "letterhead" bigint, + "advanceInvoiceResolved" boolean DEFAULT false NOT NULL, + "usedAdvanceInvoices" jsonb DEFAULT '[]'::jsonb NOT NULL, + "archived" boolean DEFAULT false NOT NULL, + "deliveryDateEnd" text, + "plant" bigint, + "taxType" text, + "customSurchargePercentage" smallint DEFAULT 0 NOT NULL, + "report" jsonb DEFAULT '{}'::jsonb NOT NULL, + "availableInPortal" boolean DEFAULT false NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid, + "created_by" uuid, + "payment_type" text DEFAULT 'transfer', + "contract" bigint +); +--> statement-breakpoint +CREATE TABLE "createdletters" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint, + "customer" bigint, + "vendor" bigint, + "content_json" jsonb DEFAULT '[]'::jsonb, + "content_text" text, + "updated_at" timestamp with time zone, + "updated_by" uuid, + "archived" boolean DEFAULT false NOT NULL +); +--> statement-breakpoint +CREATE TABLE "customers" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "customers_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "customerNumber" text NOT NULL, + "name" text NOT NULL, + "tenant" bigint NOT NULL, + "infoData" jsonb DEFAULT '{}'::jsonb, + "active" boolean DEFAULT true NOT NULL, + "notes" text, + "type" text DEFAULT 'Privat', + "heroId" text, + "isCompany" boolean DEFAULT false NOT NULL, + "profiles" jsonb DEFAULT '[]'::jsonb NOT NULL, + "customPaymentDays" smallint, + "firstname" text, + "lastname" text, + "archived" boolean DEFAULT false NOT NULL, + "customSurchargePercentage" smallint DEFAULT 0 NOT NULL, + "salutation" text, + "title" text, + "nameAddition" text, + "availableInPortal" boolean DEFAULT false NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid, + "custom_payment_type" text +); +--> statement-breakpoint +CREATE TABLE "devices" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "name" text NOT NULL, + "type" text NOT NULL, + "tenant" bigint, + "password" text, + "externalId" text +); +--> statement-breakpoint +CREATE TABLE "documentboxes" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "space" bigint, + "key" text NOT NULL, + "tenant" bigint NOT NULL, + "archived" boolean DEFAULT false NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "events" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "events_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "name" text NOT NULL, + "startDate" timestamp with time zone NOT NULL, + "endDate" timestamp with time zone, + "eventtype" text DEFAULT 'Umsetzung', + "project" bigint, + "resources" jsonb DEFAULT '[]'::jsonb, + "notes" text, + "link" text, + "profiles" jsonb DEFAULT '[]'::jsonb NOT NULL, + "archived" boolean DEFAULT false NOT NULL, + "vehicles" jsonb DEFAULT '[]'::jsonb NOT NULL, + "inventoryitems" jsonb DEFAULT '[]'::jsonb NOT NULL, + "inventoryitemgroups" jsonb DEFAULT '[]'::jsonb NOT NULL, + "customer" bigint, + "vendor" bigint, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "files" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "path" text, + "tenant" bigint NOT NULL, + "project" bigint, + "customer" bigint, + "contract" bigint, + "vendor" bigint, + "incominginvoice" bigint, + "plant" bigint, + "createddocument" bigint, + "vehicle" bigint, + "product" bigint, + "check" uuid, + "inventoryitem" bigint, + "folder" uuid, + "mimeType" text, + "archived" boolean DEFAULT false NOT NULL, + "space" bigint, + "type" uuid, + "documentbox" uuid, + "name" text, + "updated_at" timestamp with time zone, + "updated_by" uuid, + "created_by" uuid, + "auth_profile" uuid +); +--> statement-breakpoint +CREATE TABLE "filetags" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "name" text NOT NULL, + "color" text, + "tenant" bigint NOT NULL, + "createddocumenttype" text DEFAULT '', + "incomingDocumentType" text, + "archived" boolean DEFAULT false NOT NULL +); +--> statement-breakpoint +CREATE TABLE "folders" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "name" text NOT NULL, + "icon" text, + "parent" uuid, + "isSystemUsed" boolean DEFAULT false NOT NULL, + "function" "folderfunctions", + "year" integer, + "standardFiletype" uuid, + "standardFiletypeIsOptional" boolean DEFAULT true NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid, + "archived" boolean DEFAULT false NOT NULL +); +--> statement-breakpoint +CREATE TABLE "exports" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "exports_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant_id" bigint NOT NULL, + "start_date" timestamp with time zone NOT NULL, + "end_date" timestamp with time zone NOT NULL, + "valid_until" timestamp with time zone, + "type" text DEFAULT 'datev' NOT NULL, + "url" text NOT NULL, + "file_path" text +); +--> statement-breakpoint +CREATE TABLE "globalmessages" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "globalmessages_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "title" text, + "description" text +); +--> statement-breakpoint +CREATE TABLE "globalmessagesseen" ( + "message" bigint NOT NULL, + "seen_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "helpdesk_channel_instances" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "tenant_id" bigint NOT NULL, + "type_id" text NOT NULL, + "name" text NOT NULL, + "is_active" boolean DEFAULT true NOT NULL, + "config" jsonb NOT NULL, + "public_config" jsonb DEFAULT '{}'::jsonb NOT NULL, + "public_token" text, + "secret_token" text, + "created_by" uuid, + "created_at" timestamp with time zone DEFAULT now(), + CONSTRAINT "helpdesk_channel_instances_public_token_unique" UNIQUE("public_token") +); +--> statement-breakpoint +CREATE TABLE "helpdesk_channel_types" ( + "id" text PRIMARY KEY NOT NULL, + "description" text NOT NULL +); +--> statement-breakpoint +CREATE TABLE "helpdesk_contacts" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "tenant_id" bigint NOT NULL, + "customer_id" bigint, + "email" text, + "phone" text, + "external_ref" jsonb, + "display_name" text, + "created_at" timestamp with time zone DEFAULT now(), + "source_channel_id" uuid, + "contact_id" bigint +); +--> statement-breakpoint +CREATE TABLE "helpdesk_conversation_participants" ( + "conversation_id" uuid NOT NULL, + "user_id" uuid NOT NULL, + "role" text +); +--> statement-breakpoint +CREATE TABLE "helpdesk_conversations" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "tenant_id" bigint NOT NULL, + "channel_instance_id" uuid NOT NULL, + "contact_id" uuid, + "subject" text, + "status" text DEFAULT 'open' NOT NULL, + "priority" text DEFAULT 'normal', + "assignee_user_id" uuid, + "last_message_at" timestamp with time zone, + "created_at" timestamp with time zone DEFAULT now(), + "customer_id" bigint, + "contact_person_id" bigint, + "ticket_number" text +); +--> statement-breakpoint +CREATE TABLE "helpdesk_messages" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "tenant_id" bigint NOT NULL, + "conversation_id" uuid NOT NULL, + "direction" text NOT NULL, + "author_user_id" uuid, + "payload" jsonb NOT NULL, + "raw_meta" jsonb, + "created_at" timestamp with time zone DEFAULT now(), + "contact_id" uuid, + "external_message_id" text, + "received_at" timestamp with time zone DEFAULT now(), + CONSTRAINT "helpdesk_messages_external_message_id_unique" UNIQUE("external_message_id") +); +--> statement-breakpoint +CREATE TABLE "helpdesk_routing_rules" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "tenant_id" bigint NOT NULL, + "name" text NOT NULL, + "condition" jsonb NOT NULL, + "action" jsonb NOT NULL, + "created_by" uuid, + "created_at" timestamp with time zone DEFAULT now() +); +--> statement-breakpoint +CREATE TABLE "historyitems" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "historyitems_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "text" text NOT NULL, + "customer" bigint, + "tenant" bigint NOT NULL, + "vendor" bigint, + "project" bigint, + "plant" bigint, + "incomingInvoice" bigint, + "contact" bigint, + "inventoryitem" bigint, + "product" bigint, + "event" bigint, + "newVal" text, + "oldVal" text, + "task" bigint, + "vehicle" bigint, + "bankstatement" bigint, + "space" bigint, + "config" jsonb, + "projecttype" bigint, + "check" uuid, + "service" bigint, + "createddocument" bigint, + "file" uuid, + "inventoryitemgroup" uuid, + "source" text DEFAULT 'Software', + "costcentre" uuid, + "ownaccount" uuid, + "documentbox" uuid, + "hourrate" uuid, + "created_by" uuid, + "action" text +); +--> statement-breakpoint +CREATE TABLE "holidays" ( + "id" bigint PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "holidays_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "date" date NOT NULL, + "name" text NOT NULL, + "state_code" text NOT NULL, + "created_at" timestamp with time zone DEFAULT now() +); +--> statement-breakpoint +CREATE TABLE "hourrates" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "name" text NOT NULL, + "purchasePrice" double precision NOT NULL, + "sellingPrice" double precision NOT NULL, + "archived" boolean DEFAULT false NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "incominginvoices" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "incominginvoices_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "state" text DEFAULT 'Entwurf' NOT NULL, + "vendor" bigint, + "reference" text, + "date" text, + "document" bigint, + "dueDate" text, + "description" text, + "paymentType" text, + "accounts" jsonb DEFAULT '[{"account":null,"taxType":null,"amountNet":null,"amountTax":19,"costCentre":null}]'::jsonb NOT NULL, + "paid" boolean DEFAULT false NOT NULL, + "expense" boolean DEFAULT true NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid, + "archived" boolean DEFAULT false NOT NULL +); +--> statement-breakpoint +CREATE TABLE "inventoryitemgroups" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "name" text NOT NULL, + "inventoryitems" jsonb DEFAULT '[]'::jsonb NOT NULL, + "description" text, + "archived" boolean DEFAULT false NOT NULL, + "profiles" jsonb DEFAULT '[]'::jsonb NOT NULL, + "usePlanning" boolean DEFAULT false NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "inventoryitems" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "inventoryitems_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "name" text NOT NULL, + "usePlanning" boolean DEFAULT false NOT NULL, + "description" text, + "tenant" bigint NOT NULL, + "currentSpace" bigint, + "articleNumber" text, + "serialNumber" text, + "purchaseDate" date, + "vendor" bigint, + "quantity" bigint DEFAULT 0 NOT NULL, + "purchasePrice" double precision DEFAULT 0, + "manufacturer" text, + "manufacturerNumber" text, + "currentValue" double precision, + "archived" boolean DEFAULT false NOT NULL, + "profiles" jsonb DEFAULT '[]'::jsonb NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "letterheads" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "letterheads_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "name" text DEFAULT 'Standard', + "path" text NOT NULL, + "documentTypes" text[] DEFAULT '{}' NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid, + "archived" boolean DEFAULT false NOT NULL +); +--> statement-breakpoint +CREATE TABLE "movements" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "movements_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "quantity" bigint NOT NULL, + "productId" bigint NOT NULL, + "spaceId" bigint, + "tenant" bigint NOT NULL, + "projectId" bigint, + "notes" text, + "serials" text[], + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "notifications_event_types" ( + "event_key" text PRIMARY KEY NOT NULL, + "display_name" text NOT NULL, + "description" text, + "category" text, + "severity" "notification_severity" DEFAULT 'info' NOT NULL, + "allowed_channels" jsonb DEFAULT '["inapp","email"]'::jsonb NOT NULL, + "payload_schema" jsonb, + "is_active" boolean DEFAULT true NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "notifications_items" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "tenant_id" bigint NOT NULL, + "user_id" uuid NOT NULL, + "event_type" text NOT NULL, + "title" text NOT NULL, + "message" text NOT NULL, + "payload" jsonb, + "channel" "notification_channel" NOT NULL, + "status" "notification_status" DEFAULT 'queued' NOT NULL, + "error" text, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "sent_at" timestamp with time zone, + "read_at" timestamp with time zone +); +--> statement-breakpoint +CREATE TABLE "notifications_preferences" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "tenant_id" bigint NOT NULL, + "user_id" uuid NOT NULL, + "event_type" text NOT NULL, + "channel" "notification_channel" NOT NULL, + "enabled" boolean DEFAULT true NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "notifications_preferences_defaults" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "tenant_id" bigint NOT NULL, + "event_key" text NOT NULL, + "channel" "notification_channel" NOT NULL, + "enabled" boolean DEFAULT true NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "ownaccounts" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "number" text NOT NULL, + "name" text NOT NULL, + "description" text, + "archived" boolean DEFAULT false NOT NULL, + "profiles" jsonb DEFAULT '[]'::jsonb NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "plants" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "plants_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "name" text NOT NULL, + "customer" bigint, + "infoData" jsonb, + "contract" bigint, + "description" jsonb DEFAULT '{"html":"","json":[],"text":""}'::jsonb, + "archived" boolean DEFAULT false NOT NULL, + "profiles" jsonb DEFAULT '[]'::jsonb NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "productcategories" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "productcategories_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "name" text NOT NULL, + "description" text, + "archived" boolean DEFAULT false NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "products" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "products_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "name" text NOT NULL, + "manufacturer" text, + "unit" bigint NOT NULL, + "tags" json DEFAULT '[]'::json NOT NULL, + "tenant" bigint NOT NULL, + "ean" text, + "barcode" text, + "purchasePrice" double precision, + "sellingPrice" double precision, + "description" text, + "manufacturerNumber" text, + "vendorAllocation" jsonb DEFAULT '[]'::jsonb, + "articleNumber" text, + "barcodes" text[] DEFAULT '{}' NOT NULL, + "productcategories" jsonb DEFAULT '[]'::jsonb, + "archived" boolean DEFAULT false NOT NULL, + "taxPercentage" smallint DEFAULT 19 NOT NULL, + "markupPercentage" double precision, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "projects" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "projects_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "name" text NOT NULL, + "notes" text, + "customer" bigint, + "phases" jsonb DEFAULT '[]'::jsonb, + "description" json, + "forms" jsonb DEFAULT '[]'::jsonb, + "heroId" text, + "measure" text, + "material" jsonb, + "plant" bigint, + "profiles" uuid[] DEFAULT '{}' NOT NULL, + "projectNumber" text, + "contract" bigint, + "projectType" text DEFAULT 'Projekt', + "projecttype" bigint, + "archived" boolean DEFAULT false NOT NULL, + "customerRef" text, + "updated_at" timestamp with time zone, + "updated_by" uuid, + "active_phase" text +); +--> statement-breakpoint +CREATE TABLE "projecttypes" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "projecttypes_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "name" text NOT NULL, + "initialPhases" jsonb, + "addablePhases" jsonb, + "icon" text, + "tenant" bigint NOT NULL, + "archived" boolean DEFAULT false NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "servicecategories" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "servicecategories_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "name" text NOT NULL, + "description" text, + "discount" double precision DEFAULT 0, + "archived" boolean DEFAULT false NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "services" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "services_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "name" text NOT NULL, + "sellingPrice" double precision, + "description" text, + "tenant" bigint NOT NULL, + "unit" bigint, + "serviceNumber" bigint, + "tags" jsonb DEFAULT '[]'::jsonb, + "servicecategories" jsonb DEFAULT '[]'::jsonb NOT NULL, + "archived" boolean DEFAULT false NOT NULL, + "purchasePriceComposed" jsonb DEFAULT '{"total":0}'::jsonb NOT NULL, + "sellingPriceComposed" jsonb DEFAULT '{"total":0}'::jsonb NOT NULL, + "taxPercentage" smallint DEFAULT 19 NOT NULL, + "materialComposition" jsonb DEFAULT '[]'::jsonb NOT NULL, + "personalComposition" jsonb DEFAULT '[]'::jsonb NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "spaces" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "spaces_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "name" text, + "type" text NOT NULL, + "tenant" bigint NOT NULL, + "spaceNumber" text NOT NULL, + "parentSpace" bigint, + "infoData" jsonb DEFAULT '{"zip":"","city":"","streetNumber":""}'::jsonb NOT NULL, + "description" text, + "archived" boolean DEFAULT false NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "staff_time_entries" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "tenant_id" bigint NOT NULL, + "user_id" uuid NOT NULL, + "started_at" timestamp with time zone NOT NULL, + "stopped_at" timestamp with time zone, + "duration_minutes" integer GENERATED ALWAYS AS (CASE + WHEN stopped_at IS NOT NULL + THEN (EXTRACT(epoch FROM (stopped_at - started_at)) / 60) + ELSE NULL + END) STORED, + "type" text DEFAULT 'work', + "description" text, + "created_at" timestamp with time zone DEFAULT now(), + "updated_at" timestamp with time zone DEFAULT now(), + "archived" boolean DEFAULT false NOT NULL, + "updated_by" uuid, + "source" text, + "state" times_state DEFAULT 'draft' NOT NULL, + "device" uuid, + "internal_note" text, + "vacation_reason" text, + "vacation_days" numeric(5, 2), + "approved_by" uuid, + "approved_at" timestamp with time zone, + "sick_reason" text +); +--> statement-breakpoint +CREATE TABLE "staff_time_entry_connects" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "time_entry_id" uuid NOT NULL, + "project_id" bigint, + "started_at" timestamp with time zone NOT NULL, + "stopped_at" timestamp with time zone NOT NULL, + "duration_minutes" integer GENERATED ALWAYS AS ((EXTRACT(epoch FROM (stopped_at - started_at)) / 60)) STORED, + "notes" text, + "created_at" timestamp with time zone DEFAULT now(), + "updated_at" timestamp with time zone DEFAULT now() +); +--> statement-breakpoint +CREATE TABLE "staff_zeitstromtimestamps" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "profile" uuid NOT NULL, + "key" text NOT NULL, + "intent" text NOT NULL, + "time" timestamp with time zone NOT NULL, + "staff_time_entry" uuid, + "internal_note" text +); +--> statement-breakpoint +CREATE TABLE "statementallocations" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "bs_id" integer NOT NULL, + "cd_id" integer, + "amount" double precision DEFAULT 0 NOT NULL, + "ii_id" bigint, + "tenant" bigint NOT NULL, + "account" bigint, + "created_at" timestamp DEFAULT now(), + "ownaccount" uuid, + "description" text, + "customer" bigint, + "vendor" bigint, + "updated_at" timestamp with time zone, + "updated_by" uuid, + "archived" boolean DEFAULT false NOT NULL +); +--> statement-breakpoint +CREATE TABLE "tasks" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "tasks_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "name" text NOT NULL, + "description" text, + "categorie" text, + "tenant" bigint NOT NULL, + "user_id" uuid, + "project" bigint, + "plant" bigint, + "customer" bigint, + "profiles" jsonb DEFAULT '[]'::jsonb NOT NULL, + "archived" boolean DEFAULT false NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "taxtypes" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "taxtypes_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "label" text NOT NULL, + "percentage" bigint NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "tenants" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "tenants_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "name" text NOT NULL, + "short" text NOT NULL, + "calendarConfig" jsonb DEFAULT '{"eventTypes":[{"color":"blue","label":"Büro"},{"color":"yellow","label":"Besprechung"},{"color":"green","label":"Umsetzung"},{"color":"red","label":"Vor Ort Termin"}]}'::jsonb, + "timeConfig" jsonb DEFAULT '{}'::jsonb NOT NULL, + "tags" jsonb DEFAULT '{"products":[],"documents":[]}'::jsonb NOT NULL, + "measures" jsonb DEFAULT '[{"name":"Netzwerktechnik","short":"NWT"},{"name":"Elektrotechnik","short":"ELT"},{"name":"Photovoltaik","short":"PV"},{"name":"Videüberwachung","short":"VÜA"},{"name":"Projekt","short":"PRJ"},{"name":"Smart Home","short":"SHO"}]'::jsonb NOT NULL, + "businessInfo" jsonb DEFAULT '{"zip":"","city":"","name":"","street":""}'::jsonb, + "features" jsonb DEFAULT '{"objects":true,"calendar":true,"contacts":true,"projects":true,"vehicles":true,"contracts":true,"inventory":true,"accounting":true,"timeTracking":true,"planningBoard":true,"workingTimeTracking":true}'::jsonb, + "ownFields" jsonb, + "numberRanges" jsonb DEFAULT '{"vendors":{"prefix":"","suffix":"","nextNumber":10000},"customers":{"prefix":"","suffix":"","nextNumber":10000},"products":{"prefix":"AT-","suffix":"","nextNumber":1000},"quotes":{"prefix":"AN-","suffix":"","nextNumber":1000},"confirmationOrders":{"prefix":"AB-","suffix":"","nextNumber":1000},"invoices":{"prefix":"RE-","suffix":"","nextNumber":1000},"spaces":{"prefix":"LP-","suffix":"","nextNumber":1000},"inventoryitems":{"prefix":"IA-","suffix":"","nextNumber":1000},"projects":{"prefix":"PRJ-","suffix":"","nextNumber":1000},"costcentres":{"prefix":"KST-","suffix":"","nextNumber":1000}}'::jsonb NOT NULL, + "standardEmailForInvoices" text, + "extraModules" jsonb DEFAULT '[]'::jsonb NOT NULL, + "isInTrial" boolean DEFAULT false, + "trialEndDate" date, + "stripeCustomerId" text, + "hasActiveLicense" boolean DEFAULT false NOT NULL, + "userLicenseCount" integer DEFAULT 0 NOT NULL, + "workstationLicenseCount" integer DEFAULT 0 NOT NULL, + "standardPaymentDays" smallint DEFAULT 14 NOT NULL, + "dokuboxEmailAddresses" jsonb DEFAULT '[]'::jsonb, + "dokuboxkey" uuid DEFAULT gen_random_uuid() NOT NULL, + "autoPrepareIncomingInvoices" boolean DEFAULT true, + "portalDomain" text, + "portalConfig" jsonb DEFAULT '{"primayColor":"#69c350"}'::jsonb NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid, + "locked" "locked_tenant" +); +--> statement-breakpoint +CREATE TABLE "texttemplates" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "texttemplates_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "name" text NOT NULL, + "text" text NOT NULL, + "documentType" text DEFAULT '', + "default" boolean DEFAULT false NOT NULL, + "pos" texttemplatepositions NOT NULL, + "archived" boolean DEFAULT false NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "units" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "units_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "name" text NOT NULL, + "single" text NOT NULL, + "multiple" text, + "short" text, + "step" text DEFAULT '1' NOT NULL +); +--> statement-breakpoint +CREATE TABLE "user_credentials" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "user_id" uuid NOT NULL, + "updated_at" timestamp with time zone, + "tenant_id" bigint NOT NULL, + "smtp_port" numeric, + "smtp_ssl" boolean, + "type" "credential_types" NOT NULL, + "imap_port" numeric, + "imap_ssl" boolean, + "email_encrypted" jsonb, + "password_encrypted" jsonb, + "smtp_host_encrypted" jsonb, + "imap_host_encrypted" jsonb, + "access_token_encrypted" jsonb, + "refresh_token_encrypted" jsonb +); +--> statement-breakpoint +CREATE TABLE "vehicles" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "vehicles_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "licensePlate" text, + "name" text, + "type" text, + "active" boolean DEFAULT true, + "driver" uuid, + "vin" text, + "tankSize" double precision DEFAULT 0 NOT NULL, + "archived" boolean DEFAULT false NOT NULL, + "buildYear" text, + "towingCapacity" bigint, + "powerInKW" bigint, + "color" text, + "profiles" jsonb DEFAULT '[]'::jsonb NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +CREATE TABLE "vendors" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "vendors_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "name" text NOT NULL, + "vendorNumber" text NOT NULL, + "tenant" bigint NOT NULL, + "infoData" jsonb DEFAULT '{}'::jsonb NOT NULL, + "notes" text, + "hasSEPA" boolean DEFAULT false NOT NULL, + "profiles" jsonb DEFAULT '[]'::jsonb NOT NULL, + "archived" boolean DEFAULT false NOT NULL, + "defaultPaymentMethod" text, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +ALTER TABLE "auth_profiles" ADD CONSTRAINT "auth_profiles_user_id_auth_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "auth_role_permissions" ADD CONSTRAINT "auth_role_permissions_role_id_auth_roles_id_fk" FOREIGN KEY ("role_id") REFERENCES "public"."auth_roles"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "auth_roles" ADD CONSTRAINT "auth_roles_created_by_auth_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "auth_tenant_users" ADD CONSTRAINT "auth_tenant_users_created_by_auth_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "auth_user_roles" ADD CONSTRAINT "auth_user_roles_user_id_auth_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "auth_user_roles" ADD CONSTRAINT "auth_user_roles_role_id_auth_roles_id_fk" FOREIGN KEY ("role_id") REFERENCES "public"."auth_roles"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "auth_user_roles" ADD CONSTRAINT "auth_user_roles_created_by_auth_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "bankaccounts" ADD CONSTRAINT "bankaccounts_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "bankaccounts" ADD CONSTRAINT "bankaccounts_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "bankrequisitions" ADD CONSTRAINT "bankrequisitions_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "bankrequisitions" ADD CONSTRAINT "bankrequisitions_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "bankstatements" ADD CONSTRAINT "bankstatements_account_bankaccounts_id_fk" FOREIGN KEY ("account") REFERENCES "public"."bankaccounts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "bankstatements" ADD CONSTRAINT "bankstatements_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "bankstatements" ADD CONSTRAINT "bankstatements_incomingInvoice_incominginvoices_id_fk" FOREIGN KEY ("incomingInvoice") REFERENCES "public"."incominginvoices"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "bankstatements" ADD CONSTRAINT "bankstatements_contract_contracts_id_fk" FOREIGN KEY ("contract") REFERENCES "public"."contracts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "bankstatements" ADD CONSTRAINT "bankstatements_createdDocument_createddocuments_id_fk" FOREIGN KEY ("createdDocument") REFERENCES "public"."createddocuments"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "bankstatements" ADD CONSTRAINT "bankstatements_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "checkexecutions" ADD CONSTRAINT "checkexecutions_check_checks_id_fk" FOREIGN KEY ("check") REFERENCES "public"."checks"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "checks" ADD CONSTRAINT "checks_vehicle_vehicles_id_fk" FOREIGN KEY ("vehicle") REFERENCES "public"."vehicles"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "checks" ADD CONSTRAINT "checks_inventoryitem_inventoryitems_id_fk" FOREIGN KEY ("inventoryitem") REFERENCES "public"."inventoryitems"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "checks" ADD CONSTRAINT "checks_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "checks" ADD CONSTRAINT "checks_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "contacts" ADD CONSTRAINT "contacts_customer_customers_id_fk" FOREIGN KEY ("customer") REFERENCES "public"."customers"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "contacts" ADD CONSTRAINT "contacts_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "contracts" ADD CONSTRAINT "contracts_customer_customers_id_fk" FOREIGN KEY ("customer") REFERENCES "public"."customers"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "contracts" ADD CONSTRAINT "contracts_contact_contacts_id_fk" FOREIGN KEY ("contact") REFERENCES "public"."contacts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "contracts" ADD CONSTRAINT "contracts_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "costcentres" ADD CONSTRAINT "costcentres_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "costcentres" ADD CONSTRAINT "costcentres_vehicle_vehicles_id_fk" FOREIGN KEY ("vehicle") REFERENCES "public"."vehicles"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "costcentres" ADD CONSTRAINT "costcentres_project_projects_id_fk" FOREIGN KEY ("project") REFERENCES "public"."projects"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "costcentres" ADD CONSTRAINT "costcentres_inventoryitem_inventoryitems_id_fk" FOREIGN KEY ("inventoryitem") REFERENCES "public"."inventoryitems"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "costcentres" ADD CONSTRAINT "costcentres_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "createddocuments" ADD CONSTRAINT "createddocuments_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "createddocuments" ADD CONSTRAINT "createddocuments_customer_customers_id_fk" FOREIGN KEY ("customer") REFERENCES "public"."customers"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "createddocuments" ADD CONSTRAINT "createddocuments_contact_contacts_id_fk" FOREIGN KEY ("contact") REFERENCES "public"."contacts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "createddocuments" ADD CONSTRAINT "createddocuments_project_projects_id_fk" FOREIGN KEY ("project") REFERENCES "public"."projects"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "createddocuments" ADD CONSTRAINT "createddocuments_createdBy_auth_users_id_fk" FOREIGN KEY ("createdBy") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "createddocuments" ADD CONSTRAINT "createddocuments_linkedDocument_createddocuments_id_fk" FOREIGN KEY ("linkedDocument") REFERENCES "public"."createddocuments"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "createddocuments" ADD CONSTRAINT "createddocuments_letterhead_letterheads_id_fk" FOREIGN KEY ("letterhead") REFERENCES "public"."letterheads"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "createddocuments" ADD CONSTRAINT "createddocuments_plant_plants_id_fk" FOREIGN KEY ("plant") REFERENCES "public"."plants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "createddocuments" ADD CONSTRAINT "createddocuments_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "createddocuments" ADD CONSTRAINT "createddocuments_created_by_auth_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "createddocuments" ADD CONSTRAINT "createddocuments_contract_contracts_id_fk" FOREIGN KEY ("contract") REFERENCES "public"."contracts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "createdletters" ADD CONSTRAINT "createdletters_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "createdletters" ADD CONSTRAINT "createdletters_customer_customers_id_fk" FOREIGN KEY ("customer") REFERENCES "public"."customers"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "createdletters" ADD CONSTRAINT "createdletters_vendor_vendors_id_fk" FOREIGN KEY ("vendor") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "createdletters" ADD CONSTRAINT "createdletters_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "customers" ADD CONSTRAINT "customers_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "devices" ADD CONSTRAINT "devices_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "documentboxes" ADD CONSTRAINT "documentboxes_space_spaces_id_fk" FOREIGN KEY ("space") REFERENCES "public"."spaces"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "documentboxes" ADD CONSTRAINT "documentboxes_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "documentboxes" ADD CONSTRAINT "documentboxes_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "events" ADD CONSTRAINT "events_customer_customers_id_fk" FOREIGN KEY ("customer") REFERENCES "public"."customers"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "events" ADD CONSTRAINT "events_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_project_projects_id_fk" FOREIGN KEY ("project") REFERENCES "public"."projects"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_customer_customers_id_fk" FOREIGN KEY ("customer") REFERENCES "public"."customers"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_contract_contracts_id_fk" FOREIGN KEY ("contract") REFERENCES "public"."contracts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_vendor_vendors_id_fk" FOREIGN KEY ("vendor") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_incominginvoice_incominginvoices_id_fk" FOREIGN KEY ("incominginvoice") REFERENCES "public"."incominginvoices"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_plant_plants_id_fk" FOREIGN KEY ("plant") REFERENCES "public"."plants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_createddocument_createddocuments_id_fk" FOREIGN KEY ("createddocument") REFERENCES "public"."createddocuments"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_vehicle_vehicles_id_fk" FOREIGN KEY ("vehicle") REFERENCES "public"."vehicles"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_product_products_id_fk" FOREIGN KEY ("product") REFERENCES "public"."products"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_check_checks_id_fk" FOREIGN KEY ("check") REFERENCES "public"."checks"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_inventoryitem_inventoryitems_id_fk" FOREIGN KEY ("inventoryitem") REFERENCES "public"."inventoryitems"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_folder_folders_id_fk" FOREIGN KEY ("folder") REFERENCES "public"."folders"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_space_spaces_id_fk" FOREIGN KEY ("space") REFERENCES "public"."spaces"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_type_filetags_id_fk" FOREIGN KEY ("type") REFERENCES "public"."filetags"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_documentbox_documentboxes_id_fk" FOREIGN KEY ("documentbox") REFERENCES "public"."documentboxes"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_created_by_auth_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "files" ADD CONSTRAINT "files_auth_profile_auth_profiles_id_fk" FOREIGN KEY ("auth_profile") REFERENCES "public"."auth_profiles"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "filetags" ADD CONSTRAINT "filetags_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "folders" ADD CONSTRAINT "folders_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "folders" ADD CONSTRAINT "folders_parent_folders_id_fk" FOREIGN KEY ("parent") REFERENCES "public"."folders"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "folders" ADD CONSTRAINT "folders_standardFiletype_filetags_id_fk" FOREIGN KEY ("standardFiletype") REFERENCES "public"."filetags"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "folders" ADD CONSTRAINT "folders_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "exports" ADD CONSTRAINT "exports_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "globalmessagesseen" ADD CONSTRAINT "globalmessagesseen_message_globalmessages_id_fk" FOREIGN KEY ("message") REFERENCES "public"."globalmessages"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_channel_instances" ADD CONSTRAINT "helpdesk_channel_instances_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_channel_instances" ADD CONSTRAINT "helpdesk_channel_instances_type_id_helpdesk_channel_types_id_fk" FOREIGN KEY ("type_id") REFERENCES "public"."helpdesk_channel_types"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_channel_instances" ADD CONSTRAINT "helpdesk_channel_instances_created_by_auth_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_contacts" ADD CONSTRAINT "helpdesk_contacts_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_contacts" ADD CONSTRAINT "helpdesk_contacts_customer_id_customers_id_fk" FOREIGN KEY ("customer_id") REFERENCES "public"."customers"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_contacts" ADD CONSTRAINT "helpdesk_contacts_source_channel_id_helpdesk_channel_instances_id_fk" FOREIGN KEY ("source_channel_id") REFERENCES "public"."helpdesk_channel_instances"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_contacts" ADD CONSTRAINT "helpdesk_contacts_contact_id_contacts_id_fk" FOREIGN KEY ("contact_id") REFERENCES "public"."contacts"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_conversation_participants" ADD CONSTRAINT "helpdesk_conversation_participants_conversation_id_helpdesk_conversations_id_fk" FOREIGN KEY ("conversation_id") REFERENCES "public"."helpdesk_conversations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_conversation_participants" ADD CONSTRAINT "helpdesk_conversation_participants_user_id_auth_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."auth_users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_conversations" ADD CONSTRAINT "helpdesk_conversations_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_conversations" ADD CONSTRAINT "helpdesk_conversations_channel_instance_id_helpdesk_channel_instances_id_fk" FOREIGN KEY ("channel_instance_id") REFERENCES "public"."helpdesk_channel_instances"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_conversations" ADD CONSTRAINT "helpdesk_conversations_contact_id_helpdesk_contacts_id_fk" FOREIGN KEY ("contact_id") REFERENCES "public"."helpdesk_contacts"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_conversations" ADD CONSTRAINT "helpdesk_conversations_assignee_user_id_auth_users_id_fk" FOREIGN KEY ("assignee_user_id") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_conversations" ADD CONSTRAINT "helpdesk_conversations_customer_id_customers_id_fk" FOREIGN KEY ("customer_id") REFERENCES "public"."customers"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_conversations" ADD CONSTRAINT "helpdesk_conversations_contact_person_id_contacts_id_fk" FOREIGN KEY ("contact_person_id") REFERENCES "public"."contacts"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_messages" ADD CONSTRAINT "helpdesk_messages_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_messages" ADD CONSTRAINT "helpdesk_messages_conversation_id_helpdesk_conversations_id_fk" FOREIGN KEY ("conversation_id") REFERENCES "public"."helpdesk_conversations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_messages" ADD CONSTRAINT "helpdesk_messages_author_user_id_auth_users_id_fk" FOREIGN KEY ("author_user_id") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_messages" ADD CONSTRAINT "helpdesk_messages_contact_id_helpdesk_contacts_id_fk" FOREIGN KEY ("contact_id") REFERENCES "public"."helpdesk_contacts"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_routing_rules" ADD CONSTRAINT "helpdesk_routing_rules_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "helpdesk_routing_rules" ADD CONSTRAINT "helpdesk_routing_rules_created_by_auth_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_customer_customers_id_fk" FOREIGN KEY ("customer") REFERENCES "public"."customers"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_vendor_vendors_id_fk" FOREIGN KEY ("vendor") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_project_projects_id_fk" FOREIGN KEY ("project") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_plant_plants_id_fk" FOREIGN KEY ("plant") REFERENCES "public"."plants"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_incomingInvoice_incominginvoices_id_fk" FOREIGN KEY ("incomingInvoice") REFERENCES "public"."incominginvoices"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_contact_contacts_id_fk" FOREIGN KEY ("contact") REFERENCES "public"."contacts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_inventoryitem_inventoryitems_id_fk" FOREIGN KEY ("inventoryitem") REFERENCES "public"."inventoryitems"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_product_products_id_fk" FOREIGN KEY ("product") REFERENCES "public"."products"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_event_events_id_fk" FOREIGN KEY ("event") REFERENCES "public"."events"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_task_tasks_id_fk" FOREIGN KEY ("task") REFERENCES "public"."tasks"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_vehicle_vehicles_id_fk" FOREIGN KEY ("vehicle") REFERENCES "public"."vehicles"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_bankstatement_bankstatements_id_fk" FOREIGN KEY ("bankstatement") REFERENCES "public"."bankstatements"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_space_spaces_id_fk" FOREIGN KEY ("space") REFERENCES "public"."spaces"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_projecttype_projecttypes_id_fk" FOREIGN KEY ("projecttype") REFERENCES "public"."projecttypes"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_check_checks_id_fk" FOREIGN KEY ("check") REFERENCES "public"."checks"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_service_services_id_fk" FOREIGN KEY ("service") REFERENCES "public"."services"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_createddocument_createddocuments_id_fk" FOREIGN KEY ("createddocument") REFERENCES "public"."createddocuments"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_file_files_id_fk" FOREIGN KEY ("file") REFERENCES "public"."files"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_inventoryitemgroup_inventoryitemgroups_id_fk" FOREIGN KEY ("inventoryitemgroup") REFERENCES "public"."inventoryitemgroups"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_costcentre_costcentres_id_fk" FOREIGN KEY ("costcentre") REFERENCES "public"."costcentres"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_ownaccount_ownaccounts_id_fk" FOREIGN KEY ("ownaccount") REFERENCES "public"."ownaccounts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_documentbox_documentboxes_id_fk" FOREIGN KEY ("documentbox") REFERENCES "public"."documentboxes"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_hourrate_hourrates_id_fk" FOREIGN KEY ("hourrate") REFERENCES "public"."hourrates"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "historyitems" ADD CONSTRAINT "historyitems_created_by_auth_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "hourrates" ADD CONSTRAINT "hourrates_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "hourrates" ADD CONSTRAINT "hourrates_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "incominginvoices" ADD CONSTRAINT "incominginvoices_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "incominginvoices" ADD CONSTRAINT "incominginvoices_vendor_vendors_id_fk" FOREIGN KEY ("vendor") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "incominginvoices" ADD CONSTRAINT "incominginvoices_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "inventoryitemgroups" ADD CONSTRAINT "inventoryitemgroups_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "inventoryitemgroups" ADD CONSTRAINT "inventoryitemgroups_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "inventoryitems" ADD CONSTRAINT "inventoryitems_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "inventoryitems" ADD CONSTRAINT "inventoryitems_currentSpace_spaces_id_fk" FOREIGN KEY ("currentSpace") REFERENCES "public"."spaces"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "inventoryitems" ADD CONSTRAINT "inventoryitems_vendor_vendors_id_fk" FOREIGN KEY ("vendor") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "inventoryitems" ADD CONSTRAINT "inventoryitems_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "letterheads" ADD CONSTRAINT "letterheads_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "letterheads" ADD CONSTRAINT "letterheads_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "movements" ADD CONSTRAINT "movements_productId_products_id_fk" FOREIGN KEY ("productId") REFERENCES "public"."products"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "movements" ADD CONSTRAINT "movements_spaceId_spaces_id_fk" FOREIGN KEY ("spaceId") REFERENCES "public"."spaces"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "movements" ADD CONSTRAINT "movements_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "movements" ADD CONSTRAINT "movements_projectId_projects_id_fk" FOREIGN KEY ("projectId") REFERENCES "public"."projects"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "movements" ADD CONSTRAINT "movements_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "notifications_items" ADD CONSTRAINT "notifications_items_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint +ALTER TABLE "notifications_items" ADD CONSTRAINT "notifications_items_user_id_auth_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."auth_users"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint +ALTER TABLE "notifications_items" ADD CONSTRAINT "notifications_items_event_type_notifications_event_types_event_key_fk" FOREIGN KEY ("event_type") REFERENCES "public"."notifications_event_types"("event_key") ON DELETE restrict ON UPDATE cascade;--> statement-breakpoint +ALTER TABLE "notifications_preferences" ADD CONSTRAINT "notifications_preferences_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint +ALTER TABLE "notifications_preferences" ADD CONSTRAINT "notifications_preferences_user_id_auth_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."auth_users"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint +ALTER TABLE "notifications_preferences" ADD CONSTRAINT "notifications_preferences_event_type_notifications_event_types_event_key_fk" FOREIGN KEY ("event_type") REFERENCES "public"."notifications_event_types"("event_key") ON DELETE restrict ON UPDATE cascade;--> statement-breakpoint +ALTER TABLE "notifications_preferences_defaults" ADD CONSTRAINT "notifications_preferences_defaults_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint +ALTER TABLE "notifications_preferences_defaults" ADD CONSTRAINT "notifications_preferences_defaults_event_key_notifications_event_types_event_key_fk" FOREIGN KEY ("event_key") REFERENCES "public"."notifications_event_types"("event_key") ON DELETE restrict ON UPDATE cascade;--> statement-breakpoint +ALTER TABLE "ownaccounts" ADD CONSTRAINT "ownaccounts_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "ownaccounts" ADD CONSTRAINT "ownaccounts_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "plants" ADD CONSTRAINT "plants_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "plants" ADD CONSTRAINT "plants_customer_customers_id_fk" FOREIGN KEY ("customer") REFERENCES "public"."customers"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "plants" ADD CONSTRAINT "plants_contract_contracts_id_fk" FOREIGN KEY ("contract") REFERENCES "public"."contracts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "plants" ADD CONSTRAINT "plants_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "productcategories" ADD CONSTRAINT "productcategories_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "productcategories" ADD CONSTRAINT "productcategories_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "products" ADD CONSTRAINT "products_unit_units_id_fk" FOREIGN KEY ("unit") REFERENCES "public"."units"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "products" ADD CONSTRAINT "products_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "products" ADD CONSTRAINT "products_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "projects" ADD CONSTRAINT "projects_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "projects" ADD CONSTRAINT "projects_customer_customers_id_fk" FOREIGN KEY ("customer") REFERENCES "public"."customers"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "projects" ADD CONSTRAINT "projects_contract_contracts_id_fk" FOREIGN KEY ("contract") REFERENCES "public"."contracts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "projects" ADD CONSTRAINT "projects_projecttype_projecttypes_id_fk" FOREIGN KEY ("projecttype") REFERENCES "public"."projecttypes"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "projects" ADD CONSTRAINT "projects_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "projecttypes" ADD CONSTRAINT "projecttypes_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "projecttypes" ADD CONSTRAINT "projecttypes_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "servicecategories" ADD CONSTRAINT "servicecategories_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "servicecategories" ADD CONSTRAINT "servicecategories_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "services" ADD CONSTRAINT "services_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "services" ADD CONSTRAINT "services_unit_units_id_fk" FOREIGN KEY ("unit") REFERENCES "public"."units"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "services" ADD CONSTRAINT "services_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "spaces" ADD CONSTRAINT "spaces_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "spaces" ADD CONSTRAINT "spaces_parentSpace_spaces_id_fk" FOREIGN KEY ("parentSpace") REFERENCES "public"."spaces"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "spaces" ADD CONSTRAINT "spaces_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "staff_time_entries" ADD CONSTRAINT "staff_time_entries_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "staff_time_entries" ADD CONSTRAINT "staff_time_entries_user_id_auth_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."auth_users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "staff_time_entries" ADD CONSTRAINT "staff_time_entries_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "staff_time_entries" ADD CONSTRAINT "staff_time_entries_approved_by_auth_users_id_fk" FOREIGN KEY ("approved_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "staff_time_entry_connects" ADD CONSTRAINT "staff_time_entry_connects_time_entry_id_staff_time_entries_id_fk" FOREIGN KEY ("time_entry_id") REFERENCES "public"."staff_time_entries"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "staff_zeitstromtimestamps" ADD CONSTRAINT "staff_zeitstromtimestamps_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "staff_zeitstromtimestamps" ADD CONSTRAINT "staff_zeitstromtimestamps_profile_auth_profiles_id_fk" FOREIGN KEY ("profile") REFERENCES "public"."auth_profiles"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "staff_zeitstromtimestamps" ADD CONSTRAINT "staff_zeitstromtimestamps_staff_time_entry_staff_time_entries_id_fk" FOREIGN KEY ("staff_time_entry") REFERENCES "public"."staff_time_entries"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "statementallocations" ADD CONSTRAINT "statementallocations_bs_id_bankstatements_id_fk" FOREIGN KEY ("bs_id") REFERENCES "public"."bankstatements"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "statementallocations" ADD CONSTRAINT "statementallocations_cd_id_createddocuments_id_fk" FOREIGN KEY ("cd_id") REFERENCES "public"."createddocuments"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "statementallocations" ADD CONSTRAINT "statementallocations_ii_id_incominginvoices_id_fk" FOREIGN KEY ("ii_id") REFERENCES "public"."incominginvoices"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "statementallocations" ADD CONSTRAINT "statementallocations_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "statementallocations" ADD CONSTRAINT "statementallocations_account_accounts_id_fk" FOREIGN KEY ("account") REFERENCES "public"."accounts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "statementallocations" ADD CONSTRAINT "statementallocations_ownaccount_ownaccounts_id_fk" FOREIGN KEY ("ownaccount") REFERENCES "public"."ownaccounts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "statementallocations" ADD CONSTRAINT "statementallocations_customer_customers_id_fk" FOREIGN KEY ("customer") REFERENCES "public"."customers"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "statementallocations" ADD CONSTRAINT "statementallocations_vendor_vendors_id_fk" FOREIGN KEY ("vendor") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "statementallocations" ADD CONSTRAINT "statementallocations_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "tasks" ADD CONSTRAINT "tasks_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "tasks" ADD CONSTRAINT "tasks_user_id_auth_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "tasks" ADD CONSTRAINT "tasks_customer_customers_id_fk" FOREIGN KEY ("customer") REFERENCES "public"."customers"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "tasks" ADD CONSTRAINT "tasks_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "taxtypes" ADD CONSTRAINT "taxtypes_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "tenants" ADD CONSTRAINT "tenants_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "texttemplates" ADD CONSTRAINT "texttemplates_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "texttemplates" ADD CONSTRAINT "texttemplates_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "user_credentials" ADD CONSTRAINT "user_credentials_user_id_auth_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "user_credentials" ADD CONSTRAINT "user_credentials_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vehicles" ADD CONSTRAINT "vehicles_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vehicles" ADD CONSTRAINT "vehicles_driver_auth_users_id_fk" FOREIGN KEY ("driver") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vehicles" ADD CONSTRAINT "vehicles_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendors" ADD CONSTRAINT "vendors_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendors" ADD CONSTRAINT "vendors_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +CREATE UNIQUE INDEX "notifications_preferences_tenant_id_user_id_event_type_chan_key" ON "notifications_preferences" USING btree ("tenant_id","user_id","event_type","channel");--> statement-breakpoint +CREATE UNIQUE INDEX "notifications_preferences_defau_tenant_id_event_key_channel_key" ON "notifications_preferences_defaults" USING btree ("tenant_id","event_key","channel"); \ No newline at end of file diff --git a/db/migrations/0001_medical_big_bertha.sql b/db/migrations/0001_medical_big_bertha.sql new file mode 100644 index 0000000..5ff60a1 --- /dev/null +++ b/db/migrations/0001_medical_big_bertha.sql @@ -0,0 +1,32 @@ +CREATE TABLE "time_events" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "tenant_id" bigint NOT NULL, + "user_id" uuid NOT NULL, + "actor_type" text NOT NULL, + "actor_user_id" uuid, + "event_time" timestamp with time zone NOT NULL, + "event_type" text NOT NULL, + "source" text NOT NULL, + "invalidates_event_id" uuid, + "metadata" jsonb, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + CONSTRAINT "time_events_actor_user_check" CHECK ( + (actor_type = 'system' AND actor_user_id IS NULL) + OR + (actor_type = 'user' AND actor_user_id IS NOT NULL) + ) +); +--> statement-breakpoint +ALTER TABLE "bankstatements" DROP CONSTRAINT "bankstatements_incomingInvoice_incominginvoices_id_fk"; +--> statement-breakpoint +ALTER TABLE "bankstatements" DROP CONSTRAINT "bankstatements_createdDocument_createddocuments_id_fk"; +--> statement-breakpoint +ALTER TABLE "time_events" ADD CONSTRAINT "time_events_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "time_events" ADD CONSTRAINT "time_events_user_id_auth_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "time_events" ADD CONSTRAINT "time_events_actor_user_id_auth_users_id_fk" FOREIGN KEY ("actor_user_id") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "time_events" ADD CONSTRAINT "time_events_invalidates_event_id_time_events_id_fk" FOREIGN KEY ("invalidates_event_id") REFERENCES "public"."time_events"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +CREATE INDEX "idx_time_events_tenant_user_time" ON "time_events" USING btree ("tenant_id","user_id","event_time");--> statement-breakpoint +CREATE INDEX "idx_time_events_created_at" ON "time_events" USING btree ("created_at");--> statement-breakpoint +CREATE INDEX "idx_time_events_invalidates" ON "time_events" USING btree ("invalidates_event_id");--> statement-breakpoint +ALTER TABLE "bankstatements" DROP COLUMN "incomingInvoice";--> statement-breakpoint +ALTER TABLE "bankstatements" DROP COLUMN "createdDocument"; \ No newline at end of file diff --git a/db/migrations/0002_silent_christian_walker.sql b/db/migrations/0002_silent_christian_walker.sql new file mode 100644 index 0000000..bd4a372 --- /dev/null +++ b/db/migrations/0002_silent_christian_walker.sql @@ -0,0 +1,13 @@ +ALTER TABLE "time_events" RENAME TO "staff_time_events";--> statement-breakpoint +ALTER TABLE "staff_time_events" DROP CONSTRAINT "time_events_tenant_id_tenants_id_fk"; +--> statement-breakpoint +ALTER TABLE "staff_time_events" DROP CONSTRAINT "time_events_user_id_auth_users_id_fk"; +--> statement-breakpoint +ALTER TABLE "staff_time_events" DROP CONSTRAINT "time_events_actor_user_id_auth_users_id_fk"; +--> statement-breakpoint +ALTER TABLE "staff_time_events" DROP CONSTRAINT "time_events_invalidates_event_id_time_events_id_fk"; +--> statement-breakpoint +ALTER TABLE "staff_time_events" ADD CONSTRAINT "staff_time_events_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "staff_time_events" ADD CONSTRAINT "staff_time_events_user_id_auth_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "staff_time_events" ADD CONSTRAINT "staff_time_events_actor_user_id_auth_users_id_fk" FOREIGN KEY ("actor_user_id") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "staff_time_events" ADD CONSTRAINT "staff_time_events_invalidates_event_id_staff_time_events_id_fk" FOREIGN KEY ("invalidates_event_id") REFERENCES "public"."staff_time_events"("id") ON DELETE no action ON UPDATE no action; \ No newline at end of file diff --git a/db/migrations/meta/0000_snapshot.json b/db/migrations/meta/0000_snapshot.json new file mode 100644 index 0000000..3fff43c --- /dev/null +++ b/db/migrations/meta/0000_snapshot.json @@ -0,0 +1,9788 @@ +{ + "id": "c74cefc4-5ae7-408c-b7f3-09093efb52b5", + "prevId": "00000000-0000-0000-0000-000000000000", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.accounts": { + "name": "accounts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "accounts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "number": { + "name": "number", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_profiles": { + "name": "auth_profiles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "first_name": { + "name": "first_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_name": { + "name": "last_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "full_name": { + "name": "full_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "generated": { + "as": "((first_name || ' ') || last_name)", + "type": "stored" + } + }, + "mobile_tel": { + "name": "mobile_tel", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "fixed_tel": { + "name": "fixed_tel", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "salutation": { + "name": "salutation", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "employee_number": { + "name": "employee_number", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "weekly_working_hours": { + "name": "weekly_working_hours", + "type": "double precision", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "annual_paid_leave_days": { + "name": "annual_paid_leave_days", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "weekly_regular_working_hours": { + "name": "weekly_regular_working_hours", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "clothing_size_top": { + "name": "clothing_size_top", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "clothing_size_bottom": { + "name": "clothing_size_bottom", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "clothing_size_shoe": { + "name": "clothing_size_shoe", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email_signature": { + "name": "email_signature", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'Mit freundlichen Grüßen
'" + }, + "birthday": { + "name": "birthday", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "entry_date": { + "name": "entry_date", + "type": "date", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "automatic_hour_corrections": { + "name": "automatic_hour_corrections", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'" + }, + "recreation_days_compensation": { + "name": "recreation_days_compensation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "customer_for_portal": { + "name": "customer_for_portal", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "pinned_on_navigation": { + "name": "pinned_on_navigation", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "token_id": { + "name": "token_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "weekly_working_days": { + "name": "weekly_working_days", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "old_profile_id": { + "name": "old_profile_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "temp_config": { + "name": "temp_config", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "state_code": { + "name": "state_code", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'DE-NI'" + }, + "contract_type": { + "name": "contract_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "position": { + "name": "position", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "qualification": { + "name": "qualification", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_street": { + "name": "address_street", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_zip": { + "name": "address_zip", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_city": { + "name": "address_city", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + } + }, + "indexes": {}, + "foreignKeys": { + "auth_profiles_user_id_auth_users_id_fk": { + "name": "auth_profiles_user_id_auth_users_id_fk", + "tableFrom": "auth_profiles", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_role_permissions": { + "name": "auth_role_permissions", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "auth_role_permissions_role_id_auth_roles_id_fk": { + "name": "auth_role_permissions_role_id_auth_roles_id_fk", + "tableFrom": "auth_role_permissions", + "tableTo": "auth_roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_roles": { + "name": "auth_roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "auth_roles_created_by_auth_users_id_fk": { + "name": "auth_roles_created_by_auth_users_id_fk", + "tableFrom": "auth_roles", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_tenant_users": { + "name": "auth_tenant_users", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "auth_tenant_users_created_by_auth_users_id_fk": { + "name": "auth_tenant_users_created_by_auth_users_id_fk", + "tableFrom": "auth_tenant_users", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_user_roles": { + "name": "auth_user_roles", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "auth_user_roles_user_id_auth_users_id_fk": { + "name": "auth_user_roles_user_id_auth_users_id_fk", + "tableFrom": "auth_user_roles", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "auth_user_roles_role_id_auth_roles_id_fk": { + "name": "auth_user_roles_role_id_auth_roles_id_fk", + "tableFrom": "auth_user_roles", + "tableTo": "auth_roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "auth_user_roles_created_by_auth_users_id_fk": { + "name": "auth_user_roles_created_by_auth_users_id_fk", + "tableFrom": "auth_user_roles", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_users": { + "name": "auth_users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "password_hash": { + "name": "password_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "multi_tenant": { + "name": "multi_tenant", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "must_change_password": { + "name": "must_change_password", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "ported": { + "name": "ported", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bankaccounts": { + "name": "bankaccounts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "bankaccounts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "iban": { + "name": "iban", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "bankId": { + "name": "bankId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "ownerName": { + "name": "ownerName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "accountId": { + "name": "accountId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "balance": { + "name": "balance", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "expired": { + "name": "expired", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "datevNumber": { + "name": "datevNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "bankaccounts_tenant_tenants_id_fk": { + "name": "bankaccounts_tenant_tenants_id_fk", + "tableFrom": "bankaccounts", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "bankaccounts_updated_by_auth_users_id_fk": { + "name": "bankaccounts_updated_by_auth_users_id_fk", + "tableFrom": "bankaccounts", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bankrequisitions": { + "name": "bankrequisitions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "institutionId": { + "name": "institutionId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "bankrequisitions_tenant_tenants_id_fk": { + "name": "bankrequisitions_tenant_tenants_id_fk", + "tableFrom": "bankrequisitions", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "bankrequisitions_updated_by_auth_users_id_fk": { + "name": "bankrequisitions_updated_by_auth_users_id_fk", + "tableFrom": "bankrequisitions", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bankstatements": { + "name": "bankstatements", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "bankstatements_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "account": { + "name": "account", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credIban": { + "name": "credIban", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credName": { + "name": "credName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "amount": { + "name": "amount", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "debIban": { + "name": "debIban", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "debName": { + "name": "debName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "gocardlessId": { + "name": "gocardlessId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "valueDate": { + "name": "valueDate", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "incomingInvoice": { + "name": "incomingInvoice", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "mandateId": { + "name": "mandateId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contract": { + "name": "contract", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "createdDocument": { + "name": "createdDocument", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "bankstatements_account_bankaccounts_id_fk": { + "name": "bankstatements_account_bankaccounts_id_fk", + "tableFrom": "bankstatements", + "tableTo": "bankaccounts", + "columnsFrom": [ + "account" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "bankstatements_tenant_tenants_id_fk": { + "name": "bankstatements_tenant_tenants_id_fk", + "tableFrom": "bankstatements", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "bankstatements_incomingInvoice_incominginvoices_id_fk": { + "name": "bankstatements_incomingInvoice_incominginvoices_id_fk", + "tableFrom": "bankstatements", + "tableTo": "incominginvoices", + "columnsFrom": [ + "incomingInvoice" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "bankstatements_contract_contracts_id_fk": { + "name": "bankstatements_contract_contracts_id_fk", + "tableFrom": "bankstatements", + "tableTo": "contracts", + "columnsFrom": [ + "contract" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "bankstatements_createdDocument_createddocuments_id_fk": { + "name": "bankstatements_createdDocument_createddocuments_id_fk", + "tableFrom": "bankstatements", + "tableTo": "createddocuments", + "columnsFrom": [ + "createdDocument" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "bankstatements_updated_by_auth_users_id_fk": { + "name": "bankstatements_updated_by_auth_users_id_fk", + "tableFrom": "bankstatements", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.checkexecutions": { + "name": "checkexecutions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "check": { + "name": "check", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "executed_at": { + "name": "executed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "checkexecutions_check_checks_id_fk": { + "name": "checkexecutions_check_checks_id_fk", + "tableFrom": "checkexecutions", + "tableTo": "checks", + "columnsFrom": [ + "check" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.checks": { + "name": "checks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vehicle": { + "name": "vehicle", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "inventoryitem": { + "name": "inventoryitem", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "distance": { + "name": "distance", + "type": "bigint", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "distanceUnit": { + "name": "distanceUnit", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'days'" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "checks_vehicle_vehicles_id_fk": { + "name": "checks_vehicle_vehicles_id_fk", + "tableFrom": "checks", + "tableTo": "vehicles", + "columnsFrom": [ + "vehicle" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "checks_inventoryitem_inventoryitems_id_fk": { + "name": "checks_inventoryitem_inventoryitems_id_fk", + "tableFrom": "checks", + "tableTo": "inventoryitems", + "columnsFrom": [ + "inventoryitem" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "checks_tenant_tenants_id_fk": { + "name": "checks_tenant_tenants_id_fk", + "tableFrom": "checks", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "checks_updated_by_auth_users_id_fk": { + "name": "checks_updated_by_auth_users_id_fk", + "tableFrom": "checks", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.citys": { + "name": "citys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "citys_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "short": { + "name": "short", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "long": { + "name": "long", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "geometry": { + "name": "geometry", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "zip": { + "name": "zip", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "districtCode": { + "name": "districtCode", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "countryName": { + "name": "countryName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "countryCode": { + "name": "countryCode", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "districtName": { + "name": "districtName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "geopoint": { + "name": "geopoint", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contacts": { + "name": "contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "contacts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "firstName": { + "name": "firstName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lastName": { + "name": "lastName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "phoneMobile": { + "name": "phoneMobile", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "phoneHome": { + "name": "phoneHome", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "heroId": { + "name": "heroId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "fullName": { + "name": "fullName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "salutation": { + "name": "salutation", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendor": { + "name": "vendor", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "birthday": { + "name": "birthday", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "contacts_customer_customers_id_fk": { + "name": "contacts_customer_customers_id_fk", + "tableFrom": "contacts", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "contacts_updated_by_auth_users_id_fk": { + "name": "contacts_updated_by_auth_users_id_fk", + "tableFrom": "contacts", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "contracts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "recurring": { + "name": "recurring", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "rhythm": { + "name": "rhythm", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "startDate": { + "name": "startDate", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "endDate": { + "name": "endDate", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "signDate": { + "name": "signDate", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "duration": { + "name": "duration", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contact": { + "name": "contact", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "bankingIban": { + "name": "bankingIban", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "bankingBIC": { + "name": "bankingBIC", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "bankingName": { + "name": "bankingName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "bankingOwner": { + "name": "bankingOwner", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sepaRef": { + "name": "sepaRef", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sepaDate": { + "name": "sepaDate", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "paymentType": { + "name": "paymentType", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "invoiceDispatch": { + "name": "invoiceDispatch", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ownFields": { + "name": "ownFields", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "contractNumber": { + "name": "contractNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "contracts_customer_customers_id_fk": { + "name": "contracts_customer_customers_id_fk", + "tableFrom": "contracts", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "contracts_contact_contacts_id_fk": { + "name": "contracts_contact_contacts_id_fk", + "tableFrom": "contracts", + "tableTo": "contacts", + "columnsFrom": [ + "contact" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "contracts_updated_by_auth_users_id_fk": { + "name": "contracts_updated_by_auth_users_id_fk", + "tableFrom": "contracts", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.costcentres": { + "name": "costcentres", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "number": { + "name": "number", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vehicle": { + "name": "vehicle", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "project": { + "name": "project", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "inventoryitem": { + "name": "inventoryitem", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "costcentres_tenant_tenants_id_fk": { + "name": "costcentres_tenant_tenants_id_fk", + "tableFrom": "costcentres", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "costcentres_vehicle_vehicles_id_fk": { + "name": "costcentres_vehicle_vehicles_id_fk", + "tableFrom": "costcentres", + "tableTo": "vehicles", + "columnsFrom": [ + "vehicle" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "costcentres_project_projects_id_fk": { + "name": "costcentres_project_projects_id_fk", + "tableFrom": "costcentres", + "tableTo": "projects", + "columnsFrom": [ + "project" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "costcentres_inventoryitem_inventoryitems_id_fk": { + "name": "costcentres_inventoryitem_inventoryitems_id_fk", + "tableFrom": "costcentres", + "tableTo": "inventoryitems", + "columnsFrom": [ + "inventoryitem" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "costcentres_updated_by_auth_users_id_fk": { + "name": "costcentres_updated_by_auth_users_id_fk", + "tableFrom": "costcentres", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.countrys": { + "name": "countrys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "countrys_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.createddocuments": { + "name": "createddocuments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "createddocuments_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'INVOICE'" + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "contact": { + "name": "contact", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "address": { + "name": "address", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "project": { + "name": "project", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "documentNumber": { + "name": "documentNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "documentDate": { + "name": "documentDate", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'Entwurf'" + }, + "info": { + "name": "info", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "createdBy": { + "name": "createdBy", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "startText": { + "name": "startText", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "endText": { + "name": "endText", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rows": { + "name": "rows", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "deliveryDateType": { + "name": "deliveryDateType", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "paymentDays": { + "name": "paymentDays", + "type": "smallint", + "primaryKey": false, + "notNull": false + }, + "deliveryDate": { + "name": "deliveryDate", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contactPerson": { + "name": "contactPerson", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "serialConfig": { + "name": "serialConfig", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'::jsonb" + }, + "linkedDocument": { + "name": "linkedDocument", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "agriculture": { + "name": "agriculture", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "letterhead": { + "name": "letterhead", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "advanceInvoiceResolved": { + "name": "advanceInvoiceResolved", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "usedAdvanceInvoices": { + "name": "usedAdvanceInvoices", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "deliveryDateEnd": { + "name": "deliveryDateEnd", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "plant": { + "name": "plant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "taxType": { + "name": "taxType", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "customSurchargePercentage": { + "name": "customSurchargePercentage", + "type": "smallint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "report": { + "name": "report", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "availableInPortal": { + "name": "availableInPortal", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "payment_type": { + "name": "payment_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'transfer'" + }, + "contract": { + "name": "contract", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "createddocuments_tenant_tenants_id_fk": { + "name": "createddocuments_tenant_tenants_id_fk", + "tableFrom": "createddocuments", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_customer_customers_id_fk": { + "name": "createddocuments_customer_customers_id_fk", + "tableFrom": "createddocuments", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_contact_contacts_id_fk": { + "name": "createddocuments_contact_contacts_id_fk", + "tableFrom": "createddocuments", + "tableTo": "contacts", + "columnsFrom": [ + "contact" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_project_projects_id_fk": { + "name": "createddocuments_project_projects_id_fk", + "tableFrom": "createddocuments", + "tableTo": "projects", + "columnsFrom": [ + "project" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_createdBy_auth_users_id_fk": { + "name": "createddocuments_createdBy_auth_users_id_fk", + "tableFrom": "createddocuments", + "tableTo": "auth_users", + "columnsFrom": [ + "createdBy" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_linkedDocument_createddocuments_id_fk": { + "name": "createddocuments_linkedDocument_createddocuments_id_fk", + "tableFrom": "createddocuments", + "tableTo": "createddocuments", + "columnsFrom": [ + "linkedDocument" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_letterhead_letterheads_id_fk": { + "name": "createddocuments_letterhead_letterheads_id_fk", + "tableFrom": "createddocuments", + "tableTo": "letterheads", + "columnsFrom": [ + "letterhead" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_plant_plants_id_fk": { + "name": "createddocuments_plant_plants_id_fk", + "tableFrom": "createddocuments", + "tableTo": "plants", + "columnsFrom": [ + "plant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_updated_by_auth_users_id_fk": { + "name": "createddocuments_updated_by_auth_users_id_fk", + "tableFrom": "createddocuments", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_created_by_auth_users_id_fk": { + "name": "createddocuments_created_by_auth_users_id_fk", + "tableFrom": "createddocuments", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_contract_contracts_id_fk": { + "name": "createddocuments_contract_contracts_id_fk", + "tableFrom": "createddocuments", + "tableTo": "contracts", + "columnsFrom": [ + "contract" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.createdletters": { + "name": "createdletters", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "vendor": { + "name": "vendor", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "content_json": { + "name": "content_json", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "content_text": { + "name": "content_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "createdletters_tenant_tenants_id_fk": { + "name": "createdletters_tenant_tenants_id_fk", + "tableFrom": "createdletters", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createdletters_customer_customers_id_fk": { + "name": "createdletters_customer_customers_id_fk", + "tableFrom": "createdletters", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createdletters_vendor_vendors_id_fk": { + "name": "createdletters_vendor_vendors_id_fk", + "tableFrom": "createdletters", + "tableTo": "vendors", + "columnsFrom": [ + "vendor" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createdletters_updated_by_auth_users_id_fk": { + "name": "createdletters_updated_by_auth_users_id_fk", + "tableFrom": "createdletters", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.customers": { + "name": "customers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "customers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "customerNumber": { + "name": "customerNumber", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "infoData": { + "name": "infoData", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'::jsonb" + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'Privat'" + }, + "heroId": { + "name": "heroId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "isCompany": { + "name": "isCompany", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "customPaymentDays": { + "name": "customPaymentDays", + "type": "smallint", + "primaryKey": false, + "notNull": false + }, + "firstname": { + "name": "firstname", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lastname": { + "name": "lastname", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "customSurchargePercentage": { + "name": "customSurchargePercentage", + "type": "smallint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "salutation": { + "name": "salutation", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "nameAddition": { + "name": "nameAddition", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "availableInPortal": { + "name": "availableInPortal", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "custom_payment_type": { + "name": "custom_payment_type", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "customers_updated_by_auth_users_id_fk": { + "name": "customers_updated_by_auth_users_id_fk", + "tableFrom": "customers", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.devices": { + "name": "devices", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "externalId": { + "name": "externalId", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "devices_tenant_tenants_id_fk": { + "name": "devices_tenant_tenants_id_fk", + "tableFrom": "devices", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documentboxes": { + "name": "documentboxes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "space": { + "name": "space", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "documentboxes_space_spaces_id_fk": { + "name": "documentboxes_space_spaces_id_fk", + "tableFrom": "documentboxes", + "tableTo": "spaces", + "columnsFrom": [ + "space" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "documentboxes_tenant_tenants_id_fk": { + "name": "documentboxes_tenant_tenants_id_fk", + "tableFrom": "documentboxes", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "documentboxes_updated_by_auth_users_id_fk": { + "name": "documentboxes_updated_by_auth_users_id_fk", + "tableFrom": "documentboxes", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.events": { + "name": "events", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "events_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "startDate": { + "name": "startDate", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "endDate": { + "name": "endDate", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "eventtype": { + "name": "eventtype", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'Umsetzung'" + }, + "project": { + "name": "project", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "resources": { + "name": "resources", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "link": { + "name": "link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "vehicles": { + "name": "vehicles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "inventoryitems": { + "name": "inventoryitems", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "inventoryitemgroups": { + "name": "inventoryitemgroups", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "vendor": { + "name": "vendor", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "events_customer_customers_id_fk": { + "name": "events_customer_customers_id_fk", + "tableFrom": "events", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "events_updated_by_auth_users_id_fk": { + "name": "events_updated_by_auth_users_id_fk", + "tableFrom": "events", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.files": { + "name": "files", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "project": { + "name": "project", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "contract": { + "name": "contract", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "vendor": { + "name": "vendor", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "incominginvoice": { + "name": "incominginvoice", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "plant": { + "name": "plant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "createddocument": { + "name": "createddocument", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "vehicle": { + "name": "vehicle", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "product": { + "name": "product", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "check": { + "name": "check", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "inventoryitem": { + "name": "inventoryitem", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "folder": { + "name": "folder", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "mimeType": { + "name": "mimeType", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "space": { + "name": "space", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "documentbox": { + "name": "documentbox", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "auth_profile": { + "name": "auth_profile", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "files_tenant_tenants_id_fk": { + "name": "files_tenant_tenants_id_fk", + "tableFrom": "files", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_project_projects_id_fk": { + "name": "files_project_projects_id_fk", + "tableFrom": "files", + "tableTo": "projects", + "columnsFrom": [ + "project" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_customer_customers_id_fk": { + "name": "files_customer_customers_id_fk", + "tableFrom": "files", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_contract_contracts_id_fk": { + "name": "files_contract_contracts_id_fk", + "tableFrom": "files", + "tableTo": "contracts", + "columnsFrom": [ + "contract" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_vendor_vendors_id_fk": { + "name": "files_vendor_vendors_id_fk", + "tableFrom": "files", + "tableTo": "vendors", + "columnsFrom": [ + "vendor" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_incominginvoice_incominginvoices_id_fk": { + "name": "files_incominginvoice_incominginvoices_id_fk", + "tableFrom": "files", + "tableTo": "incominginvoices", + "columnsFrom": [ + "incominginvoice" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_plant_plants_id_fk": { + "name": "files_plant_plants_id_fk", + "tableFrom": "files", + "tableTo": "plants", + "columnsFrom": [ + "plant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_createddocument_createddocuments_id_fk": { + "name": "files_createddocument_createddocuments_id_fk", + "tableFrom": "files", + "tableTo": "createddocuments", + "columnsFrom": [ + "createddocument" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_vehicle_vehicles_id_fk": { + "name": "files_vehicle_vehicles_id_fk", + "tableFrom": "files", + "tableTo": "vehicles", + "columnsFrom": [ + "vehicle" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_product_products_id_fk": { + "name": "files_product_products_id_fk", + "tableFrom": "files", + "tableTo": "products", + "columnsFrom": [ + "product" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_check_checks_id_fk": { + "name": "files_check_checks_id_fk", + "tableFrom": "files", + "tableTo": "checks", + "columnsFrom": [ + "check" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_inventoryitem_inventoryitems_id_fk": { + "name": "files_inventoryitem_inventoryitems_id_fk", + "tableFrom": "files", + "tableTo": "inventoryitems", + "columnsFrom": [ + "inventoryitem" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_folder_folders_id_fk": { + "name": "files_folder_folders_id_fk", + "tableFrom": "files", + "tableTo": "folders", + "columnsFrom": [ + "folder" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_space_spaces_id_fk": { + "name": "files_space_spaces_id_fk", + "tableFrom": "files", + "tableTo": "spaces", + "columnsFrom": [ + "space" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_type_filetags_id_fk": { + "name": "files_type_filetags_id_fk", + "tableFrom": "files", + "tableTo": "filetags", + "columnsFrom": [ + "type" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_documentbox_documentboxes_id_fk": { + "name": "files_documentbox_documentboxes_id_fk", + "tableFrom": "files", + "tableTo": "documentboxes", + "columnsFrom": [ + "documentbox" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_updated_by_auth_users_id_fk": { + "name": "files_updated_by_auth_users_id_fk", + "tableFrom": "files", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_created_by_auth_users_id_fk": { + "name": "files_created_by_auth_users_id_fk", + "tableFrom": "files", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_auth_profile_auth_profiles_id_fk": { + "name": "files_auth_profile_auth_profiles_id_fk", + "tableFrom": "files", + "tableTo": "auth_profiles", + "columnsFrom": [ + "auth_profile" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.filetags": { + "name": "filetags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "createddocumenttype": { + "name": "createddocumenttype", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "incomingDocumentType": { + "name": "incomingDocumentType", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "filetags_tenant_tenants_id_fk": { + "name": "filetags_tenant_tenants_id_fk", + "tableFrom": "filetags", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.folders": { + "name": "folders", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent": { + "name": "parent", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "isSystemUsed": { + "name": "isSystemUsed", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "function": { + "name": "function", + "type": "folderfunctions", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "year": { + "name": "year", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "standardFiletype": { + "name": "standardFiletype", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "standardFiletypeIsOptional": { + "name": "standardFiletypeIsOptional", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "folders_tenant_tenants_id_fk": { + "name": "folders_tenant_tenants_id_fk", + "tableFrom": "folders", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "folders_parent_folders_id_fk": { + "name": "folders_parent_folders_id_fk", + "tableFrom": "folders", + "tableTo": "folders", + "columnsFrom": [ + "parent" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "folders_standardFiletype_filetags_id_fk": { + "name": "folders_standardFiletype_filetags_id_fk", + "tableFrom": "folders", + "tableTo": "filetags", + "columnsFrom": [ + "standardFiletype" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "folders_updated_by_auth_users_id_fk": { + "name": "folders_updated_by_auth_users_id_fk", + "tableFrom": "folders", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.exports": { + "name": "exports", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "exports_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "start_date": { + "name": "start_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "end_date": { + "name": "end_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "valid_until": { + "name": "valid_until", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'datev'" + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "exports_tenant_id_tenants_id_fk": { + "name": "exports_tenant_id_tenants_id_fk", + "tableFrom": "exports", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.globalmessages": { + "name": "globalmessages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "globalmessages_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.globalmessagesseen": { + "name": "globalmessagesseen", + "schema": "", + "columns": { + "message": { + "name": "message", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "seen_at": { + "name": "seen_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "globalmessagesseen_message_globalmessages_id_fk": { + "name": "globalmessagesseen_message_globalmessages_id_fk", + "tableFrom": "globalmessagesseen", + "tableTo": "globalmessages", + "columnsFrom": [ + "message" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.helpdesk_channel_instances": { + "name": "helpdesk_channel_instances", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "type_id": { + "name": "type_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "public_config": { + "name": "public_config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "public_token": { + "name": "public_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "secret_token": { + "name": "secret_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "helpdesk_channel_instances_tenant_id_tenants_id_fk": { + "name": "helpdesk_channel_instances_tenant_id_tenants_id_fk", + "tableFrom": "helpdesk_channel_instances", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "helpdesk_channel_instances_type_id_helpdesk_channel_types_id_fk": { + "name": "helpdesk_channel_instances_type_id_helpdesk_channel_types_id_fk", + "tableFrom": "helpdesk_channel_instances", + "tableTo": "helpdesk_channel_types", + "columnsFrom": [ + "type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "helpdesk_channel_instances_created_by_auth_users_id_fk": { + "name": "helpdesk_channel_instances_created_by_auth_users_id_fk", + "tableFrom": "helpdesk_channel_instances", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "helpdesk_channel_instances_public_token_unique": { + "name": "helpdesk_channel_instances_public_token_unique", + "nullsNotDistinct": false, + "columns": [ + "public_token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.helpdesk_channel_types": { + "name": "helpdesk_channel_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.helpdesk_contacts": { + "name": "helpdesk_contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "customer_id": { + "name": "customer_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "external_ref": { + "name": "external_ref", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "source_channel_id": { + "name": "source_channel_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "contact_id": { + "name": "contact_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "helpdesk_contacts_tenant_id_tenants_id_fk": { + "name": "helpdesk_contacts_tenant_id_tenants_id_fk", + "tableFrom": "helpdesk_contacts", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "helpdesk_contacts_customer_id_customers_id_fk": { + "name": "helpdesk_contacts_customer_id_customers_id_fk", + "tableFrom": "helpdesk_contacts", + "tableTo": "customers", + "columnsFrom": [ + "customer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "helpdesk_contacts_source_channel_id_helpdesk_channel_instances_id_fk": { + "name": "helpdesk_contacts_source_channel_id_helpdesk_channel_instances_id_fk", + "tableFrom": "helpdesk_contacts", + "tableTo": "helpdesk_channel_instances", + "columnsFrom": [ + "source_channel_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "helpdesk_contacts_contact_id_contacts_id_fk": { + "name": "helpdesk_contacts_contact_id_contacts_id_fk", + "tableFrom": "helpdesk_contacts", + "tableTo": "contacts", + "columnsFrom": [ + "contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.helpdesk_conversation_participants": { + "name": "helpdesk_conversation_participants", + "schema": "", + "columns": { + "conversation_id": { + "name": "conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "helpdesk_conversation_participants_conversation_id_helpdesk_conversations_id_fk": { + "name": "helpdesk_conversation_participants_conversation_id_helpdesk_conversations_id_fk", + "tableFrom": "helpdesk_conversation_participants", + "tableTo": "helpdesk_conversations", + "columnsFrom": [ + "conversation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "helpdesk_conversation_participants_user_id_auth_users_id_fk": { + "name": "helpdesk_conversation_participants_user_id_auth_users_id_fk", + "tableFrom": "helpdesk_conversation_participants", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.helpdesk_conversations": { + "name": "helpdesk_conversations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "channel_instance_id": { + "name": "channel_instance_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "contact_id": { + "name": "contact_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "subject": { + "name": "subject", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'open'" + }, + "priority": { + "name": "priority", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'normal'" + }, + "assignee_user_id": { + "name": "assignee_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "last_message_at": { + "name": "last_message_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "customer_id": { + "name": "customer_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "contact_person_id": { + "name": "contact_person_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "ticket_number": { + "name": "ticket_number", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "helpdesk_conversations_tenant_id_tenants_id_fk": { + "name": "helpdesk_conversations_tenant_id_tenants_id_fk", + "tableFrom": "helpdesk_conversations", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "helpdesk_conversations_channel_instance_id_helpdesk_channel_instances_id_fk": { + "name": "helpdesk_conversations_channel_instance_id_helpdesk_channel_instances_id_fk", + "tableFrom": "helpdesk_conversations", + "tableTo": "helpdesk_channel_instances", + "columnsFrom": [ + "channel_instance_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "helpdesk_conversations_contact_id_helpdesk_contacts_id_fk": { + "name": "helpdesk_conversations_contact_id_helpdesk_contacts_id_fk", + "tableFrom": "helpdesk_conversations", + "tableTo": "helpdesk_contacts", + "columnsFrom": [ + "contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "helpdesk_conversations_assignee_user_id_auth_users_id_fk": { + "name": "helpdesk_conversations_assignee_user_id_auth_users_id_fk", + "tableFrom": "helpdesk_conversations", + "tableTo": "auth_users", + "columnsFrom": [ + "assignee_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "helpdesk_conversations_customer_id_customers_id_fk": { + "name": "helpdesk_conversations_customer_id_customers_id_fk", + "tableFrom": "helpdesk_conversations", + "tableTo": "customers", + "columnsFrom": [ + "customer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "helpdesk_conversations_contact_person_id_contacts_id_fk": { + "name": "helpdesk_conversations_contact_person_id_contacts_id_fk", + "tableFrom": "helpdesk_conversations", + "tableTo": "contacts", + "columnsFrom": [ + "contact_person_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.helpdesk_messages": { + "name": "helpdesk_messages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "conversation_id": { + "name": "conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "direction": { + "name": "direction", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "author_user_id": { + "name": "author_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "payload": { + "name": "payload", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "raw_meta": { + "name": "raw_meta", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "contact_id": { + "name": "contact_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "external_message_id": { + "name": "external_message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "received_at": { + "name": "received_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "helpdesk_messages_tenant_id_tenants_id_fk": { + "name": "helpdesk_messages_tenant_id_tenants_id_fk", + "tableFrom": "helpdesk_messages", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "helpdesk_messages_conversation_id_helpdesk_conversations_id_fk": { + "name": "helpdesk_messages_conversation_id_helpdesk_conversations_id_fk", + "tableFrom": "helpdesk_messages", + "tableTo": "helpdesk_conversations", + "columnsFrom": [ + "conversation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "helpdesk_messages_author_user_id_auth_users_id_fk": { + "name": "helpdesk_messages_author_user_id_auth_users_id_fk", + "tableFrom": "helpdesk_messages", + "tableTo": "auth_users", + "columnsFrom": [ + "author_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "helpdesk_messages_contact_id_helpdesk_contacts_id_fk": { + "name": "helpdesk_messages_contact_id_helpdesk_contacts_id_fk", + "tableFrom": "helpdesk_messages", + "tableTo": "helpdesk_contacts", + "columnsFrom": [ + "contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "helpdesk_messages_external_message_id_unique": { + "name": "helpdesk_messages_external_message_id_unique", + "nullsNotDistinct": false, + "columns": [ + "external_message_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.helpdesk_routing_rules": { + "name": "helpdesk_routing_rules", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "condition": { + "name": "condition", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "helpdesk_routing_rules_tenant_id_tenants_id_fk": { + "name": "helpdesk_routing_rules_tenant_id_tenants_id_fk", + "tableFrom": "helpdesk_routing_rules", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "helpdesk_routing_rules_created_by_auth_users_id_fk": { + "name": "helpdesk_routing_rules_created_by_auth_users_id_fk", + "tableFrom": "helpdesk_routing_rules", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.historyitems": { + "name": "historyitems", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "historyitems_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "vendor": { + "name": "vendor", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "project": { + "name": "project", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "plant": { + "name": "plant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "incomingInvoice": { + "name": "incomingInvoice", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "contact": { + "name": "contact", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "inventoryitem": { + "name": "inventoryitem", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "product": { + "name": "product", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "event": { + "name": "event", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "newVal": { + "name": "newVal", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "oldVal": { + "name": "oldVal", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "task": { + "name": "task", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "vehicle": { + "name": "vehicle", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "bankstatement": { + "name": "bankstatement", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "space": { + "name": "space", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "projecttype": { + "name": "projecttype", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "check": { + "name": "check", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "service": { + "name": "service", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "createddocument": { + "name": "createddocument", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "file": { + "name": "file", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "inventoryitemgroup": { + "name": "inventoryitemgroup", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'Software'" + }, + "costcentre": { + "name": "costcentre", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "ownaccount": { + "name": "ownaccount", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "documentbox": { + "name": "documentbox", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "hourrate": { + "name": "hourrate", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "historyitems_customer_customers_id_fk": { + "name": "historyitems_customer_customers_id_fk", + "tableFrom": "historyitems", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "historyitems_tenant_tenants_id_fk": { + "name": "historyitems_tenant_tenants_id_fk", + "tableFrom": "historyitems", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_vendor_vendors_id_fk": { + "name": "historyitems_vendor_vendors_id_fk", + "tableFrom": "historyitems", + "tableTo": "vendors", + "columnsFrom": [ + "vendor" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_project_projects_id_fk": { + "name": "historyitems_project_projects_id_fk", + "tableFrom": "historyitems", + "tableTo": "projects", + "columnsFrom": [ + "project" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "historyitems_plant_plants_id_fk": { + "name": "historyitems_plant_plants_id_fk", + "tableFrom": "historyitems", + "tableTo": "plants", + "columnsFrom": [ + "plant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "historyitems_incomingInvoice_incominginvoices_id_fk": { + "name": "historyitems_incomingInvoice_incominginvoices_id_fk", + "tableFrom": "historyitems", + "tableTo": "incominginvoices", + "columnsFrom": [ + "incomingInvoice" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "historyitems_contact_contacts_id_fk": { + "name": "historyitems_contact_contacts_id_fk", + "tableFrom": "historyitems", + "tableTo": "contacts", + "columnsFrom": [ + "contact" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "historyitems_inventoryitem_inventoryitems_id_fk": { + "name": "historyitems_inventoryitem_inventoryitems_id_fk", + "tableFrom": "historyitems", + "tableTo": "inventoryitems", + "columnsFrom": [ + "inventoryitem" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "historyitems_product_products_id_fk": { + "name": "historyitems_product_products_id_fk", + "tableFrom": "historyitems", + "tableTo": "products", + "columnsFrom": [ + "product" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "historyitems_event_events_id_fk": { + "name": "historyitems_event_events_id_fk", + "tableFrom": "historyitems", + "tableTo": "events", + "columnsFrom": [ + "event" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_task_tasks_id_fk": { + "name": "historyitems_task_tasks_id_fk", + "tableFrom": "historyitems", + "tableTo": "tasks", + "columnsFrom": [ + "task" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_vehicle_vehicles_id_fk": { + "name": "historyitems_vehicle_vehicles_id_fk", + "tableFrom": "historyitems", + "tableTo": "vehicles", + "columnsFrom": [ + "vehicle" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_bankstatement_bankstatements_id_fk": { + "name": "historyitems_bankstatement_bankstatements_id_fk", + "tableFrom": "historyitems", + "tableTo": "bankstatements", + "columnsFrom": [ + "bankstatement" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_space_spaces_id_fk": { + "name": "historyitems_space_spaces_id_fk", + "tableFrom": "historyitems", + "tableTo": "spaces", + "columnsFrom": [ + "space" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_projecttype_projecttypes_id_fk": { + "name": "historyitems_projecttype_projecttypes_id_fk", + "tableFrom": "historyitems", + "tableTo": "projecttypes", + "columnsFrom": [ + "projecttype" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_check_checks_id_fk": { + "name": "historyitems_check_checks_id_fk", + "tableFrom": "historyitems", + "tableTo": "checks", + "columnsFrom": [ + "check" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_service_services_id_fk": { + "name": "historyitems_service_services_id_fk", + "tableFrom": "historyitems", + "tableTo": "services", + "columnsFrom": [ + "service" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_createddocument_createddocuments_id_fk": { + "name": "historyitems_createddocument_createddocuments_id_fk", + "tableFrom": "historyitems", + "tableTo": "createddocuments", + "columnsFrom": [ + "createddocument" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_file_files_id_fk": { + "name": "historyitems_file_files_id_fk", + "tableFrom": "historyitems", + "tableTo": "files", + "columnsFrom": [ + "file" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_inventoryitemgroup_inventoryitemgroups_id_fk": { + "name": "historyitems_inventoryitemgroup_inventoryitemgroups_id_fk", + "tableFrom": "historyitems", + "tableTo": "inventoryitemgroups", + "columnsFrom": [ + "inventoryitemgroup" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_costcentre_costcentres_id_fk": { + "name": "historyitems_costcentre_costcentres_id_fk", + "tableFrom": "historyitems", + "tableTo": "costcentres", + "columnsFrom": [ + "costcentre" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_ownaccount_ownaccounts_id_fk": { + "name": "historyitems_ownaccount_ownaccounts_id_fk", + "tableFrom": "historyitems", + "tableTo": "ownaccounts", + "columnsFrom": [ + "ownaccount" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_documentbox_documentboxes_id_fk": { + "name": "historyitems_documentbox_documentboxes_id_fk", + "tableFrom": "historyitems", + "tableTo": "documentboxes", + "columnsFrom": [ + "documentbox" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_hourrate_hourrates_id_fk": { + "name": "historyitems_hourrate_hourrates_id_fk", + "tableFrom": "historyitems", + "tableTo": "hourrates", + "columnsFrom": [ + "hourrate" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_created_by_auth_users_id_fk": { + "name": "historyitems_created_by_auth_users_id_fk", + "tableFrom": "historyitems", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.holidays": { + "name": "holidays", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "holidays_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "date": { + "name": "date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "state_code": { + "name": "state_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.hourrates": { + "name": "hourrates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "purchasePrice": { + "name": "purchasePrice", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "sellingPrice": { + "name": "sellingPrice", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "hourrates_tenant_tenants_id_fk": { + "name": "hourrates_tenant_tenants_id_fk", + "tableFrom": "hourrates", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "hourrates_updated_by_auth_users_id_fk": { + "name": "hourrates_updated_by_auth_users_id_fk", + "tableFrom": "hourrates", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incominginvoices": { + "name": "incominginvoices", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "incominginvoices_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'Entwurf'" + }, + "vendor": { + "name": "vendor", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "reference": { + "name": "reference", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "document": { + "name": "document", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "dueDate": { + "name": "dueDate", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "paymentType": { + "name": "paymentType", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "accounts": { + "name": "accounts", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[{\"account\":null,\"taxType\":null,\"amountNet\":null,\"amountTax\":19,\"costCentre\":null}]'::jsonb" + }, + "paid": { + "name": "paid", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "expense": { + "name": "expense", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "incominginvoices_tenant_tenants_id_fk": { + "name": "incominginvoices_tenant_tenants_id_fk", + "tableFrom": "incominginvoices", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "incominginvoices_vendor_vendors_id_fk": { + "name": "incominginvoices_vendor_vendors_id_fk", + "tableFrom": "incominginvoices", + "tableTo": "vendors", + "columnsFrom": [ + "vendor" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "incominginvoices_updated_by_auth_users_id_fk": { + "name": "incominginvoices_updated_by_auth_users_id_fk", + "tableFrom": "incominginvoices", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.inventoryitemgroups": { + "name": "inventoryitemgroups", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "inventoryitems": { + "name": "inventoryitems", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "usePlanning": { + "name": "usePlanning", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "inventoryitemgroups_tenant_tenants_id_fk": { + "name": "inventoryitemgroups_tenant_tenants_id_fk", + "tableFrom": "inventoryitemgroups", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "inventoryitemgroups_updated_by_auth_users_id_fk": { + "name": "inventoryitemgroups_updated_by_auth_users_id_fk", + "tableFrom": "inventoryitemgroups", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.inventoryitems": { + "name": "inventoryitems", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "inventoryitems_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "usePlanning": { + "name": "usePlanning", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "currentSpace": { + "name": "currentSpace", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "articleNumber": { + "name": "articleNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "serialNumber": { + "name": "serialNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "purchaseDate": { + "name": "purchaseDate", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "vendor": { + "name": "vendor", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "purchasePrice": { + "name": "purchasePrice", + "type": "double precision", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "manufacturer": { + "name": "manufacturer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "manufacturerNumber": { + "name": "manufacturerNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "currentValue": { + "name": "currentValue", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "inventoryitems_tenant_tenants_id_fk": { + "name": "inventoryitems_tenant_tenants_id_fk", + "tableFrom": "inventoryitems", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "inventoryitems_currentSpace_spaces_id_fk": { + "name": "inventoryitems_currentSpace_spaces_id_fk", + "tableFrom": "inventoryitems", + "tableTo": "spaces", + "columnsFrom": [ + "currentSpace" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "inventoryitems_vendor_vendors_id_fk": { + "name": "inventoryitems_vendor_vendors_id_fk", + "tableFrom": "inventoryitems", + "tableTo": "vendors", + "columnsFrom": [ + "vendor" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "inventoryitems_updated_by_auth_users_id_fk": { + "name": "inventoryitems_updated_by_auth_users_id_fk", + "tableFrom": "inventoryitems", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.letterheads": { + "name": "letterheads", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "letterheads_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'Standard'" + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "documentTypes": { + "name": "documentTypes", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "letterheads_tenant_tenants_id_fk": { + "name": "letterheads_tenant_tenants_id_fk", + "tableFrom": "letterheads", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "letterheads_updated_by_auth_users_id_fk": { + "name": "letterheads_updated_by_auth_users_id_fk", + "tableFrom": "letterheads", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.movements": { + "name": "movements", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "movements_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "quantity": { + "name": "quantity", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "productId": { + "name": "productId", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "spaceId": { + "name": "spaceId", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "projectId": { + "name": "projectId", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "serials": { + "name": "serials", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "movements_productId_products_id_fk": { + "name": "movements_productId_products_id_fk", + "tableFrom": "movements", + "tableTo": "products", + "columnsFrom": [ + "productId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "movements_spaceId_spaces_id_fk": { + "name": "movements_spaceId_spaces_id_fk", + "tableFrom": "movements", + "tableTo": "spaces", + "columnsFrom": [ + "spaceId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "movements_tenant_tenants_id_fk": { + "name": "movements_tenant_tenants_id_fk", + "tableFrom": "movements", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "movements_projectId_projects_id_fk": { + "name": "movements_projectId_projects_id_fk", + "tableFrom": "movements", + "tableTo": "projects", + "columnsFrom": [ + "projectId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "movements_updated_by_auth_users_id_fk": { + "name": "movements_updated_by_auth_users_id_fk", + "tableFrom": "movements", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.notifications_event_types": { + "name": "notifications_event_types", + "schema": "", + "columns": { + "event_key": { + "name": "event_key", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "category": { + "name": "category", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "severity": { + "name": "severity", + "type": "notification_severity", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'info'" + }, + "allowed_channels": { + "name": "allowed_channels", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[\"inapp\",\"email\"]'::jsonb" + }, + "payload_schema": { + "name": "payload_schema", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.notifications_items": { + "name": "notifications_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "payload": { + "name": "payload", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "channel": { + "name": "channel", + "type": "notification_channel", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "notification_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'queued'" + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "sent_at": { + "name": "sent_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "read_at": { + "name": "read_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "notifications_items_tenant_id_tenants_id_fk": { + "name": "notifications_items_tenant_id_tenants_id_fk", + "tableFrom": "notifications_items", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "notifications_items_user_id_auth_users_id_fk": { + "name": "notifications_items_user_id_auth_users_id_fk", + "tableFrom": "notifications_items", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "notifications_items_event_type_notifications_event_types_event_key_fk": { + "name": "notifications_items_event_type_notifications_event_types_event_key_fk", + "tableFrom": "notifications_items", + "tableTo": "notifications_event_types", + "columnsFrom": [ + "event_type" + ], + "columnsTo": [ + "event_key" + ], + "onDelete": "restrict", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.notifications_preferences": { + "name": "notifications_preferences", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "channel": { + "name": "channel", + "type": "notification_channel", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "notifications_preferences_tenant_id_user_id_event_type_chan_key": { + "name": "notifications_preferences_tenant_id_user_id_event_type_chan_key", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "event_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "channel", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "notifications_preferences_tenant_id_tenants_id_fk": { + "name": "notifications_preferences_tenant_id_tenants_id_fk", + "tableFrom": "notifications_preferences", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "notifications_preferences_user_id_auth_users_id_fk": { + "name": "notifications_preferences_user_id_auth_users_id_fk", + "tableFrom": "notifications_preferences", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "notifications_preferences_event_type_notifications_event_types_event_key_fk": { + "name": "notifications_preferences_event_type_notifications_event_types_event_key_fk", + "tableFrom": "notifications_preferences", + "tableTo": "notifications_event_types", + "columnsFrom": [ + "event_type" + ], + "columnsTo": [ + "event_key" + ], + "onDelete": "restrict", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.notifications_preferences_defaults": { + "name": "notifications_preferences_defaults", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "event_key": { + "name": "event_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "channel": { + "name": "channel", + "type": "notification_channel", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "notifications_preferences_defau_tenant_id_event_key_channel_key": { + "name": "notifications_preferences_defau_tenant_id_event_key_channel_key", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "event_key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "channel", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "notifications_preferences_defaults_tenant_id_tenants_id_fk": { + "name": "notifications_preferences_defaults_tenant_id_tenants_id_fk", + "tableFrom": "notifications_preferences_defaults", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "notifications_preferences_defaults_event_key_notifications_event_types_event_key_fk": { + "name": "notifications_preferences_defaults_event_key_notifications_event_types_event_key_fk", + "tableFrom": "notifications_preferences_defaults", + "tableTo": "notifications_event_types", + "columnsFrom": [ + "event_key" + ], + "columnsTo": [ + "event_key" + ], + "onDelete": "restrict", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ownaccounts": { + "name": "ownaccounts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "number": { + "name": "number", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "ownaccounts_tenant_tenants_id_fk": { + "name": "ownaccounts_tenant_tenants_id_fk", + "tableFrom": "ownaccounts", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "ownaccounts_updated_by_auth_users_id_fk": { + "name": "ownaccounts_updated_by_auth_users_id_fk", + "tableFrom": "ownaccounts", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.plants": { + "name": "plants", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "plants_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "infoData": { + "name": "infoData", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "contract": { + "name": "contract", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{\"html\":\"\",\"json\":[],\"text\":\"\"}'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "plants_tenant_tenants_id_fk": { + "name": "plants_tenant_tenants_id_fk", + "tableFrom": "plants", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "plants_customer_customers_id_fk": { + "name": "plants_customer_customers_id_fk", + "tableFrom": "plants", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "plants_contract_contracts_id_fk": { + "name": "plants_contract_contracts_id_fk", + "tableFrom": "plants", + "tableTo": "contracts", + "columnsFrom": [ + "contract" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "plants_updated_by_auth_users_id_fk": { + "name": "plants_updated_by_auth_users_id_fk", + "tableFrom": "plants", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.productcategories": { + "name": "productcategories", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "productcategories_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "productcategories_tenant_tenants_id_fk": { + "name": "productcategories_tenant_tenants_id_fk", + "tableFrom": "productcategories", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "productcategories_updated_by_auth_users_id_fk": { + "name": "productcategories_updated_by_auth_users_id_fk", + "tableFrom": "productcategories", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.products": { + "name": "products", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "products_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "manufacturer": { + "name": "manufacturer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unit": { + "name": "unit", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "tags": { + "name": "tags", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'[]'::json" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "ean": { + "name": "ean", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "barcode": { + "name": "barcode", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "purchasePrice": { + "name": "purchasePrice", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "sellingPrice": { + "name": "sellingPrice", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "manufacturerNumber": { + "name": "manufacturerNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendorAllocation": { + "name": "vendorAllocation", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "articleNumber": { + "name": "articleNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "barcodes": { + "name": "barcodes", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "productcategories": { + "name": "productcategories", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "taxPercentage": { + "name": "taxPercentage", + "type": "smallint", + "primaryKey": false, + "notNull": true, + "default": 19 + }, + "markupPercentage": { + "name": "markupPercentage", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "products_unit_units_id_fk": { + "name": "products_unit_units_id_fk", + "tableFrom": "products", + "tableTo": "units", + "columnsFrom": [ + "unit" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "products_tenant_tenants_id_fk": { + "name": "products_tenant_tenants_id_fk", + "tableFrom": "products", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "products_updated_by_auth_users_id_fk": { + "name": "products_updated_by_auth_users_id_fk", + "tableFrom": "products", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "projects_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "phases": { + "name": "phases", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "description": { + "name": "description", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "forms": { + "name": "forms", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "heroId": { + "name": "heroId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "measure": { + "name": "measure", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "material": { + "name": "material", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "plant": { + "name": "plant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "profiles": { + "name": "profiles", + "type": "uuid[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "projectNumber": { + "name": "projectNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contract": { + "name": "contract", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "projectType": { + "name": "projectType", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'Projekt'" + }, + "projecttype": { + "name": "projecttype", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "customerRef": { + "name": "customerRef", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "active_phase": { + "name": "active_phase", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "projects_tenant_tenants_id_fk": { + "name": "projects_tenant_tenants_id_fk", + "tableFrom": "projects", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "projects_customer_customers_id_fk": { + "name": "projects_customer_customers_id_fk", + "tableFrom": "projects", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "projects_contract_contracts_id_fk": { + "name": "projects_contract_contracts_id_fk", + "tableFrom": "projects", + "tableTo": "contracts", + "columnsFrom": [ + "contract" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "projects_projecttype_projecttypes_id_fk": { + "name": "projects_projecttype_projecttypes_id_fk", + "tableFrom": "projects", + "tableTo": "projecttypes", + "columnsFrom": [ + "projecttype" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "projects_updated_by_auth_users_id_fk": { + "name": "projects_updated_by_auth_users_id_fk", + "tableFrom": "projects", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projecttypes": { + "name": "projecttypes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "projecttypes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "initialPhases": { + "name": "initialPhases", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "addablePhases": { + "name": "addablePhases", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "projecttypes_tenant_tenants_id_fk": { + "name": "projecttypes_tenant_tenants_id_fk", + "tableFrom": "projecttypes", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "projecttypes_updated_by_auth_users_id_fk": { + "name": "projecttypes_updated_by_auth_users_id_fk", + "tableFrom": "projecttypes", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.servicecategories": { + "name": "servicecategories", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "servicecategories_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "double precision", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "servicecategories_tenant_tenants_id_fk": { + "name": "servicecategories_tenant_tenants_id_fk", + "tableFrom": "servicecategories", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "servicecategories_updated_by_auth_users_id_fk": { + "name": "servicecategories_updated_by_auth_users_id_fk", + "tableFrom": "servicecategories", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.services": { + "name": "services", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "services_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sellingPrice": { + "name": "sellingPrice", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "unit": { + "name": "unit", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "serviceNumber": { + "name": "serviceNumber", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "tags": { + "name": "tags", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "servicecategories": { + "name": "servicecategories", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "purchasePriceComposed": { + "name": "purchasePriceComposed", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{\"total\":0}'::jsonb" + }, + "sellingPriceComposed": { + "name": "sellingPriceComposed", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{\"total\":0}'::jsonb" + }, + "taxPercentage": { + "name": "taxPercentage", + "type": "smallint", + "primaryKey": false, + "notNull": true, + "default": 19 + }, + "materialComposition": { + "name": "materialComposition", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "personalComposition": { + "name": "personalComposition", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "services_tenant_tenants_id_fk": { + "name": "services_tenant_tenants_id_fk", + "tableFrom": "services", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "services_unit_units_id_fk": { + "name": "services_unit_units_id_fk", + "tableFrom": "services", + "tableTo": "units", + "columnsFrom": [ + "unit" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "services_updated_by_auth_users_id_fk": { + "name": "services_updated_by_auth_users_id_fk", + "tableFrom": "services", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.spaces": { + "name": "spaces", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "spaces_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "spaceNumber": { + "name": "spaceNumber", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parentSpace": { + "name": "parentSpace", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "infoData": { + "name": "infoData", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{\"zip\":\"\",\"city\":\"\",\"streetNumber\":\"\"}'::jsonb" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "spaces_tenant_tenants_id_fk": { + "name": "spaces_tenant_tenants_id_fk", + "tableFrom": "spaces", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "spaces_parentSpace_spaces_id_fk": { + "name": "spaces_parentSpace_spaces_id_fk", + "tableFrom": "spaces", + "tableTo": "spaces", + "columnsFrom": [ + "parentSpace" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "spaces_updated_by_auth_users_id_fk": { + "name": "spaces_updated_by_auth_users_id_fk", + "tableFrom": "spaces", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.staff_time_entries": { + "name": "staff_time_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "stopped_at": { + "name": "stopped_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "duration_minutes": { + "name": "duration_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "generated": { + "as": "CASE \n WHEN stopped_at IS NOT NULL \n THEN (EXTRACT(epoch FROM (stopped_at - started_at)) / 60)\n ELSE NULL\n END", + "type": "stored" + } + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'work'" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "times_state", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'draft'" + }, + "device": { + "name": "device", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "internal_note": { + "name": "internal_note", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vacation_reason": { + "name": "vacation_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vacation_days": { + "name": "vacation_days", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "approved_by": { + "name": "approved_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "sick_reason": { + "name": "sick_reason", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "staff_time_entries_tenant_id_tenants_id_fk": { + "name": "staff_time_entries_tenant_id_tenants_id_fk", + "tableFrom": "staff_time_entries", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "staff_time_entries_user_id_auth_users_id_fk": { + "name": "staff_time_entries_user_id_auth_users_id_fk", + "tableFrom": "staff_time_entries", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "staff_time_entries_updated_by_auth_users_id_fk": { + "name": "staff_time_entries_updated_by_auth_users_id_fk", + "tableFrom": "staff_time_entries", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "staff_time_entries_approved_by_auth_users_id_fk": { + "name": "staff_time_entries_approved_by_auth_users_id_fk", + "tableFrom": "staff_time_entries", + "tableTo": "auth_users", + "columnsFrom": [ + "approved_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.staff_time_entry_connects": { + "name": "staff_time_entry_connects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "time_entry_id": { + "name": "time_entry_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "stopped_at": { + "name": "stopped_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "duration_minutes": { + "name": "duration_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "generated": { + "as": "(EXTRACT(epoch FROM (stopped_at - started_at)) / 60)", + "type": "stored" + } + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "staff_time_entry_connects_time_entry_id_staff_time_entries_id_fk": { + "name": "staff_time_entry_connects_time_entry_id_staff_time_entries_id_fk", + "tableFrom": "staff_time_entry_connects", + "tableTo": "staff_time_entries", + "columnsFrom": [ + "time_entry_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.staff_zeitstromtimestamps": { + "name": "staff_zeitstromtimestamps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "profile": { + "name": "profile", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "intent": { + "name": "intent", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "time": { + "name": "time", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "staff_time_entry": { + "name": "staff_time_entry", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "internal_note": { + "name": "internal_note", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "staff_zeitstromtimestamps_tenant_tenants_id_fk": { + "name": "staff_zeitstromtimestamps_tenant_tenants_id_fk", + "tableFrom": "staff_zeitstromtimestamps", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "staff_zeitstromtimestamps_profile_auth_profiles_id_fk": { + "name": "staff_zeitstromtimestamps_profile_auth_profiles_id_fk", + "tableFrom": "staff_zeitstromtimestamps", + "tableTo": "auth_profiles", + "columnsFrom": [ + "profile" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "staff_zeitstromtimestamps_staff_time_entry_staff_time_entries_id_fk": { + "name": "staff_zeitstromtimestamps_staff_time_entry_staff_time_entries_id_fk", + "tableFrom": "staff_zeitstromtimestamps", + "tableTo": "staff_time_entries", + "columnsFrom": [ + "staff_time_entry" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.statementallocations": { + "name": "statementallocations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "bs_id": { + "name": "bs_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "cd_id": { + "name": "cd_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "amount": { + "name": "amount", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "ii_id": { + "name": "ii_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "account": { + "name": "account", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "ownaccount": { + "name": "ownaccount", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "vendor": { + "name": "vendor", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "statementallocations_bs_id_bankstatements_id_fk": { + "name": "statementallocations_bs_id_bankstatements_id_fk", + "tableFrom": "statementallocations", + "tableTo": "bankstatements", + "columnsFrom": [ + "bs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "statementallocations_cd_id_createddocuments_id_fk": { + "name": "statementallocations_cd_id_createddocuments_id_fk", + "tableFrom": "statementallocations", + "tableTo": "createddocuments", + "columnsFrom": [ + "cd_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "statementallocations_ii_id_incominginvoices_id_fk": { + "name": "statementallocations_ii_id_incominginvoices_id_fk", + "tableFrom": "statementallocations", + "tableTo": "incominginvoices", + "columnsFrom": [ + "ii_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "statementallocations_tenant_tenants_id_fk": { + "name": "statementallocations_tenant_tenants_id_fk", + "tableFrom": "statementallocations", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "statementallocations_account_accounts_id_fk": { + "name": "statementallocations_account_accounts_id_fk", + "tableFrom": "statementallocations", + "tableTo": "accounts", + "columnsFrom": [ + "account" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "statementallocations_ownaccount_ownaccounts_id_fk": { + "name": "statementallocations_ownaccount_ownaccounts_id_fk", + "tableFrom": "statementallocations", + "tableTo": "ownaccounts", + "columnsFrom": [ + "ownaccount" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "statementallocations_customer_customers_id_fk": { + "name": "statementallocations_customer_customers_id_fk", + "tableFrom": "statementallocations", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "statementallocations_vendor_vendors_id_fk": { + "name": "statementallocations_vendor_vendors_id_fk", + "tableFrom": "statementallocations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "statementallocations_updated_by_auth_users_id_fk": { + "name": "statementallocations_updated_by_auth_users_id_fk", + "tableFrom": "statementallocations", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "tasks_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "categorie": { + "name": "categorie", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "project": { + "name": "project", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "plant": { + "name": "plant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tasks_tenant_tenants_id_fk": { + "name": "tasks_tenant_tenants_id_fk", + "tableFrom": "tasks", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "tasks_user_id_auth_users_id_fk": { + "name": "tasks_user_id_auth_users_id_fk", + "tableFrom": "tasks", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "tasks_customer_customers_id_fk": { + "name": "tasks_customer_customers_id_fk", + "tableFrom": "tasks", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "tasks_updated_by_auth_users_id_fk": { + "name": "tasks_updated_by_auth_users_id_fk", + "tableFrom": "tasks", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.taxtypes": { + "name": "taxtypes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "taxtypes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "percentage": { + "name": "percentage", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "taxtypes_updated_by_auth_users_id_fk": { + "name": "taxtypes_updated_by_auth_users_id_fk", + "tableFrom": "taxtypes", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tenants": { + "name": "tenants", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "tenants_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "short": { + "name": "short", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "calendarConfig": { + "name": "calendarConfig", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{\"eventTypes\":[{\"color\":\"blue\",\"label\":\"Büro\"},{\"color\":\"yellow\",\"label\":\"Besprechung\"},{\"color\":\"green\",\"label\":\"Umsetzung\"},{\"color\":\"red\",\"label\":\"Vor Ort Termin\"}]}'::jsonb" + }, + "timeConfig": { + "name": "timeConfig", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "tags": { + "name": "tags", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{\"products\":[],\"documents\":[]}'::jsonb" + }, + "measures": { + "name": "measures", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[{\"name\":\"Netzwerktechnik\",\"short\":\"NWT\"},{\"name\":\"Elektrotechnik\",\"short\":\"ELT\"},{\"name\":\"Photovoltaik\",\"short\":\"PV\"},{\"name\":\"Videüberwachung\",\"short\":\"VÜA\"},{\"name\":\"Projekt\",\"short\":\"PRJ\"},{\"name\":\"Smart Home\",\"short\":\"SHO\"}]'::jsonb" + }, + "businessInfo": { + "name": "businessInfo", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{\"zip\":\"\",\"city\":\"\",\"name\":\"\",\"street\":\"\"}'::jsonb" + }, + "features": { + "name": "features", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{\"objects\":true,\"calendar\":true,\"contacts\":true,\"projects\":true,\"vehicles\":true,\"contracts\":true,\"inventory\":true,\"accounting\":true,\"timeTracking\":true,\"planningBoard\":true,\"workingTimeTracking\":true}'::jsonb" + }, + "ownFields": { + "name": "ownFields", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "numberRanges": { + "name": "numberRanges", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{\"vendors\":{\"prefix\":\"\",\"suffix\":\"\",\"nextNumber\":10000},\"customers\":{\"prefix\":\"\",\"suffix\":\"\",\"nextNumber\":10000},\"products\":{\"prefix\":\"AT-\",\"suffix\":\"\",\"nextNumber\":1000},\"quotes\":{\"prefix\":\"AN-\",\"suffix\":\"\",\"nextNumber\":1000},\"confirmationOrders\":{\"prefix\":\"AB-\",\"suffix\":\"\",\"nextNumber\":1000},\"invoices\":{\"prefix\":\"RE-\",\"suffix\":\"\",\"nextNumber\":1000},\"spaces\":{\"prefix\":\"LP-\",\"suffix\":\"\",\"nextNumber\":1000},\"inventoryitems\":{\"prefix\":\"IA-\",\"suffix\":\"\",\"nextNumber\":1000},\"projects\":{\"prefix\":\"PRJ-\",\"suffix\":\"\",\"nextNumber\":1000},\"costcentres\":{\"prefix\":\"KST-\",\"suffix\":\"\",\"nextNumber\":1000}}'::jsonb" + }, + "standardEmailForInvoices": { + "name": "standardEmailForInvoices", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "extraModules": { + "name": "extraModules", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "isInTrial": { + "name": "isInTrial", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "trialEndDate": { + "name": "trialEndDate", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "stripeCustomerId": { + "name": "stripeCustomerId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hasActiveLicense": { + "name": "hasActiveLicense", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "userLicenseCount": { + "name": "userLicenseCount", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "workstationLicenseCount": { + "name": "workstationLicenseCount", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "standardPaymentDays": { + "name": "standardPaymentDays", + "type": "smallint", + "primaryKey": false, + "notNull": true, + "default": 14 + }, + "dokuboxEmailAddresses": { + "name": "dokuboxEmailAddresses", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "dokuboxkey": { + "name": "dokuboxkey", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "autoPrepareIncomingInvoices": { + "name": "autoPrepareIncomingInvoices", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "portalDomain": { + "name": "portalDomain", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "portalConfig": { + "name": "portalConfig", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{\"primayColor\":\"#69c350\"}'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "locked": { + "name": "locked", + "type": "locked_tenant", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tenants_updated_by_auth_users_id_fk": { + "name": "tenants_updated_by_auth_users_id_fk", + "tableFrom": "tenants", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.texttemplates": { + "name": "texttemplates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "texttemplates_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "documentType": { + "name": "documentType", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "default": { + "name": "default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pos": { + "name": "pos", + "type": "texttemplatepositions", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "texttemplates_tenant_tenants_id_fk": { + "name": "texttemplates_tenant_tenants_id_fk", + "tableFrom": "texttemplates", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "texttemplates_updated_by_auth_users_id_fk": { + "name": "texttemplates_updated_by_auth_users_id_fk", + "tableFrom": "texttemplates", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.units": { + "name": "units", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "units_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "single": { + "name": "single", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "multiple": { + "name": "multiple", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "short": { + "name": "short", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "step": { + "name": "step", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'1'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_credentials": { + "name": "user_credentials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "smtp_port": { + "name": "smtp_port", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "smtp_ssl": { + "name": "smtp_ssl", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "credential_types", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "imap_port": { + "name": "imap_port", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "imap_ssl": { + "name": "imap_ssl", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "email_encrypted": { + "name": "email_encrypted", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "password_encrypted": { + "name": "password_encrypted", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "smtp_host_encrypted": { + "name": "smtp_host_encrypted", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "imap_host_encrypted": { + "name": "imap_host_encrypted", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "access_token_encrypted": { + "name": "access_token_encrypted", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "refresh_token_encrypted": { + "name": "refresh_token_encrypted", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "user_credentials_user_id_auth_users_id_fk": { + "name": "user_credentials_user_id_auth_users_id_fk", + "tableFrom": "user_credentials", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_credentials_tenant_id_tenants_id_fk": { + "name": "user_credentials_tenant_id_tenants_id_fk", + "tableFrom": "user_credentials", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vehicles": { + "name": "vehicles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "vehicles_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "licensePlate": { + "name": "licensePlate", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "driver": { + "name": "driver", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "vin": { + "name": "vin", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tankSize": { + "name": "tankSize", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "buildYear": { + "name": "buildYear", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "towingCapacity": { + "name": "towingCapacity", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "powerInKW": { + "name": "powerInKW", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vehicles_tenant_tenants_id_fk": { + "name": "vehicles_tenant_tenants_id_fk", + "tableFrom": "vehicles", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vehicles_driver_auth_users_id_fk": { + "name": "vehicles_driver_auth_users_id_fk", + "tableFrom": "vehicles", + "tableTo": "auth_users", + "columnsFrom": [ + "driver" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vehicles_updated_by_auth_users_id_fk": { + "name": "vehicles_updated_by_auth_users_id_fk", + "tableFrom": "vehicles", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors": { + "name": "vendors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "vendors_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendorNumber": { + "name": "vendorNumber", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "infoData": { + "name": "infoData", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hasSEPA": { + "name": "hasSEPA", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "defaultPaymentMethod": { + "name": "defaultPaymentMethod", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_tenant_tenants_id_fk": { + "name": "vendors_tenant_tenants_id_fk", + "tableFrom": "vendors", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendors_updated_by_auth_users_id_fk": { + "name": "vendors_updated_by_auth_users_id_fk", + "tableFrom": "vendors", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.credential_types": { + "name": "credential_types", + "schema": "public", + "values": [ + "mail", + "m365" + ] + }, + "public.folderfunctions": { + "name": "folderfunctions", + "schema": "public", + "values": [ + "none", + "yearSubCategory", + "incomingInvoices", + "invoices", + "quotes", + "confirmationOrders", + "deliveryNotes", + "vehicleData", + "reminders", + "taxData", + "deposit", + "timeEvaluations" + ] + }, + "public.locked_tenant": { + "name": "locked_tenant", + "schema": "public", + "values": [ + "maintenance_tenant", + "maintenance", + "general", + "no_subscription" + ] + }, + "public.notification_channel": { + "name": "notification_channel", + "schema": "public", + "values": [ + "email", + "inapp", + "sms", + "push", + "webhook" + ] + }, + "public.notification_severity": { + "name": "notification_severity", + "schema": "public", + "values": [ + "info", + "success", + "warning", + "error" + ] + }, + "public.notification_status": { + "name": "notification_status", + "schema": "public", + "values": [ + "queued", + "sent", + "failed", + "read" + ] + }, + "public.payment_types": { + "name": "payment_types", + "schema": "public", + "values": [ + "transfer", + "direct_debit" + ] + }, + "public.texttemplatepositions": { + "name": "texttemplatepositions", + "schema": "public", + "values": [ + "startText", + "endText" + ] + }, + "public.times_state": { + "name": "times_state", + "schema": "public", + "values": [ + "submitted", + "approved", + "draft" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db/migrations/meta/0001_snapshot.json b/db/migrations/meta/0001_snapshot.json new file mode 100644 index 0000000..f5a2f32 --- /dev/null +++ b/db/migrations/meta/0001_snapshot.json @@ -0,0 +1,9947 @@ +{ + "id": "91737e8e-9323-4b3f-9c03-13793e3b160c", + "prevId": "c74cefc4-5ae7-408c-b7f3-09093efb52b5", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.accounts": { + "name": "accounts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "accounts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "number": { + "name": "number", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_profiles": { + "name": "auth_profiles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "first_name": { + "name": "first_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_name": { + "name": "last_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "full_name": { + "name": "full_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "generated": { + "as": "((first_name || ' ') || last_name)", + "type": "stored" + } + }, + "mobile_tel": { + "name": "mobile_tel", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "fixed_tel": { + "name": "fixed_tel", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "salutation": { + "name": "salutation", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "employee_number": { + "name": "employee_number", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "weekly_working_hours": { + "name": "weekly_working_hours", + "type": "double precision", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "annual_paid_leave_days": { + "name": "annual_paid_leave_days", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "weekly_regular_working_hours": { + "name": "weekly_regular_working_hours", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "clothing_size_top": { + "name": "clothing_size_top", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "clothing_size_bottom": { + "name": "clothing_size_bottom", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "clothing_size_shoe": { + "name": "clothing_size_shoe", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email_signature": { + "name": "email_signature", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'Mit freundlichen Grüßen
'" + }, + "birthday": { + "name": "birthday", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "entry_date": { + "name": "entry_date", + "type": "date", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "automatic_hour_corrections": { + "name": "automatic_hour_corrections", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'" + }, + "recreation_days_compensation": { + "name": "recreation_days_compensation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "customer_for_portal": { + "name": "customer_for_portal", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "pinned_on_navigation": { + "name": "pinned_on_navigation", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "token_id": { + "name": "token_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "weekly_working_days": { + "name": "weekly_working_days", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "old_profile_id": { + "name": "old_profile_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "temp_config": { + "name": "temp_config", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "state_code": { + "name": "state_code", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'DE-NI'" + }, + "contract_type": { + "name": "contract_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "position": { + "name": "position", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "qualification": { + "name": "qualification", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_street": { + "name": "address_street", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_zip": { + "name": "address_zip", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_city": { + "name": "address_city", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + } + }, + "indexes": {}, + "foreignKeys": { + "auth_profiles_user_id_auth_users_id_fk": { + "name": "auth_profiles_user_id_auth_users_id_fk", + "tableFrom": "auth_profiles", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_role_permissions": { + "name": "auth_role_permissions", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "auth_role_permissions_role_id_auth_roles_id_fk": { + "name": "auth_role_permissions_role_id_auth_roles_id_fk", + "tableFrom": "auth_role_permissions", + "tableTo": "auth_roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_roles": { + "name": "auth_roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "auth_roles_created_by_auth_users_id_fk": { + "name": "auth_roles_created_by_auth_users_id_fk", + "tableFrom": "auth_roles", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_tenant_users": { + "name": "auth_tenant_users", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "auth_tenant_users_created_by_auth_users_id_fk": { + "name": "auth_tenant_users_created_by_auth_users_id_fk", + "tableFrom": "auth_tenant_users", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_user_roles": { + "name": "auth_user_roles", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "auth_user_roles_user_id_auth_users_id_fk": { + "name": "auth_user_roles_user_id_auth_users_id_fk", + "tableFrom": "auth_user_roles", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "auth_user_roles_role_id_auth_roles_id_fk": { + "name": "auth_user_roles_role_id_auth_roles_id_fk", + "tableFrom": "auth_user_roles", + "tableTo": "auth_roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "auth_user_roles_created_by_auth_users_id_fk": { + "name": "auth_user_roles_created_by_auth_users_id_fk", + "tableFrom": "auth_user_roles", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_users": { + "name": "auth_users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "password_hash": { + "name": "password_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "multi_tenant": { + "name": "multi_tenant", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "must_change_password": { + "name": "must_change_password", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "ported": { + "name": "ported", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bankaccounts": { + "name": "bankaccounts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "bankaccounts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "iban": { + "name": "iban", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "bankId": { + "name": "bankId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "ownerName": { + "name": "ownerName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "accountId": { + "name": "accountId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "balance": { + "name": "balance", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "expired": { + "name": "expired", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "datevNumber": { + "name": "datevNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "bankaccounts_tenant_tenants_id_fk": { + "name": "bankaccounts_tenant_tenants_id_fk", + "tableFrom": "bankaccounts", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "bankaccounts_updated_by_auth_users_id_fk": { + "name": "bankaccounts_updated_by_auth_users_id_fk", + "tableFrom": "bankaccounts", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bankrequisitions": { + "name": "bankrequisitions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "institutionId": { + "name": "institutionId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "bankrequisitions_tenant_tenants_id_fk": { + "name": "bankrequisitions_tenant_tenants_id_fk", + "tableFrom": "bankrequisitions", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "bankrequisitions_updated_by_auth_users_id_fk": { + "name": "bankrequisitions_updated_by_auth_users_id_fk", + "tableFrom": "bankrequisitions", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.bankstatements": { + "name": "bankstatements", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "bankstatements_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "account": { + "name": "account", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credIban": { + "name": "credIban", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "credName": { + "name": "credName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "amount": { + "name": "amount", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "debIban": { + "name": "debIban", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "debName": { + "name": "debName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "gocardlessId": { + "name": "gocardlessId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "valueDate": { + "name": "valueDate", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "mandateId": { + "name": "mandateId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contract": { + "name": "contract", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "bankstatements_account_bankaccounts_id_fk": { + "name": "bankstatements_account_bankaccounts_id_fk", + "tableFrom": "bankstatements", + "tableTo": "bankaccounts", + "columnsFrom": [ + "account" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "bankstatements_tenant_tenants_id_fk": { + "name": "bankstatements_tenant_tenants_id_fk", + "tableFrom": "bankstatements", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "bankstatements_contract_contracts_id_fk": { + "name": "bankstatements_contract_contracts_id_fk", + "tableFrom": "bankstatements", + "tableTo": "contracts", + "columnsFrom": [ + "contract" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "bankstatements_updated_by_auth_users_id_fk": { + "name": "bankstatements_updated_by_auth_users_id_fk", + "tableFrom": "bankstatements", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.checkexecutions": { + "name": "checkexecutions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "check": { + "name": "check", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "executed_at": { + "name": "executed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "checkexecutions_check_checks_id_fk": { + "name": "checkexecutions_check_checks_id_fk", + "tableFrom": "checkexecutions", + "tableTo": "checks", + "columnsFrom": [ + "check" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.checks": { + "name": "checks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "vehicle": { + "name": "vehicle", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "inventoryitem": { + "name": "inventoryitem", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "distance": { + "name": "distance", + "type": "bigint", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "distanceUnit": { + "name": "distanceUnit", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'days'" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "checks_vehicle_vehicles_id_fk": { + "name": "checks_vehicle_vehicles_id_fk", + "tableFrom": "checks", + "tableTo": "vehicles", + "columnsFrom": [ + "vehicle" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "checks_inventoryitem_inventoryitems_id_fk": { + "name": "checks_inventoryitem_inventoryitems_id_fk", + "tableFrom": "checks", + "tableTo": "inventoryitems", + "columnsFrom": [ + "inventoryitem" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "checks_tenant_tenants_id_fk": { + "name": "checks_tenant_tenants_id_fk", + "tableFrom": "checks", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "checks_updated_by_auth_users_id_fk": { + "name": "checks_updated_by_auth_users_id_fk", + "tableFrom": "checks", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.citys": { + "name": "citys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "citys_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "short": { + "name": "short", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "long": { + "name": "long", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "geometry": { + "name": "geometry", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "zip": { + "name": "zip", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "districtCode": { + "name": "districtCode", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "countryName": { + "name": "countryName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "countryCode": { + "name": "countryCode", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "districtName": { + "name": "districtName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "geopoint": { + "name": "geopoint", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contacts": { + "name": "contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "contacts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "firstName": { + "name": "firstName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lastName": { + "name": "lastName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "phoneMobile": { + "name": "phoneMobile", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "phoneHome": { + "name": "phoneHome", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "heroId": { + "name": "heroId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "fullName": { + "name": "fullName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "salutation": { + "name": "salutation", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendor": { + "name": "vendor", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "birthday": { + "name": "birthday", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "contacts_customer_customers_id_fk": { + "name": "contacts_customer_customers_id_fk", + "tableFrom": "contacts", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "contacts_updated_by_auth_users_id_fk": { + "name": "contacts_updated_by_auth_users_id_fk", + "tableFrom": "contacts", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "contracts_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "recurring": { + "name": "recurring", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "rhythm": { + "name": "rhythm", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "startDate": { + "name": "startDate", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "endDate": { + "name": "endDate", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "signDate": { + "name": "signDate", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "duration": { + "name": "duration", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contact": { + "name": "contact", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "bankingIban": { + "name": "bankingIban", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "bankingBIC": { + "name": "bankingBIC", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "bankingName": { + "name": "bankingName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "bankingOwner": { + "name": "bankingOwner", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sepaRef": { + "name": "sepaRef", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sepaDate": { + "name": "sepaDate", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "paymentType": { + "name": "paymentType", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "invoiceDispatch": { + "name": "invoiceDispatch", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ownFields": { + "name": "ownFields", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "contractNumber": { + "name": "contractNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "contracts_customer_customers_id_fk": { + "name": "contracts_customer_customers_id_fk", + "tableFrom": "contracts", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "contracts_contact_contacts_id_fk": { + "name": "contracts_contact_contacts_id_fk", + "tableFrom": "contracts", + "tableTo": "contacts", + "columnsFrom": [ + "contact" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "contracts_updated_by_auth_users_id_fk": { + "name": "contracts_updated_by_auth_users_id_fk", + "tableFrom": "contracts", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.costcentres": { + "name": "costcentres", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "number": { + "name": "number", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vehicle": { + "name": "vehicle", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "project": { + "name": "project", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "inventoryitem": { + "name": "inventoryitem", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "costcentres_tenant_tenants_id_fk": { + "name": "costcentres_tenant_tenants_id_fk", + "tableFrom": "costcentres", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "costcentres_vehicle_vehicles_id_fk": { + "name": "costcentres_vehicle_vehicles_id_fk", + "tableFrom": "costcentres", + "tableTo": "vehicles", + "columnsFrom": [ + "vehicle" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "costcentres_project_projects_id_fk": { + "name": "costcentres_project_projects_id_fk", + "tableFrom": "costcentres", + "tableTo": "projects", + "columnsFrom": [ + "project" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "costcentres_inventoryitem_inventoryitems_id_fk": { + "name": "costcentres_inventoryitem_inventoryitems_id_fk", + "tableFrom": "costcentres", + "tableTo": "inventoryitems", + "columnsFrom": [ + "inventoryitem" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "costcentres_updated_by_auth_users_id_fk": { + "name": "costcentres_updated_by_auth_users_id_fk", + "tableFrom": "costcentres", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.countrys": { + "name": "countrys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "countrys_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.createddocuments": { + "name": "createddocuments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "createddocuments_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'INVOICE'" + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "contact": { + "name": "contact", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "address": { + "name": "address", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "project": { + "name": "project", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "documentNumber": { + "name": "documentNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "documentDate": { + "name": "documentDate", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'Entwurf'" + }, + "info": { + "name": "info", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "createdBy": { + "name": "createdBy", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "startText": { + "name": "startText", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "endText": { + "name": "endText", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rows": { + "name": "rows", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "deliveryDateType": { + "name": "deliveryDateType", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "paymentDays": { + "name": "paymentDays", + "type": "smallint", + "primaryKey": false, + "notNull": false + }, + "deliveryDate": { + "name": "deliveryDate", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contactPerson": { + "name": "contactPerson", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "serialConfig": { + "name": "serialConfig", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'::jsonb" + }, + "linkedDocument": { + "name": "linkedDocument", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "agriculture": { + "name": "agriculture", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "letterhead": { + "name": "letterhead", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "advanceInvoiceResolved": { + "name": "advanceInvoiceResolved", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "usedAdvanceInvoices": { + "name": "usedAdvanceInvoices", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "deliveryDateEnd": { + "name": "deliveryDateEnd", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "plant": { + "name": "plant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "taxType": { + "name": "taxType", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "customSurchargePercentage": { + "name": "customSurchargePercentage", + "type": "smallint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "report": { + "name": "report", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "availableInPortal": { + "name": "availableInPortal", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "payment_type": { + "name": "payment_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'transfer'" + }, + "contract": { + "name": "contract", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "createddocuments_tenant_tenants_id_fk": { + "name": "createddocuments_tenant_tenants_id_fk", + "tableFrom": "createddocuments", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_customer_customers_id_fk": { + "name": "createddocuments_customer_customers_id_fk", + "tableFrom": "createddocuments", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_contact_contacts_id_fk": { + "name": "createddocuments_contact_contacts_id_fk", + "tableFrom": "createddocuments", + "tableTo": "contacts", + "columnsFrom": [ + "contact" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_project_projects_id_fk": { + "name": "createddocuments_project_projects_id_fk", + "tableFrom": "createddocuments", + "tableTo": "projects", + "columnsFrom": [ + "project" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_createdBy_auth_users_id_fk": { + "name": "createddocuments_createdBy_auth_users_id_fk", + "tableFrom": "createddocuments", + "tableTo": "auth_users", + "columnsFrom": [ + "createdBy" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_linkedDocument_createddocuments_id_fk": { + "name": "createddocuments_linkedDocument_createddocuments_id_fk", + "tableFrom": "createddocuments", + "tableTo": "createddocuments", + "columnsFrom": [ + "linkedDocument" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_letterhead_letterheads_id_fk": { + "name": "createddocuments_letterhead_letterheads_id_fk", + "tableFrom": "createddocuments", + "tableTo": "letterheads", + "columnsFrom": [ + "letterhead" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_plant_plants_id_fk": { + "name": "createddocuments_plant_plants_id_fk", + "tableFrom": "createddocuments", + "tableTo": "plants", + "columnsFrom": [ + "plant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_updated_by_auth_users_id_fk": { + "name": "createddocuments_updated_by_auth_users_id_fk", + "tableFrom": "createddocuments", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_created_by_auth_users_id_fk": { + "name": "createddocuments_created_by_auth_users_id_fk", + "tableFrom": "createddocuments", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createddocuments_contract_contracts_id_fk": { + "name": "createddocuments_contract_contracts_id_fk", + "tableFrom": "createddocuments", + "tableTo": "contracts", + "columnsFrom": [ + "contract" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.createdletters": { + "name": "createdletters", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "vendor": { + "name": "vendor", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "content_json": { + "name": "content_json", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "content_text": { + "name": "content_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "createdletters_tenant_tenants_id_fk": { + "name": "createdletters_tenant_tenants_id_fk", + "tableFrom": "createdletters", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createdletters_customer_customers_id_fk": { + "name": "createdletters_customer_customers_id_fk", + "tableFrom": "createdletters", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createdletters_vendor_vendors_id_fk": { + "name": "createdletters_vendor_vendors_id_fk", + "tableFrom": "createdletters", + "tableTo": "vendors", + "columnsFrom": [ + "vendor" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "createdletters_updated_by_auth_users_id_fk": { + "name": "createdletters_updated_by_auth_users_id_fk", + "tableFrom": "createdletters", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.customers": { + "name": "customers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "customers_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "customerNumber": { + "name": "customerNumber", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "infoData": { + "name": "infoData", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'::jsonb" + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'Privat'" + }, + "heroId": { + "name": "heroId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "isCompany": { + "name": "isCompany", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "customPaymentDays": { + "name": "customPaymentDays", + "type": "smallint", + "primaryKey": false, + "notNull": false + }, + "firstname": { + "name": "firstname", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lastname": { + "name": "lastname", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "customSurchargePercentage": { + "name": "customSurchargePercentage", + "type": "smallint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "salutation": { + "name": "salutation", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "nameAddition": { + "name": "nameAddition", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "availableInPortal": { + "name": "availableInPortal", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "custom_payment_type": { + "name": "custom_payment_type", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "customers_updated_by_auth_users_id_fk": { + "name": "customers_updated_by_auth_users_id_fk", + "tableFrom": "customers", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.devices": { + "name": "devices", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "externalId": { + "name": "externalId", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "devices_tenant_tenants_id_fk": { + "name": "devices_tenant_tenants_id_fk", + "tableFrom": "devices", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.documentboxes": { + "name": "documentboxes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "space": { + "name": "space", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "documentboxes_space_spaces_id_fk": { + "name": "documentboxes_space_spaces_id_fk", + "tableFrom": "documentboxes", + "tableTo": "spaces", + "columnsFrom": [ + "space" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "documentboxes_tenant_tenants_id_fk": { + "name": "documentboxes_tenant_tenants_id_fk", + "tableFrom": "documentboxes", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "documentboxes_updated_by_auth_users_id_fk": { + "name": "documentboxes_updated_by_auth_users_id_fk", + "tableFrom": "documentboxes", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.events": { + "name": "events", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "events_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "startDate": { + "name": "startDate", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "endDate": { + "name": "endDate", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "eventtype": { + "name": "eventtype", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'Umsetzung'" + }, + "project": { + "name": "project", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "resources": { + "name": "resources", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "link": { + "name": "link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "vehicles": { + "name": "vehicles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "inventoryitems": { + "name": "inventoryitems", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "inventoryitemgroups": { + "name": "inventoryitemgroups", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "vendor": { + "name": "vendor", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "events_customer_customers_id_fk": { + "name": "events_customer_customers_id_fk", + "tableFrom": "events", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "events_updated_by_auth_users_id_fk": { + "name": "events_updated_by_auth_users_id_fk", + "tableFrom": "events", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.files": { + "name": "files", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "project": { + "name": "project", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "contract": { + "name": "contract", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "vendor": { + "name": "vendor", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "incominginvoice": { + "name": "incominginvoice", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "plant": { + "name": "plant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "createddocument": { + "name": "createddocument", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "vehicle": { + "name": "vehicle", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "product": { + "name": "product", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "check": { + "name": "check", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "inventoryitem": { + "name": "inventoryitem", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "folder": { + "name": "folder", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "mimeType": { + "name": "mimeType", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "space": { + "name": "space", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "documentbox": { + "name": "documentbox", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "auth_profile": { + "name": "auth_profile", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "files_tenant_tenants_id_fk": { + "name": "files_tenant_tenants_id_fk", + "tableFrom": "files", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_project_projects_id_fk": { + "name": "files_project_projects_id_fk", + "tableFrom": "files", + "tableTo": "projects", + "columnsFrom": [ + "project" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_customer_customers_id_fk": { + "name": "files_customer_customers_id_fk", + "tableFrom": "files", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_contract_contracts_id_fk": { + "name": "files_contract_contracts_id_fk", + "tableFrom": "files", + "tableTo": "contracts", + "columnsFrom": [ + "contract" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_vendor_vendors_id_fk": { + "name": "files_vendor_vendors_id_fk", + "tableFrom": "files", + "tableTo": "vendors", + "columnsFrom": [ + "vendor" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_incominginvoice_incominginvoices_id_fk": { + "name": "files_incominginvoice_incominginvoices_id_fk", + "tableFrom": "files", + "tableTo": "incominginvoices", + "columnsFrom": [ + "incominginvoice" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_plant_plants_id_fk": { + "name": "files_plant_plants_id_fk", + "tableFrom": "files", + "tableTo": "plants", + "columnsFrom": [ + "plant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_createddocument_createddocuments_id_fk": { + "name": "files_createddocument_createddocuments_id_fk", + "tableFrom": "files", + "tableTo": "createddocuments", + "columnsFrom": [ + "createddocument" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_vehicle_vehicles_id_fk": { + "name": "files_vehicle_vehicles_id_fk", + "tableFrom": "files", + "tableTo": "vehicles", + "columnsFrom": [ + "vehicle" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_product_products_id_fk": { + "name": "files_product_products_id_fk", + "tableFrom": "files", + "tableTo": "products", + "columnsFrom": [ + "product" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_check_checks_id_fk": { + "name": "files_check_checks_id_fk", + "tableFrom": "files", + "tableTo": "checks", + "columnsFrom": [ + "check" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_inventoryitem_inventoryitems_id_fk": { + "name": "files_inventoryitem_inventoryitems_id_fk", + "tableFrom": "files", + "tableTo": "inventoryitems", + "columnsFrom": [ + "inventoryitem" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_folder_folders_id_fk": { + "name": "files_folder_folders_id_fk", + "tableFrom": "files", + "tableTo": "folders", + "columnsFrom": [ + "folder" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_space_spaces_id_fk": { + "name": "files_space_spaces_id_fk", + "tableFrom": "files", + "tableTo": "spaces", + "columnsFrom": [ + "space" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_type_filetags_id_fk": { + "name": "files_type_filetags_id_fk", + "tableFrom": "files", + "tableTo": "filetags", + "columnsFrom": [ + "type" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_documentbox_documentboxes_id_fk": { + "name": "files_documentbox_documentboxes_id_fk", + "tableFrom": "files", + "tableTo": "documentboxes", + "columnsFrom": [ + "documentbox" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_updated_by_auth_users_id_fk": { + "name": "files_updated_by_auth_users_id_fk", + "tableFrom": "files", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_created_by_auth_users_id_fk": { + "name": "files_created_by_auth_users_id_fk", + "tableFrom": "files", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "files_auth_profile_auth_profiles_id_fk": { + "name": "files_auth_profile_auth_profiles_id_fk", + "tableFrom": "files", + "tableTo": "auth_profiles", + "columnsFrom": [ + "auth_profile" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.filetags": { + "name": "filetags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "createddocumenttype": { + "name": "createddocumenttype", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "incomingDocumentType": { + "name": "incomingDocumentType", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "filetags_tenant_tenants_id_fk": { + "name": "filetags_tenant_tenants_id_fk", + "tableFrom": "filetags", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.folders": { + "name": "folders", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent": { + "name": "parent", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "isSystemUsed": { + "name": "isSystemUsed", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "function": { + "name": "function", + "type": "folderfunctions", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "year": { + "name": "year", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "standardFiletype": { + "name": "standardFiletype", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "standardFiletypeIsOptional": { + "name": "standardFiletypeIsOptional", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "folders_tenant_tenants_id_fk": { + "name": "folders_tenant_tenants_id_fk", + "tableFrom": "folders", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "folders_parent_folders_id_fk": { + "name": "folders_parent_folders_id_fk", + "tableFrom": "folders", + "tableTo": "folders", + "columnsFrom": [ + "parent" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "folders_standardFiletype_filetags_id_fk": { + "name": "folders_standardFiletype_filetags_id_fk", + "tableFrom": "folders", + "tableTo": "filetags", + "columnsFrom": [ + "standardFiletype" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "folders_updated_by_auth_users_id_fk": { + "name": "folders_updated_by_auth_users_id_fk", + "tableFrom": "folders", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.exports": { + "name": "exports", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "exports_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "start_date": { + "name": "start_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "end_date": { + "name": "end_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "valid_until": { + "name": "valid_until", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'datev'" + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "exports_tenant_id_tenants_id_fk": { + "name": "exports_tenant_id_tenants_id_fk", + "tableFrom": "exports", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.globalmessages": { + "name": "globalmessages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "globalmessages_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.globalmessagesseen": { + "name": "globalmessagesseen", + "schema": "", + "columns": { + "message": { + "name": "message", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "seen_at": { + "name": "seen_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "globalmessagesseen_message_globalmessages_id_fk": { + "name": "globalmessagesseen_message_globalmessages_id_fk", + "tableFrom": "globalmessagesseen", + "tableTo": "globalmessages", + "columnsFrom": [ + "message" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.helpdesk_channel_instances": { + "name": "helpdesk_channel_instances", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "type_id": { + "name": "type_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "public_config": { + "name": "public_config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "public_token": { + "name": "public_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "secret_token": { + "name": "secret_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "helpdesk_channel_instances_tenant_id_tenants_id_fk": { + "name": "helpdesk_channel_instances_tenant_id_tenants_id_fk", + "tableFrom": "helpdesk_channel_instances", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "helpdesk_channel_instances_type_id_helpdesk_channel_types_id_fk": { + "name": "helpdesk_channel_instances_type_id_helpdesk_channel_types_id_fk", + "tableFrom": "helpdesk_channel_instances", + "tableTo": "helpdesk_channel_types", + "columnsFrom": [ + "type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "helpdesk_channel_instances_created_by_auth_users_id_fk": { + "name": "helpdesk_channel_instances_created_by_auth_users_id_fk", + "tableFrom": "helpdesk_channel_instances", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "helpdesk_channel_instances_public_token_unique": { + "name": "helpdesk_channel_instances_public_token_unique", + "nullsNotDistinct": false, + "columns": [ + "public_token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.helpdesk_channel_types": { + "name": "helpdesk_channel_types", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.helpdesk_contacts": { + "name": "helpdesk_contacts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "customer_id": { + "name": "customer_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "external_ref": { + "name": "external_ref", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "source_channel_id": { + "name": "source_channel_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "contact_id": { + "name": "contact_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "helpdesk_contacts_tenant_id_tenants_id_fk": { + "name": "helpdesk_contacts_tenant_id_tenants_id_fk", + "tableFrom": "helpdesk_contacts", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "helpdesk_contacts_customer_id_customers_id_fk": { + "name": "helpdesk_contacts_customer_id_customers_id_fk", + "tableFrom": "helpdesk_contacts", + "tableTo": "customers", + "columnsFrom": [ + "customer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "helpdesk_contacts_source_channel_id_helpdesk_channel_instances_id_fk": { + "name": "helpdesk_contacts_source_channel_id_helpdesk_channel_instances_id_fk", + "tableFrom": "helpdesk_contacts", + "tableTo": "helpdesk_channel_instances", + "columnsFrom": [ + "source_channel_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "helpdesk_contacts_contact_id_contacts_id_fk": { + "name": "helpdesk_contacts_contact_id_contacts_id_fk", + "tableFrom": "helpdesk_contacts", + "tableTo": "contacts", + "columnsFrom": [ + "contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.helpdesk_conversation_participants": { + "name": "helpdesk_conversation_participants", + "schema": "", + "columns": { + "conversation_id": { + "name": "conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "helpdesk_conversation_participants_conversation_id_helpdesk_conversations_id_fk": { + "name": "helpdesk_conversation_participants_conversation_id_helpdesk_conversations_id_fk", + "tableFrom": "helpdesk_conversation_participants", + "tableTo": "helpdesk_conversations", + "columnsFrom": [ + "conversation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "helpdesk_conversation_participants_user_id_auth_users_id_fk": { + "name": "helpdesk_conversation_participants_user_id_auth_users_id_fk", + "tableFrom": "helpdesk_conversation_participants", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.helpdesk_conversations": { + "name": "helpdesk_conversations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "channel_instance_id": { + "name": "channel_instance_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "contact_id": { + "name": "contact_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "subject": { + "name": "subject", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'open'" + }, + "priority": { + "name": "priority", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'normal'" + }, + "assignee_user_id": { + "name": "assignee_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "last_message_at": { + "name": "last_message_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "customer_id": { + "name": "customer_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "contact_person_id": { + "name": "contact_person_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "ticket_number": { + "name": "ticket_number", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "helpdesk_conversations_tenant_id_tenants_id_fk": { + "name": "helpdesk_conversations_tenant_id_tenants_id_fk", + "tableFrom": "helpdesk_conversations", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "helpdesk_conversations_channel_instance_id_helpdesk_channel_instances_id_fk": { + "name": "helpdesk_conversations_channel_instance_id_helpdesk_channel_instances_id_fk", + "tableFrom": "helpdesk_conversations", + "tableTo": "helpdesk_channel_instances", + "columnsFrom": [ + "channel_instance_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "helpdesk_conversations_contact_id_helpdesk_contacts_id_fk": { + "name": "helpdesk_conversations_contact_id_helpdesk_contacts_id_fk", + "tableFrom": "helpdesk_conversations", + "tableTo": "helpdesk_contacts", + "columnsFrom": [ + "contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "helpdesk_conversations_assignee_user_id_auth_users_id_fk": { + "name": "helpdesk_conversations_assignee_user_id_auth_users_id_fk", + "tableFrom": "helpdesk_conversations", + "tableTo": "auth_users", + "columnsFrom": [ + "assignee_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "helpdesk_conversations_customer_id_customers_id_fk": { + "name": "helpdesk_conversations_customer_id_customers_id_fk", + "tableFrom": "helpdesk_conversations", + "tableTo": "customers", + "columnsFrom": [ + "customer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "helpdesk_conversations_contact_person_id_contacts_id_fk": { + "name": "helpdesk_conversations_contact_person_id_contacts_id_fk", + "tableFrom": "helpdesk_conversations", + "tableTo": "contacts", + "columnsFrom": [ + "contact_person_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.helpdesk_messages": { + "name": "helpdesk_messages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "conversation_id": { + "name": "conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "direction": { + "name": "direction", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "author_user_id": { + "name": "author_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "payload": { + "name": "payload", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "raw_meta": { + "name": "raw_meta", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "contact_id": { + "name": "contact_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "external_message_id": { + "name": "external_message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "received_at": { + "name": "received_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "helpdesk_messages_tenant_id_tenants_id_fk": { + "name": "helpdesk_messages_tenant_id_tenants_id_fk", + "tableFrom": "helpdesk_messages", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "helpdesk_messages_conversation_id_helpdesk_conversations_id_fk": { + "name": "helpdesk_messages_conversation_id_helpdesk_conversations_id_fk", + "tableFrom": "helpdesk_messages", + "tableTo": "helpdesk_conversations", + "columnsFrom": [ + "conversation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "helpdesk_messages_author_user_id_auth_users_id_fk": { + "name": "helpdesk_messages_author_user_id_auth_users_id_fk", + "tableFrom": "helpdesk_messages", + "tableTo": "auth_users", + "columnsFrom": [ + "author_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "helpdesk_messages_contact_id_helpdesk_contacts_id_fk": { + "name": "helpdesk_messages_contact_id_helpdesk_contacts_id_fk", + "tableFrom": "helpdesk_messages", + "tableTo": "helpdesk_contacts", + "columnsFrom": [ + "contact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "helpdesk_messages_external_message_id_unique": { + "name": "helpdesk_messages_external_message_id_unique", + "nullsNotDistinct": false, + "columns": [ + "external_message_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.helpdesk_routing_rules": { + "name": "helpdesk_routing_rules", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "condition": { + "name": "condition", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "helpdesk_routing_rules_tenant_id_tenants_id_fk": { + "name": "helpdesk_routing_rules_tenant_id_tenants_id_fk", + "tableFrom": "helpdesk_routing_rules", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "helpdesk_routing_rules_created_by_auth_users_id_fk": { + "name": "helpdesk_routing_rules_created_by_auth_users_id_fk", + "tableFrom": "helpdesk_routing_rules", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.historyitems": { + "name": "historyitems", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "historyitems_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "vendor": { + "name": "vendor", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "project": { + "name": "project", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "plant": { + "name": "plant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "incomingInvoice": { + "name": "incomingInvoice", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "contact": { + "name": "contact", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "inventoryitem": { + "name": "inventoryitem", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "product": { + "name": "product", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "event": { + "name": "event", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "newVal": { + "name": "newVal", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "oldVal": { + "name": "oldVal", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "task": { + "name": "task", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "vehicle": { + "name": "vehicle", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "bankstatement": { + "name": "bankstatement", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "space": { + "name": "space", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "projecttype": { + "name": "projecttype", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "check": { + "name": "check", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "service": { + "name": "service", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "createddocument": { + "name": "createddocument", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "file": { + "name": "file", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "inventoryitemgroup": { + "name": "inventoryitemgroup", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'Software'" + }, + "costcentre": { + "name": "costcentre", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "ownaccount": { + "name": "ownaccount", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "documentbox": { + "name": "documentbox", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "hourrate": { + "name": "hourrate", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "historyitems_customer_customers_id_fk": { + "name": "historyitems_customer_customers_id_fk", + "tableFrom": "historyitems", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "historyitems_tenant_tenants_id_fk": { + "name": "historyitems_tenant_tenants_id_fk", + "tableFrom": "historyitems", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_vendor_vendors_id_fk": { + "name": "historyitems_vendor_vendors_id_fk", + "tableFrom": "historyitems", + "tableTo": "vendors", + "columnsFrom": [ + "vendor" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_project_projects_id_fk": { + "name": "historyitems_project_projects_id_fk", + "tableFrom": "historyitems", + "tableTo": "projects", + "columnsFrom": [ + "project" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "historyitems_plant_plants_id_fk": { + "name": "historyitems_plant_plants_id_fk", + "tableFrom": "historyitems", + "tableTo": "plants", + "columnsFrom": [ + "plant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "historyitems_incomingInvoice_incominginvoices_id_fk": { + "name": "historyitems_incomingInvoice_incominginvoices_id_fk", + "tableFrom": "historyitems", + "tableTo": "incominginvoices", + "columnsFrom": [ + "incomingInvoice" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "historyitems_contact_contacts_id_fk": { + "name": "historyitems_contact_contacts_id_fk", + "tableFrom": "historyitems", + "tableTo": "contacts", + "columnsFrom": [ + "contact" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "historyitems_inventoryitem_inventoryitems_id_fk": { + "name": "historyitems_inventoryitem_inventoryitems_id_fk", + "tableFrom": "historyitems", + "tableTo": "inventoryitems", + "columnsFrom": [ + "inventoryitem" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "historyitems_product_products_id_fk": { + "name": "historyitems_product_products_id_fk", + "tableFrom": "historyitems", + "tableTo": "products", + "columnsFrom": [ + "product" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "historyitems_event_events_id_fk": { + "name": "historyitems_event_events_id_fk", + "tableFrom": "historyitems", + "tableTo": "events", + "columnsFrom": [ + "event" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_task_tasks_id_fk": { + "name": "historyitems_task_tasks_id_fk", + "tableFrom": "historyitems", + "tableTo": "tasks", + "columnsFrom": [ + "task" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_vehicle_vehicles_id_fk": { + "name": "historyitems_vehicle_vehicles_id_fk", + "tableFrom": "historyitems", + "tableTo": "vehicles", + "columnsFrom": [ + "vehicle" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_bankstatement_bankstatements_id_fk": { + "name": "historyitems_bankstatement_bankstatements_id_fk", + "tableFrom": "historyitems", + "tableTo": "bankstatements", + "columnsFrom": [ + "bankstatement" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_space_spaces_id_fk": { + "name": "historyitems_space_spaces_id_fk", + "tableFrom": "historyitems", + "tableTo": "spaces", + "columnsFrom": [ + "space" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_projecttype_projecttypes_id_fk": { + "name": "historyitems_projecttype_projecttypes_id_fk", + "tableFrom": "historyitems", + "tableTo": "projecttypes", + "columnsFrom": [ + "projecttype" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_check_checks_id_fk": { + "name": "historyitems_check_checks_id_fk", + "tableFrom": "historyitems", + "tableTo": "checks", + "columnsFrom": [ + "check" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_service_services_id_fk": { + "name": "historyitems_service_services_id_fk", + "tableFrom": "historyitems", + "tableTo": "services", + "columnsFrom": [ + "service" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_createddocument_createddocuments_id_fk": { + "name": "historyitems_createddocument_createddocuments_id_fk", + "tableFrom": "historyitems", + "tableTo": "createddocuments", + "columnsFrom": [ + "createddocument" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_file_files_id_fk": { + "name": "historyitems_file_files_id_fk", + "tableFrom": "historyitems", + "tableTo": "files", + "columnsFrom": [ + "file" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_inventoryitemgroup_inventoryitemgroups_id_fk": { + "name": "historyitems_inventoryitemgroup_inventoryitemgroups_id_fk", + "tableFrom": "historyitems", + "tableTo": "inventoryitemgroups", + "columnsFrom": [ + "inventoryitemgroup" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_costcentre_costcentres_id_fk": { + "name": "historyitems_costcentre_costcentres_id_fk", + "tableFrom": "historyitems", + "tableTo": "costcentres", + "columnsFrom": [ + "costcentre" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_ownaccount_ownaccounts_id_fk": { + "name": "historyitems_ownaccount_ownaccounts_id_fk", + "tableFrom": "historyitems", + "tableTo": "ownaccounts", + "columnsFrom": [ + "ownaccount" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_documentbox_documentboxes_id_fk": { + "name": "historyitems_documentbox_documentboxes_id_fk", + "tableFrom": "historyitems", + "tableTo": "documentboxes", + "columnsFrom": [ + "documentbox" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_hourrate_hourrates_id_fk": { + "name": "historyitems_hourrate_hourrates_id_fk", + "tableFrom": "historyitems", + "tableTo": "hourrates", + "columnsFrom": [ + "hourrate" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_created_by_auth_users_id_fk": { + "name": "historyitems_created_by_auth_users_id_fk", + "tableFrom": "historyitems", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.holidays": { + "name": "holidays", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "holidays_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "date": { + "name": "date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "state_code": { + "name": "state_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.hourrates": { + "name": "hourrates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "purchasePrice": { + "name": "purchasePrice", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "sellingPrice": { + "name": "sellingPrice", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "hourrates_tenant_tenants_id_fk": { + "name": "hourrates_tenant_tenants_id_fk", + "tableFrom": "hourrates", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "hourrates_updated_by_auth_users_id_fk": { + "name": "hourrates_updated_by_auth_users_id_fk", + "tableFrom": "hourrates", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incominginvoices": { + "name": "incominginvoices", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "incominginvoices_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'Entwurf'" + }, + "vendor": { + "name": "vendor", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "reference": { + "name": "reference", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "document": { + "name": "document", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "dueDate": { + "name": "dueDate", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "paymentType": { + "name": "paymentType", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "accounts": { + "name": "accounts", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[{\"account\":null,\"taxType\":null,\"amountNet\":null,\"amountTax\":19,\"costCentre\":null}]'::jsonb" + }, + "paid": { + "name": "paid", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "expense": { + "name": "expense", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "incominginvoices_tenant_tenants_id_fk": { + "name": "incominginvoices_tenant_tenants_id_fk", + "tableFrom": "incominginvoices", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "incominginvoices_vendor_vendors_id_fk": { + "name": "incominginvoices_vendor_vendors_id_fk", + "tableFrom": "incominginvoices", + "tableTo": "vendors", + "columnsFrom": [ + "vendor" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "incominginvoices_updated_by_auth_users_id_fk": { + "name": "incominginvoices_updated_by_auth_users_id_fk", + "tableFrom": "incominginvoices", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.inventoryitemgroups": { + "name": "inventoryitemgroups", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "inventoryitems": { + "name": "inventoryitems", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "usePlanning": { + "name": "usePlanning", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "inventoryitemgroups_tenant_tenants_id_fk": { + "name": "inventoryitemgroups_tenant_tenants_id_fk", + "tableFrom": "inventoryitemgroups", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "inventoryitemgroups_updated_by_auth_users_id_fk": { + "name": "inventoryitemgroups_updated_by_auth_users_id_fk", + "tableFrom": "inventoryitemgroups", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.inventoryitems": { + "name": "inventoryitems", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "inventoryitems_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "usePlanning": { + "name": "usePlanning", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "currentSpace": { + "name": "currentSpace", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "articleNumber": { + "name": "articleNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "serialNumber": { + "name": "serialNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "purchaseDate": { + "name": "purchaseDate", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "vendor": { + "name": "vendor", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "purchasePrice": { + "name": "purchasePrice", + "type": "double precision", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "manufacturer": { + "name": "manufacturer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "manufacturerNumber": { + "name": "manufacturerNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "currentValue": { + "name": "currentValue", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "inventoryitems_tenant_tenants_id_fk": { + "name": "inventoryitems_tenant_tenants_id_fk", + "tableFrom": "inventoryitems", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "inventoryitems_currentSpace_spaces_id_fk": { + "name": "inventoryitems_currentSpace_spaces_id_fk", + "tableFrom": "inventoryitems", + "tableTo": "spaces", + "columnsFrom": [ + "currentSpace" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "inventoryitems_vendor_vendors_id_fk": { + "name": "inventoryitems_vendor_vendors_id_fk", + "tableFrom": "inventoryitems", + "tableTo": "vendors", + "columnsFrom": [ + "vendor" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "inventoryitems_updated_by_auth_users_id_fk": { + "name": "inventoryitems_updated_by_auth_users_id_fk", + "tableFrom": "inventoryitems", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.letterheads": { + "name": "letterheads", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "letterheads_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'Standard'" + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "documentTypes": { + "name": "documentTypes", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "letterheads_tenant_tenants_id_fk": { + "name": "letterheads_tenant_tenants_id_fk", + "tableFrom": "letterheads", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "letterheads_updated_by_auth_users_id_fk": { + "name": "letterheads_updated_by_auth_users_id_fk", + "tableFrom": "letterheads", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.movements": { + "name": "movements", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "movements_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "quantity": { + "name": "quantity", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "productId": { + "name": "productId", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "spaceId": { + "name": "spaceId", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "projectId": { + "name": "projectId", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "serials": { + "name": "serials", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "movements_productId_products_id_fk": { + "name": "movements_productId_products_id_fk", + "tableFrom": "movements", + "tableTo": "products", + "columnsFrom": [ + "productId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "movements_spaceId_spaces_id_fk": { + "name": "movements_spaceId_spaces_id_fk", + "tableFrom": "movements", + "tableTo": "spaces", + "columnsFrom": [ + "spaceId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "movements_tenant_tenants_id_fk": { + "name": "movements_tenant_tenants_id_fk", + "tableFrom": "movements", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "movements_projectId_projects_id_fk": { + "name": "movements_projectId_projects_id_fk", + "tableFrom": "movements", + "tableTo": "projects", + "columnsFrom": [ + "projectId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "movements_updated_by_auth_users_id_fk": { + "name": "movements_updated_by_auth_users_id_fk", + "tableFrom": "movements", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.notifications_event_types": { + "name": "notifications_event_types", + "schema": "", + "columns": { + "event_key": { + "name": "event_key", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "category": { + "name": "category", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "severity": { + "name": "severity", + "type": "notification_severity", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'info'" + }, + "allowed_channels": { + "name": "allowed_channels", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[\"inapp\",\"email\"]'::jsonb" + }, + "payload_schema": { + "name": "payload_schema", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.notifications_items": { + "name": "notifications_items", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "payload": { + "name": "payload", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "channel": { + "name": "channel", + "type": "notification_channel", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "notification_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'queued'" + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "sent_at": { + "name": "sent_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "read_at": { + "name": "read_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "notifications_items_tenant_id_tenants_id_fk": { + "name": "notifications_items_tenant_id_tenants_id_fk", + "tableFrom": "notifications_items", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "notifications_items_user_id_auth_users_id_fk": { + "name": "notifications_items_user_id_auth_users_id_fk", + "tableFrom": "notifications_items", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "notifications_items_event_type_notifications_event_types_event_key_fk": { + "name": "notifications_items_event_type_notifications_event_types_event_key_fk", + "tableFrom": "notifications_items", + "tableTo": "notifications_event_types", + "columnsFrom": [ + "event_type" + ], + "columnsTo": [ + "event_key" + ], + "onDelete": "restrict", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.notifications_preferences": { + "name": "notifications_preferences", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "channel": { + "name": "channel", + "type": "notification_channel", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "notifications_preferences_tenant_id_user_id_event_type_chan_key": { + "name": "notifications_preferences_tenant_id_user_id_event_type_chan_key", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "event_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "channel", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "notifications_preferences_tenant_id_tenants_id_fk": { + "name": "notifications_preferences_tenant_id_tenants_id_fk", + "tableFrom": "notifications_preferences", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "notifications_preferences_user_id_auth_users_id_fk": { + "name": "notifications_preferences_user_id_auth_users_id_fk", + "tableFrom": "notifications_preferences", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "notifications_preferences_event_type_notifications_event_types_event_key_fk": { + "name": "notifications_preferences_event_type_notifications_event_types_event_key_fk", + "tableFrom": "notifications_preferences", + "tableTo": "notifications_event_types", + "columnsFrom": [ + "event_type" + ], + "columnsTo": [ + "event_key" + ], + "onDelete": "restrict", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.notifications_preferences_defaults": { + "name": "notifications_preferences_defaults", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "event_key": { + "name": "event_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "channel": { + "name": "channel", + "type": "notification_channel", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "notifications_preferences_defau_tenant_id_event_key_channel_key": { + "name": "notifications_preferences_defau_tenant_id_event_key_channel_key", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "event_key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "channel", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "notifications_preferences_defaults_tenant_id_tenants_id_fk": { + "name": "notifications_preferences_defaults_tenant_id_tenants_id_fk", + "tableFrom": "notifications_preferences_defaults", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "notifications_preferences_defaults_event_key_notifications_event_types_event_key_fk": { + "name": "notifications_preferences_defaults_event_key_notifications_event_types_event_key_fk", + "tableFrom": "notifications_preferences_defaults", + "tableTo": "notifications_event_types", + "columnsFrom": [ + "event_key" + ], + "columnsTo": [ + "event_key" + ], + "onDelete": "restrict", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ownaccounts": { + "name": "ownaccounts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "number": { + "name": "number", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "ownaccounts_tenant_tenants_id_fk": { + "name": "ownaccounts_tenant_tenants_id_fk", + "tableFrom": "ownaccounts", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "ownaccounts_updated_by_auth_users_id_fk": { + "name": "ownaccounts_updated_by_auth_users_id_fk", + "tableFrom": "ownaccounts", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.plants": { + "name": "plants", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "plants_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "infoData": { + "name": "infoData", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "contract": { + "name": "contract", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{\"html\":\"\",\"json\":[],\"text\":\"\"}'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "plants_tenant_tenants_id_fk": { + "name": "plants_tenant_tenants_id_fk", + "tableFrom": "plants", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "plants_customer_customers_id_fk": { + "name": "plants_customer_customers_id_fk", + "tableFrom": "plants", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "plants_contract_contracts_id_fk": { + "name": "plants_contract_contracts_id_fk", + "tableFrom": "plants", + "tableTo": "contracts", + "columnsFrom": [ + "contract" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "plants_updated_by_auth_users_id_fk": { + "name": "plants_updated_by_auth_users_id_fk", + "tableFrom": "plants", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.productcategories": { + "name": "productcategories", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "productcategories_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "productcategories_tenant_tenants_id_fk": { + "name": "productcategories_tenant_tenants_id_fk", + "tableFrom": "productcategories", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "productcategories_updated_by_auth_users_id_fk": { + "name": "productcategories_updated_by_auth_users_id_fk", + "tableFrom": "productcategories", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.products": { + "name": "products", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "products_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "manufacturer": { + "name": "manufacturer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "unit": { + "name": "unit", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "tags": { + "name": "tags", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'[]'::json" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "ean": { + "name": "ean", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "barcode": { + "name": "barcode", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "purchasePrice": { + "name": "purchasePrice", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "sellingPrice": { + "name": "sellingPrice", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "manufacturerNumber": { + "name": "manufacturerNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vendorAllocation": { + "name": "vendorAllocation", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "articleNumber": { + "name": "articleNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "barcodes": { + "name": "barcodes", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "productcategories": { + "name": "productcategories", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "taxPercentage": { + "name": "taxPercentage", + "type": "smallint", + "primaryKey": false, + "notNull": true, + "default": 19 + }, + "markupPercentage": { + "name": "markupPercentage", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "products_unit_units_id_fk": { + "name": "products_unit_units_id_fk", + "tableFrom": "products", + "tableTo": "units", + "columnsFrom": [ + "unit" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "products_tenant_tenants_id_fk": { + "name": "products_tenant_tenants_id_fk", + "tableFrom": "products", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "products_updated_by_auth_users_id_fk": { + "name": "products_updated_by_auth_users_id_fk", + "tableFrom": "products", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "projects_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "phases": { + "name": "phases", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "description": { + "name": "description", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "forms": { + "name": "forms", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "heroId": { + "name": "heroId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "measure": { + "name": "measure", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "material": { + "name": "material", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "plant": { + "name": "plant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "profiles": { + "name": "profiles", + "type": "uuid[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "projectNumber": { + "name": "projectNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contract": { + "name": "contract", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "projectType": { + "name": "projectType", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'Projekt'" + }, + "projecttype": { + "name": "projecttype", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "customerRef": { + "name": "customerRef", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "active_phase": { + "name": "active_phase", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "projects_tenant_tenants_id_fk": { + "name": "projects_tenant_tenants_id_fk", + "tableFrom": "projects", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "projects_customer_customers_id_fk": { + "name": "projects_customer_customers_id_fk", + "tableFrom": "projects", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "projects_contract_contracts_id_fk": { + "name": "projects_contract_contracts_id_fk", + "tableFrom": "projects", + "tableTo": "contracts", + "columnsFrom": [ + "contract" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "projects_projecttype_projecttypes_id_fk": { + "name": "projects_projecttype_projecttypes_id_fk", + "tableFrom": "projects", + "tableTo": "projecttypes", + "columnsFrom": [ + "projecttype" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "projects_updated_by_auth_users_id_fk": { + "name": "projects_updated_by_auth_users_id_fk", + "tableFrom": "projects", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projecttypes": { + "name": "projecttypes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "projecttypes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "initialPhases": { + "name": "initialPhases", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "addablePhases": { + "name": "addablePhases", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "projecttypes_tenant_tenants_id_fk": { + "name": "projecttypes_tenant_tenants_id_fk", + "tableFrom": "projecttypes", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "projecttypes_updated_by_auth_users_id_fk": { + "name": "projecttypes_updated_by_auth_users_id_fk", + "tableFrom": "projecttypes", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.servicecategories": { + "name": "servicecategories", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "servicecategories_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "discount": { + "name": "discount", + "type": "double precision", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "servicecategories_tenant_tenants_id_fk": { + "name": "servicecategories_tenant_tenants_id_fk", + "tableFrom": "servicecategories", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "servicecategories_updated_by_auth_users_id_fk": { + "name": "servicecategories_updated_by_auth_users_id_fk", + "tableFrom": "servicecategories", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.services": { + "name": "services", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "services_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sellingPrice": { + "name": "sellingPrice", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "unit": { + "name": "unit", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "serviceNumber": { + "name": "serviceNumber", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "tags": { + "name": "tags", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "servicecategories": { + "name": "servicecategories", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "purchasePriceComposed": { + "name": "purchasePriceComposed", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{\"total\":0}'::jsonb" + }, + "sellingPriceComposed": { + "name": "sellingPriceComposed", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{\"total\":0}'::jsonb" + }, + "taxPercentage": { + "name": "taxPercentage", + "type": "smallint", + "primaryKey": false, + "notNull": true, + "default": 19 + }, + "materialComposition": { + "name": "materialComposition", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "personalComposition": { + "name": "personalComposition", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "services_tenant_tenants_id_fk": { + "name": "services_tenant_tenants_id_fk", + "tableFrom": "services", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "services_unit_units_id_fk": { + "name": "services_unit_units_id_fk", + "tableFrom": "services", + "tableTo": "units", + "columnsFrom": [ + "unit" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "services_updated_by_auth_users_id_fk": { + "name": "services_updated_by_auth_users_id_fk", + "tableFrom": "services", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.spaces": { + "name": "spaces", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "spaces_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "spaceNumber": { + "name": "spaceNumber", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parentSpace": { + "name": "parentSpace", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "infoData": { + "name": "infoData", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{\"zip\":\"\",\"city\":\"\",\"streetNumber\":\"\"}'::jsonb" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "spaces_tenant_tenants_id_fk": { + "name": "spaces_tenant_tenants_id_fk", + "tableFrom": "spaces", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "spaces_parentSpace_spaces_id_fk": { + "name": "spaces_parentSpace_spaces_id_fk", + "tableFrom": "spaces", + "tableTo": "spaces", + "columnsFrom": [ + "parentSpace" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "spaces_updated_by_auth_users_id_fk": { + "name": "spaces_updated_by_auth_users_id_fk", + "tableFrom": "spaces", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.staff_time_entries": { + "name": "staff_time_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "stopped_at": { + "name": "stopped_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "duration_minutes": { + "name": "duration_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "generated": { + "as": "CASE \n WHEN stopped_at IS NOT NULL \n THEN (EXTRACT(epoch FROM (stopped_at - started_at)) / 60)\n ELSE NULL\n END", + "type": "stored" + } + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'work'" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "times_state", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'draft'" + }, + "device": { + "name": "device", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "internal_note": { + "name": "internal_note", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vacation_reason": { + "name": "vacation_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vacation_days": { + "name": "vacation_days", + "type": "numeric(5, 2)", + "primaryKey": false, + "notNull": false + }, + "approved_by": { + "name": "approved_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "sick_reason": { + "name": "sick_reason", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "staff_time_entries_tenant_id_tenants_id_fk": { + "name": "staff_time_entries_tenant_id_tenants_id_fk", + "tableFrom": "staff_time_entries", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "staff_time_entries_user_id_auth_users_id_fk": { + "name": "staff_time_entries_user_id_auth_users_id_fk", + "tableFrom": "staff_time_entries", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "staff_time_entries_updated_by_auth_users_id_fk": { + "name": "staff_time_entries_updated_by_auth_users_id_fk", + "tableFrom": "staff_time_entries", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "staff_time_entries_approved_by_auth_users_id_fk": { + "name": "staff_time_entries_approved_by_auth_users_id_fk", + "tableFrom": "staff_time_entries", + "tableTo": "auth_users", + "columnsFrom": [ + "approved_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.staff_time_entry_connects": { + "name": "staff_time_entry_connects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "time_entry_id": { + "name": "time_entry_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "stopped_at": { + "name": "stopped_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "duration_minutes": { + "name": "duration_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "generated": { + "as": "(EXTRACT(epoch FROM (stopped_at - started_at)) / 60)", + "type": "stored" + } + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "staff_time_entry_connects_time_entry_id_staff_time_entries_id_fk": { + "name": "staff_time_entry_connects_time_entry_id_staff_time_entries_id_fk", + "tableFrom": "staff_time_entry_connects", + "tableTo": "staff_time_entries", + "columnsFrom": [ + "time_entry_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.staff_zeitstromtimestamps": { + "name": "staff_zeitstromtimestamps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "profile": { + "name": "profile", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "intent": { + "name": "intent", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "time": { + "name": "time", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "staff_time_entry": { + "name": "staff_time_entry", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "internal_note": { + "name": "internal_note", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "staff_zeitstromtimestamps_tenant_tenants_id_fk": { + "name": "staff_zeitstromtimestamps_tenant_tenants_id_fk", + "tableFrom": "staff_zeitstromtimestamps", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "staff_zeitstromtimestamps_profile_auth_profiles_id_fk": { + "name": "staff_zeitstromtimestamps_profile_auth_profiles_id_fk", + "tableFrom": "staff_zeitstromtimestamps", + "tableTo": "auth_profiles", + "columnsFrom": [ + "profile" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "staff_zeitstromtimestamps_staff_time_entry_staff_time_entries_id_fk": { + "name": "staff_zeitstromtimestamps_staff_time_entry_staff_time_entries_id_fk", + "tableFrom": "staff_zeitstromtimestamps", + "tableTo": "staff_time_entries", + "columnsFrom": [ + "staff_time_entry" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.statementallocations": { + "name": "statementallocations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "bs_id": { + "name": "bs_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "cd_id": { + "name": "cd_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "amount": { + "name": "amount", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "ii_id": { + "name": "ii_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "account": { + "name": "account", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "ownaccount": { + "name": "ownaccount", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "vendor": { + "name": "vendor", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "statementallocations_bs_id_bankstatements_id_fk": { + "name": "statementallocations_bs_id_bankstatements_id_fk", + "tableFrom": "statementallocations", + "tableTo": "bankstatements", + "columnsFrom": [ + "bs_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "statementallocations_cd_id_createddocuments_id_fk": { + "name": "statementallocations_cd_id_createddocuments_id_fk", + "tableFrom": "statementallocations", + "tableTo": "createddocuments", + "columnsFrom": [ + "cd_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "statementallocations_ii_id_incominginvoices_id_fk": { + "name": "statementallocations_ii_id_incominginvoices_id_fk", + "tableFrom": "statementallocations", + "tableTo": "incominginvoices", + "columnsFrom": [ + "ii_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "statementallocations_tenant_tenants_id_fk": { + "name": "statementallocations_tenant_tenants_id_fk", + "tableFrom": "statementallocations", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "statementallocations_account_accounts_id_fk": { + "name": "statementallocations_account_accounts_id_fk", + "tableFrom": "statementallocations", + "tableTo": "accounts", + "columnsFrom": [ + "account" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "statementallocations_ownaccount_ownaccounts_id_fk": { + "name": "statementallocations_ownaccount_ownaccounts_id_fk", + "tableFrom": "statementallocations", + "tableTo": "ownaccounts", + "columnsFrom": [ + "ownaccount" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "statementallocations_customer_customers_id_fk": { + "name": "statementallocations_customer_customers_id_fk", + "tableFrom": "statementallocations", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "statementallocations_vendor_vendors_id_fk": { + "name": "statementallocations_vendor_vendors_id_fk", + "tableFrom": "statementallocations", + "tableTo": "vendors", + "columnsFrom": [ + "vendor" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "statementallocations_updated_by_auth_users_id_fk": { + "name": "statementallocations_updated_by_auth_users_id_fk", + "tableFrom": "statementallocations", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "tasks_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "categorie": { + "name": "categorie", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "project": { + "name": "project", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "plant": { + "name": "plant", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tasks_tenant_tenants_id_fk": { + "name": "tasks_tenant_tenants_id_fk", + "tableFrom": "tasks", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "tasks_user_id_auth_users_id_fk": { + "name": "tasks_user_id_auth_users_id_fk", + "tableFrom": "tasks", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "tasks_customer_customers_id_fk": { + "name": "tasks_customer_customers_id_fk", + "tableFrom": "tasks", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "tasks_updated_by_auth_users_id_fk": { + "name": "tasks_updated_by_auth_users_id_fk", + "tableFrom": "tasks", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.taxtypes": { + "name": "taxtypes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "taxtypes_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "percentage": { + "name": "percentage", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "taxtypes_updated_by_auth_users_id_fk": { + "name": "taxtypes_updated_by_auth_users_id_fk", + "tableFrom": "taxtypes", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tenants": { + "name": "tenants", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "tenants_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "short": { + "name": "short", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "calendarConfig": { + "name": "calendarConfig", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{\"eventTypes\":[{\"color\":\"blue\",\"label\":\"Büro\"},{\"color\":\"yellow\",\"label\":\"Besprechung\"},{\"color\":\"green\",\"label\":\"Umsetzung\"},{\"color\":\"red\",\"label\":\"Vor Ort Termin\"}]}'::jsonb" + }, + "timeConfig": { + "name": "timeConfig", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "tags": { + "name": "tags", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{\"products\":[],\"documents\":[]}'::jsonb" + }, + "measures": { + "name": "measures", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[{\"name\":\"Netzwerktechnik\",\"short\":\"NWT\"},{\"name\":\"Elektrotechnik\",\"short\":\"ELT\"},{\"name\":\"Photovoltaik\",\"short\":\"PV\"},{\"name\":\"Videüberwachung\",\"short\":\"VÜA\"},{\"name\":\"Projekt\",\"short\":\"PRJ\"},{\"name\":\"Smart Home\",\"short\":\"SHO\"}]'::jsonb" + }, + "businessInfo": { + "name": "businessInfo", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{\"zip\":\"\",\"city\":\"\",\"name\":\"\",\"street\":\"\"}'::jsonb" + }, + "features": { + "name": "features", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{\"objects\":true,\"calendar\":true,\"contacts\":true,\"projects\":true,\"vehicles\":true,\"contracts\":true,\"inventory\":true,\"accounting\":true,\"timeTracking\":true,\"planningBoard\":true,\"workingTimeTracking\":true}'::jsonb" + }, + "ownFields": { + "name": "ownFields", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "numberRanges": { + "name": "numberRanges", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{\"vendors\":{\"prefix\":\"\",\"suffix\":\"\",\"nextNumber\":10000},\"customers\":{\"prefix\":\"\",\"suffix\":\"\",\"nextNumber\":10000},\"products\":{\"prefix\":\"AT-\",\"suffix\":\"\",\"nextNumber\":1000},\"quotes\":{\"prefix\":\"AN-\",\"suffix\":\"\",\"nextNumber\":1000},\"confirmationOrders\":{\"prefix\":\"AB-\",\"suffix\":\"\",\"nextNumber\":1000},\"invoices\":{\"prefix\":\"RE-\",\"suffix\":\"\",\"nextNumber\":1000},\"spaces\":{\"prefix\":\"LP-\",\"suffix\":\"\",\"nextNumber\":1000},\"inventoryitems\":{\"prefix\":\"IA-\",\"suffix\":\"\",\"nextNumber\":1000},\"projects\":{\"prefix\":\"PRJ-\",\"suffix\":\"\",\"nextNumber\":1000},\"costcentres\":{\"prefix\":\"KST-\",\"suffix\":\"\",\"nextNumber\":1000}}'::jsonb" + }, + "standardEmailForInvoices": { + "name": "standardEmailForInvoices", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "extraModules": { + "name": "extraModules", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "isInTrial": { + "name": "isInTrial", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "trialEndDate": { + "name": "trialEndDate", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "stripeCustomerId": { + "name": "stripeCustomerId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hasActiveLicense": { + "name": "hasActiveLicense", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "userLicenseCount": { + "name": "userLicenseCount", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "workstationLicenseCount": { + "name": "workstationLicenseCount", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "standardPaymentDays": { + "name": "standardPaymentDays", + "type": "smallint", + "primaryKey": false, + "notNull": true, + "default": 14 + }, + "dokuboxEmailAddresses": { + "name": "dokuboxEmailAddresses", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "dokuboxkey": { + "name": "dokuboxkey", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "autoPrepareIncomingInvoices": { + "name": "autoPrepareIncomingInvoices", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "portalDomain": { + "name": "portalDomain", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "portalConfig": { + "name": "portalConfig", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{\"primayColor\":\"#69c350\"}'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "locked": { + "name": "locked", + "type": "locked_tenant", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tenants_updated_by_auth_users_id_fk": { + "name": "tenants_updated_by_auth_users_id_fk", + "tableFrom": "tenants", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.texttemplates": { + "name": "texttemplates", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "texttemplates_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "documentType": { + "name": "documentType", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "default": { + "name": "default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pos": { + "name": "pos", + "type": "texttemplatepositions", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "texttemplates_tenant_tenants_id_fk": { + "name": "texttemplates_tenant_tenants_id_fk", + "tableFrom": "texttemplates", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "texttemplates_updated_by_auth_users_id_fk": { + "name": "texttemplates_updated_by_auth_users_id_fk", + "tableFrom": "texttemplates", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.units": { + "name": "units", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "units_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "single": { + "name": "single", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "multiple": { + "name": "multiple", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "short": { + "name": "short", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "step": { + "name": "step", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'1'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_credentials": { + "name": "user_credentials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "smtp_port": { + "name": "smtp_port", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "smtp_ssl": { + "name": "smtp_ssl", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "credential_types", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "imap_port": { + "name": "imap_port", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "imap_ssl": { + "name": "imap_ssl", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "email_encrypted": { + "name": "email_encrypted", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "password_encrypted": { + "name": "password_encrypted", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "smtp_host_encrypted": { + "name": "smtp_host_encrypted", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "imap_host_encrypted": { + "name": "imap_host_encrypted", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "access_token_encrypted": { + "name": "access_token_encrypted", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "refresh_token_encrypted": { + "name": "refresh_token_encrypted", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "user_credentials_user_id_auth_users_id_fk": { + "name": "user_credentials_user_id_auth_users_id_fk", + "tableFrom": "user_credentials", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_credentials_tenant_id_tenants_id_fk": { + "name": "user_credentials_tenant_id_tenants_id_fk", + "tableFrom": "user_credentials", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vehicles": { + "name": "vehicles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "vehicles_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "licensePlate": { + "name": "licensePlate", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "driver": { + "name": "driver", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "vin": { + "name": "vin", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tankSize": { + "name": "tankSize", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "buildYear": { + "name": "buildYear", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "towingCapacity": { + "name": "towingCapacity", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "powerInKW": { + "name": "powerInKW", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vehicles_tenant_tenants_id_fk": { + "name": "vehicles_tenant_tenants_id_fk", + "tableFrom": "vehicles", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vehicles_driver_auth_users_id_fk": { + "name": "vehicles_driver_auth_users_id_fk", + "tableFrom": "vehicles", + "tableTo": "auth_users", + "columnsFrom": [ + "driver" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vehicles_updated_by_auth_users_id_fk": { + "name": "vehicles_updated_by_auth_users_id_fk", + "tableFrom": "vehicles", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.vendors": { + "name": "vendors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "vendors_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "vendorNumber": { + "name": "vendorNumber", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "infoData": { + "name": "infoData", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hasSEPA": { + "name": "hasSEPA", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "profiles": { + "name": "profiles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "defaultPaymentMethod": { + "name": "defaultPaymentMethod", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "vendors_tenant_tenants_id_fk": { + "name": "vendors_tenant_tenants_id_fk", + "tableFrom": "vendors", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "vendors_updated_by_auth_users_id_fk": { + "name": "vendors_updated_by_auth_users_id_fk", + "tableFrom": "vendors", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.time_events": { + "name": "time_events", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "actor_type": { + "name": "actor_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "actor_user_id": { + "name": "actor_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "event_time": { + "name": "event_time", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "invalidates_event_id": { + "name": "invalidates_event_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_time_events_tenant_user_time": { + "name": "idx_time_events_tenant_user_time", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "event_time", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_time_events_created_at": { + "name": "idx_time_events_created_at", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_time_events_invalidates": { + "name": "idx_time_events_invalidates", + "columns": [ + { + "expression": "invalidates_event_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "time_events_tenant_id_tenants_id_fk": { + "name": "time_events_tenant_id_tenants_id_fk", + "tableFrom": "time_events", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "time_events_user_id_auth_users_id_fk": { + "name": "time_events_user_id_auth_users_id_fk", + "tableFrom": "time_events", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "time_events_actor_user_id_auth_users_id_fk": { + "name": "time_events_actor_user_id_auth_users_id_fk", + "tableFrom": "time_events", + "tableTo": "auth_users", + "columnsFrom": [ + "actor_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "time_events_invalidates_event_id_time_events_id_fk": { + "name": "time_events_invalidates_event_id_time_events_id_fk", + "tableFrom": "time_events", + "tableTo": "time_events", + "columnsFrom": [ + "invalidates_event_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "time_events_actor_user_check": { + "name": "time_events_actor_user_check", + "value": "\n (actor_type = 'system' AND actor_user_id IS NULL)\n OR\n (actor_type = 'user' AND actor_user_id IS NOT NULL)\n " + } + }, + "isRLSEnabled": false + } + }, + "enums": { + "public.credential_types": { + "name": "credential_types", + "schema": "public", + "values": [ + "mail", + "m365" + ] + }, + "public.folderfunctions": { + "name": "folderfunctions", + "schema": "public", + "values": [ + "none", + "yearSubCategory", + "incomingInvoices", + "invoices", + "quotes", + "confirmationOrders", + "deliveryNotes", + "vehicleData", + "reminders", + "taxData", + "deposit", + "timeEvaluations" + ] + }, + "public.locked_tenant": { + "name": "locked_tenant", + "schema": "public", + "values": [ + "maintenance_tenant", + "maintenance", + "general", + "no_subscription" + ] + }, + "public.notification_channel": { + "name": "notification_channel", + "schema": "public", + "values": [ + "email", + "inapp", + "sms", + "push", + "webhook" + ] + }, + "public.notification_severity": { + "name": "notification_severity", + "schema": "public", + "values": [ + "info", + "success", + "warning", + "error" + ] + }, + "public.notification_status": { + "name": "notification_status", + "schema": "public", + "values": [ + "queued", + "sent", + "failed", + "read" + ] + }, + "public.payment_types": { + "name": "payment_types", + "schema": "public", + "values": [ + "transfer", + "direct_debit" + ] + }, + "public.texttemplatepositions": { + "name": "texttemplatepositions", + "schema": "public", + "values": [ + "startText", + "endText" + ] + }, + "public.times_state": { + "name": "times_state", + "schema": "public", + "values": [ + "submitted", + "approved", + "draft" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/db/migrations/meta/_journal.json b/db/migrations/meta/_journal.json new file mode 100644 index 0000000..25a83ac --- /dev/null +++ b/db/migrations/meta/_journal.json @@ -0,0 +1,41 @@ +{ + "version": "7", + "dialect": "postgresql", + "entries": [ + { + "idx": 0, + "version": "7", + "when": 1764947303113, + "tag": "0000_brief_dark_beast", + "breakpoints": true + }, + { + "idx": 1, + "version": "7", + "when": 1765641431341, + "tag": "0001_medical_big_bertha", + "breakpoints": true + }, + { + "idx": 2, + "version": "7", + "when": 1765642446738, + "tag": "0002_silent_christian_walker", + "breakpoints": true + }, + { + "idx": 3, + "version": "7", + "when": 1765716484200, + "tag": "0003_woozy_adam_destine", + "breakpoints": true + }, + { + "idx": 4, + "version": "7", + "when": 1765716877146, + "tag": "0004_stormy_onslaught", + "breakpoints": true + } + ] +} \ No newline at end of file