diff --git a/backend/db/index.ts b/backend/db/index.ts index 5fbbfaa..f26dfec 100644 --- a/backend/db/index.ts +++ b/backend/db/index.ts @@ -6,10 +6,16 @@ import {secrets} from "../src/utils/secrets"; console.log("[DB INIT] 1. Suche Connection String..."); +const fallbackConnectionString = "postgres://postgres:wJw7aNpEBJdcxgoct6GXNpvY4Cn6ECqu@fedeo-db-001.vpn.internal:5432/fedeo" + // Checken woher die URL kommt -let connectionString = process.env.DATABASE_URL || secrets.DATABASE_URL; -if (connectionString) { +let connectionString = process.env.DATABASE_URL || secrets.DATABASE_URL || fallbackConnectionString; +if (process.env.DATABASE_URL) { console.log("[DB INIT] -> Gefunden in process.env.DATABASE_URL"); +} else if (secrets.DATABASE_URL) { + console.log("[DB INIT] -> Gefunden in secrets.DATABASE_URL"); +} else if (connectionString) { + console.log("[DB INIT] -> Nutze Fallback aus dem Projekt"); } else { console.error("[DB INIT] ❌ KEIN CONNECTION STRING GEFUNDEN! .env nicht geladen?"); } @@ -24,4 +30,4 @@ pool.query('SELECT NOW()') .then(res => console.log(`[DB INIT] ✅ VERBINDUNG ERFOLGREICH! Zeit auf DB: ${res.rows[0].now}`)) .catch(err => console.error(`[DB INIT] ❌ VERBINDUNGSFEHLER:`, err.message)); -export const db = drizzle(pool, { schema }); \ No newline at end of file +export const db = drizzle(pool, { schema }); diff --git a/backend/db/migrations/0025_statementallocation_depreciation.sql b/backend/db/migrations/0025_statementallocation_depreciation.sql new file mode 100644 index 0000000..929f85a --- /dev/null +++ b/backend/db/migrations/0025_statementallocation_depreciation.sql @@ -0,0 +1,6 @@ +ALTER TABLE "statementallocations" +ADD COLUMN "booking_mode" text DEFAULT 'expense' NOT NULL, +ADD COLUMN "depreciation_months" integer, +ADD COLUMN "depreciation_start_date" text, +ADD COLUMN "depreciation_label" text, +ADD COLUMN "depreciation_group" text; diff --git a/backend/db/migrations/0026_statementallocation_depreciation_method.sql b/backend/db/migrations/0026_statementallocation_depreciation_method.sql new file mode 100644 index 0000000..da04133 --- /dev/null +++ b/backend/db/migrations/0026_statementallocation_depreciation_method.sql @@ -0,0 +1,3 @@ +ALTER TABLE "statementallocations" +ADD COLUMN "depreciation_method" text, +ADD COLUMN "residual_value" double precision; diff --git a/backend/db/migrations/meta/0025_snapshot.json b/backend/db/migrations/meta/0025_snapshot.json new file mode 100644 index 0000000..cffb669 --- /dev/null +++ b/backend/db/migrations/meta/0025_snapshot.json @@ -0,0 +1,11813 @@ +{ + "id": "1cb06741-0296-4ecc-91dc-290aa67f3ba0", + "prevId": "f712d6fc-e9a9-4968-854b-427c3988236e", + "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 + }, + "accountChart": { + "name": "accountChart", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'skr03'" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_profile_branches": { + "name": "auth_profile_branches", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "profile_id": { + "name": "profile_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "branch_id": { + "name": "branch_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "auth_profile_branches_profile_id_auth_profiles_id_fk": { + "name": "auth_profile_branches_profile_id_auth_profiles_id_fk", + "tableFrom": "auth_profile_branches", + "tableTo": "auth_profiles", + "columnsFrom": [ + "profile_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "auth_profile_branches_branch_id_branches_id_fk": { + "name": "auth_profile_branches_branch_id_branches_id_fk", + "tableFrom": "auth_profile_branches", + "tableTo": "branches", + "columnsFrom": [ + "branch_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "auth_profile_branches_created_by_auth_users_id_fk": { + "name": "auth_profile_branches_created_by_auth_users_id_fk", + "tableFrom": "auth_profile_branches", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "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 + }, + "branch_id": { + "name": "branch_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "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" + }, + "auth_profiles_branch_id_branches_id_fk": { + "name": "auth_profiles_branch_id_branches_id_fk", + "tableFrom": "auth_profiles", + "tableTo": "branches", + "columnsFrom": [ + "branch_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 + }, + "is_admin": { + "name": "is_admin", + "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.branches": { + "name": "branches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "branches_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 + }, + "number": { + "name": "number", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "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": { + "branches_tenant_tenants_id_fk": { + "name": "branches_tenant_tenants_id_fk", + "tableFrom": "branches", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "branches_updated_by_auth_users_id_fk": { + "name": "branches_updated_by_auth_users_id_fk", + "tableFrom": "branches", + "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 + }, + "contracttype": { + "name": "contracttype", + "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 + }, + "billingInterval": { + "name": "billingInterval", + "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_contracttype_contracttypes_id_fk": { + "name": "contracts_contracttype_contracttypes_id_fk", + "tableFrom": "contracts", + "tableTo": "contracttypes", + "columnsFrom": [ + "contracttype" + ], + "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.contracttypes": { + "name": "contracttypes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "contracttypes_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 + }, + "paymentType": { + "name": "paymentType", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "recurring": { + "name": "recurring", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "billingInterval": { + "name": "billingInterval", + "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": { + "contracttypes_tenant_tenants_id_fk": { + "name": "contracttypes_tenant_tenants_id_fk", + "tableFrom": "contracttypes", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "contracttypes_updated_by_auth_users_id_fk": { + "name": "contracttypes_updated_by_auth_users_id_fk", + "tableFrom": "contracttypes", + "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 + }, + "branch": { + "name": "branch", + "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_branch_branches_id_fk": { + "name": "costcentres_branch_branches_id_fk", + "tableFrom": "costcentres", + "tableTo": "branches", + "columnsFrom": [ + "branch" + ], + "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": "double precision", + "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 + }, + "serialexecution": { + "name": "serialexecution", + "type": "uuid", + "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" + }, + "createddocuments_serialexecution_serial_executions_id_fk": { + "name": "createddocuments_serialexecution_serial_executions_id_fk", + "tableFrom": "createddocuments", + "tableTo": "serial_executions", + "columnsFrom": [ + "serialexecution" + ], + "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.customerinventoryitems": { + "name": "customerinventoryitems", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "customerinventoryitems_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 + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "customer": { + "name": "customer", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "customerspace": { + "name": "customerspace", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "customerInventoryId": { + "name": "customerInventoryId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "serialNumber": { + "name": "serialNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quantity": { + "name": "quantity", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "manufacturer": { + "name": "manufacturer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "manufacturerNumber": { + "name": "manufacturerNumber", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "purchaseDate": { + "name": "purchaseDate", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "purchasePrice": { + "name": "purchasePrice", + "type": "double precision", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "currentValue": { + "name": "currentValue", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "product": { + "name": "product", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "vendor": { + "name": "vendor", + "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": { + "customerinventoryitems_tenant_tenants_id_fk": { + "name": "customerinventoryitems_tenant_tenants_id_fk", + "tableFrom": "customerinventoryitems", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "customerinventoryitems_customer_customers_id_fk": { + "name": "customerinventoryitems_customer_customers_id_fk", + "tableFrom": "customerinventoryitems", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "customerinventoryitems_customerspace_customerspaces_id_fk": { + "name": "customerinventoryitems_customerspace_customerspaces_id_fk", + "tableFrom": "customerinventoryitems", + "tableTo": "customerspaces", + "columnsFrom": [ + "customerspace" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "customerinventoryitems_product_products_id_fk": { + "name": "customerinventoryitems_product_products_id_fk", + "tableFrom": "customerinventoryitems", + "tableTo": "products", + "columnsFrom": [ + "product" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "customerinventoryitems_vendor_vendors_id_fk": { + "name": "customerinventoryitems_vendor_vendors_id_fk", + "tableFrom": "customerinventoryitems", + "tableTo": "vendors", + "columnsFrom": [ + "vendor" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "customerinventoryitems_updated_by_auth_users_id_fk": { + "name": "customerinventoryitems_updated_by_auth_users_id_fk", + "tableFrom": "customerinventoryitems", + "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 + }, + "customTaxType": { + "name": "customTaxType", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "memberrelation": { + "name": "memberrelation", + "type": "bigint", + "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" + }, + "customers_memberrelation_memberrelations_id_fk": { + "name": "customers_memberrelation_memberrelations_id_fk", + "tableFrom": "customers", + "tableTo": "memberrelations", + "columnsFrom": [ + "memberrelation" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.customerspaces": { + "name": "customerspaces", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "customerspaces_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 + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "customer": { + "name": "customer", + "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": { + "customerspaces_tenant_tenants_id_fk": { + "name": "customerspaces_tenant_tenants_id_fk", + "tableFrom": "customerspaces", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "customerspaces_customer_customers_id_fk": { + "name": "customerspaces_customer_customers_id_fk", + "tableFrom": "customerspaces", + "tableTo": "customers", + "columnsFrom": [ + "customer" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "customerspaces_parentSpace_customerspaces_id_fk": { + "name": "customerspaces_parentSpace_customerspaces_id_fk", + "tableFrom": "customerspaces", + "tableTo": "customerspaces", + "columnsFrom": [ + "parentSpace" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "customerspaces_updated_by_auth_users_id_fk": { + "name": "customerspaces_updated_by_auth_users_id_fk", + "tableFrom": "customerspaces", + "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 + }, + "last_seen": { + "name": "last_seen", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "last_debug_info": { + "name": "last_debug_info", + "type": "jsonb", + "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.entitybankaccounts": { + "name": "entitybankaccounts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "entitybankaccounts_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 + }, + "iban_encrypted": { + "name": "iban_encrypted", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "bic_encrypted": { + "name": "bic_encrypted", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "bank_name_encrypted": { + "name": "bank_name_encrypted", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "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": { + "entitybankaccounts_tenant_tenants_id_fk": { + "name": "entitybankaccounts_tenant_tenants_id_fk", + "tableFrom": "entitybankaccounts", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "entitybankaccounts_updated_by_auth_users_id_fk": { + "name": "entitybankaccounts_updated_by_auth_users_id_fk", + "tableFrom": "entitybankaccounts", + "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 + }, + "extracted_text": { + "name": "extracted_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 + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "auth_profile": { + "name": "auth_profile", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "bigint", + "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 + }, + "customerspace": { + "name": "customerspace", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "customerinventoryitem": { + "name": "customerinventoryitem", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "memberrelation": { + "name": "memberrelation", + "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_customerspace_customerspaces_id_fk": { + "name": "historyitems_customerspace_customerspaces_id_fk", + "tableFrom": "historyitems", + "tableTo": "customerspaces", + "columnsFrom": [ + "customerspace" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_customerinventoryitem_customerinventoryitems_id_fk": { + "name": "historyitems_customerinventoryitem_customerinventoryitems_id_fk", + "tableFrom": "historyitems", + "tableTo": "customerinventoryitems", + "columnsFrom": [ + "customerinventoryitem" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "historyitems_memberrelation_memberrelations_id_fk": { + "name": "historyitems_memberrelation_memberrelations_id_fk", + "tableFrom": "historyitems", + "tableTo": "memberrelations", + "columnsFrom": [ + "memberrelation" + ], + "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.memberrelations": { + "name": "memberrelations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "memberrelations_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 + }, + "billingInterval": { + "name": "billingInterval", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "billingAmount": { + "name": "billingAmount", + "type": "double precision", + "primaryKey": false, + "notNull": true, + "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": { + "memberrelations_tenant_tenants_id_fk": { + "name": "memberrelations_tenant_tenants_id_fk", + "tableFrom": "memberrelations", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "memberrelations_updated_by_auth_users_id_fk": { + "name": "memberrelations_updated_by_auth_users_id_fk", + "tableFrom": "memberrelations", + "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.m2m_api_keys": { + "name": "m2m_api_keys", + "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()" + }, + "updated_at": { + "name": "updated_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 + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_prefix": { + "name": "key_prefix", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "m2m_api_keys_tenant_id_tenants_id_fk": { + "name": "m2m_api_keys_tenant_id_tenants_id_fk", + "tableFrom": "m2m_api_keys", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "m2m_api_keys_user_id_auth_users_id_fk": { + "name": "m2m_api_keys_user_id_auth_users_id_fk", + "tableFrom": "m2m_api_keys", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "m2m_api_keys_created_by_auth_users_id_fk": { + "name": "m2m_api_keys_created_by_auth_users_id_fk", + "tableFrom": "m2m_api_keys", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "m2m_api_keys_key_hash_unique": { + "name": "m2m_api_keys_key_hash_unique", + "nullsNotDistinct": false, + "columns": [ + "key_hash" + ] + } + }, + "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, + "default": "'Erstkontakt'" + } + }, + "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" + }, + "priceUpdateLocked": { + "name": "priceUpdateLocked", + "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": { + "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 + }, + "booking_mode": { + "name": "booking_mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'expense'" + }, + "depreciation_months": { + "name": "depreciation_months", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "depreciation_start_date": { + "name": "depreciation_start_date", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "depreciation_label": { + "name": "depreciation_label", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "depreciation_group": { + "name": "depreciation_group", + "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,\"dashboard\":true,\"historyitems\":true,\"tasks\":true,\"wiki\":true,\"files\":true,\"createdletters\":true,\"documentboxes\":true,\"helpdesk\":true,\"email\":true,\"members\":true,\"customers\":true,\"vendors\":true,\"contactsList\":true,\"staffTime\":true,\"createDocument\":true,\"serialInvoice\":true,\"incomingInvoices\":true,\"costcentres\":true,\"branches\":true,\"accounts\":true,\"ownaccounts\":true,\"banking\":true,\"spaces\":true,\"customerspaces\":true,\"customerinventoryitems\":true,\"inventoryitems\":true,\"inventoryitemgroups\":true,\"products\":true,\"productcategories\":true,\"services\":true,\"servicecategories\":true,\"memberrelations\":true,\"staffProfiles\":true,\"hourrates\":true,\"projecttypes\":true,\"contracttypes\":true,\"plants\":true,\"settingsNumberRanges\":true,\"settingsEmailAccounts\":true,\"settingsBanking\":true,\"settingsTexttemplates\":true,\"settingsTenant\":true,\"export\":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},\"costEstimates\":{\"prefix\":\"KS-\",\"suffix\":\"\",\"nextNumber\":1000},\"confirmationOrders\":{\"prefix\":\"AB-\",\"suffix\":\"\",\"nextNumber\":1000},\"invoices\":{\"prefix\":\"RE-\",\"suffix\":\"\",\"nextNumber\":1000},\"deliveryNotes\":{\"prefix\":\"LS-\",\"suffix\":\"\",\"nextNumber\":1000},\"packingSlips\":{\"prefix\":\"PS-\",\"suffix\":\"\",\"nextNumber\":1000},\"spaces\":{\"prefix\":\"LP-\",\"suffix\":\"\",\"nextNumber\":1000},\"customerspaces\":{\"prefix\":\"KLP-\",\"suffix\":\"\",\"nextNumber\":1000},\"inventoryitems\":{\"prefix\":\"IA-\",\"suffix\":\"\",\"nextNumber\":1000},\"customerinventoryitems\":{\"prefix\":\"KIA-\",\"suffix\":\"\",\"nextNumber\":1000},\"projects\":{\"prefix\":\"PRJ-\",\"suffix\":\"\",\"nextNumber\":1000},\"costcentres\":{\"prefix\":\"KST-\",\"suffix\":\"\",\"nextNumber\":1000}}'::jsonb" + }, + "accountChart": { + "name": "accountChart", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'skr03'" + }, + "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 + }, + "taxEvaluationPeriod": { + "name": "taxEvaluationPeriod", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'monthly'" + }, + "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.staff_time_events": { + "name": "staff_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 + }, + "related_event_id": { + "name": "related_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": { + "staff_time_events_tenant_id_tenants_id_fk": { + "name": "staff_time_events_tenant_id_tenants_id_fk", + "tableFrom": "staff_time_events", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "staff_time_events_user_id_auth_users_id_fk": { + "name": "staff_time_events_user_id_auth_users_id_fk", + "tableFrom": "staff_time_events", + "tableTo": "auth_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "staff_time_events_actor_user_id_auth_users_id_fk": { + "name": "staff_time_events_actor_user_id_auth_users_id_fk", + "tableFrom": "staff_time_events", + "tableTo": "auth_users", + "columnsFrom": [ + "actor_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "staff_time_events_invalidates_event_id_staff_time_events_id_fk": { + "name": "staff_time_events_invalidates_event_id_staff_time_events_id_fk", + "tableFrom": "staff_time_events", + "tableTo": "staff_time_events", + "columnsFrom": [ + "invalidates_event_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "staff_time_events_related_event_id_staff_time_events_id_fk": { + "name": "staff_time_events_related_event_id_staff_time_events_id_fk", + "tableFrom": "staff_time_events", + "tableTo": "staff_time_events", + "columnsFrom": [ + "related_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 + }, + "public.serialtypes": { + "name": "serialtypes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "serialtypes_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 + }, + "intervall": { + "name": "intervall", + "type": "text", + "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": { + "serialtypes_tenant_tenants_id_fk": { + "name": "serialtypes_tenant_tenants_id_fk", + "tableFrom": "serialtypes", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "serialtypes_updated_by_auth_users_id_fk": { + "name": "serialtypes_updated_by_auth_users_id_fk", + "tableFrom": "serialtypes", + "tableTo": "auth_users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.serial_executions": { + "name": "serial_executions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tenant": { + "name": "tenant", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "execution_date": { + "name": "execution_date", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'draft'" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "serial_executions_tenant_tenants_id_fk": { + "name": "serial_executions_tenant_tenants_id_fk", + "tableFrom": "serial_executions", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.public_links": { + "name": "public_links", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tenant": { + "name": "tenant", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "default_profile": { + "name": "default_profile", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "is_protected": { + "name": "is_protected", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pin_hash": { + "name": "pin_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'::jsonb" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "public_links_tenant_tenants_id_fk": { + "name": "public_links_tenant_tenants_id_fk", + "tableFrom": "public_links", + "tableTo": "tenants", + "columnsFrom": [ + "tenant" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "public_links_default_profile_auth_profiles_id_fk": { + "name": "public_links_default_profile_auth_profiles_id_fk", + "tableFrom": "public_links", + "tableTo": "auth_profiles", + "columnsFrom": [ + "default_profile" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "public_links_token_unique": { + "name": "public_links_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.wiki_pages": { + "name": "wiki_pages", + "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 + }, + "parent_id": { + "name": "parent_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "is_folder": { + "name": "is_folder", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "entity_type": { + "name": "entity_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "entity_id": { + "name": "entity_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "entity_uuid": { + "name": "entity_uuid", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_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 + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "wiki_pages_tenant_idx": { + "name": "wiki_pages_tenant_idx", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "wiki_pages_parent_idx": { + "name": "wiki_pages_parent_idx", + "columns": [ + { + "expression": "parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "wiki_pages_entity_int_idx": { + "name": "wiki_pages_entity_int_idx", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "wiki_pages_entity_uuid_idx": { + "name": "wiki_pages_entity_uuid_idx", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_uuid", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "wiki_pages_tenant_id_tenants_id_fk": { + "name": "wiki_pages_tenant_id_tenants_id_fk", + "tableFrom": "wiki_pages", + "tableTo": "tenants", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "wiki_pages_parent_id_wiki_pages_id_fk": { + "name": "wiki_pages_parent_id_wiki_pages_id_fk", + "tableFrom": "wiki_pages", + "tableTo": "wiki_pages", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "wiki_pages_created_by_auth_users_id_fk": { + "name": "wiki_pages_created_by_auth_users_id_fk", + "tableFrom": "wiki_pages", + "tableTo": "auth_users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "wiki_pages_updated_by_auth_users_id_fk": { + "name": "wiki_pages_updated_by_auth_users_id_fk", + "tableFrom": "wiki_pages", + "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/backend/db/migrations/meta/_journal.json b/backend/db/migrations/meta/_journal.json index 8f5d59c..6e7e0a9 100644 --- a/backend/db/migrations/meta/_journal.json +++ b/backend/db/migrations/meta/_journal.json @@ -138,37 +138,58 @@ { "idx": 19, "version": "7", + "when": 1773489600000, + "tag": "0019_custom_surcharge_percentage_decimal", + "breakpoints": true + }, + { + "idx": 20, + "version": "7", "when": 1773572400000, "tag": "0020_file_extracted_text", "breakpoints": true }, { - "idx": 20, + "idx": 21, "version": "7", "when": 1773835200000, "tag": "0021_admin_user_flag", "breakpoints": true }, { - "idx": 21, + "idx": 22, "version": "7", "when": 1773925200000, "tag": "0022_task_dependencies", "breakpoints": true }, { - "idx": 22, + "idx": 23, "version": "7", "when": 1774080000000, "tag": "0023_tax_evaluation_period", "breakpoints": true }, { - "idx": 23, + "idx": 24, "version": "7", "when": 1774393200000, "tag": "0024_tenant_branches", "breakpoints": true + }, + { + "idx": 25, + "version": "7", + "when": 1774393201000, + "tag": "0025_statementallocation_depreciation", + "breakpoints": true + }, + { + "idx": 26, + "version": "7", + "when": 1774393202000, + "tag": "0026_statementallocation_depreciation_method", + "breakpoints": true } ] } diff --git a/backend/db/schema/statementallocations.ts b/backend/db/schema/statementallocations.ts index c0db9bc..1cf8e71 100644 --- a/backend/db/schema/statementallocations.ts +++ b/backend/db/schema/statementallocations.ts @@ -51,6 +51,14 @@ export const statementallocations = pgTable("statementallocations", { description: text("description"), + bookingMode: text("booking_mode").notNull().default("expense"), + depreciationMonths: integer("depreciation_months"), + depreciationStartDate: text("depreciation_start_date"), + depreciationMethod: text("depreciation_method"), + depreciationLabel: text("depreciation_label"), + depreciationGroup: text("depreciation_group"), + residualValue: doublePrecision("residual_value"), + customer: bigint("customer", { mode: "number" }).references( () => customers.id ), diff --git a/backend/drizzle.config.ts b/backend/drizzle.config.ts index 2953798..bc2f3d0 100644 --- a/backend/drizzle.config.ts +++ b/backend/drizzle.config.ts @@ -1,11 +1,14 @@ +import "dotenv/config" import { defineConfig } from "drizzle-kit" -import {secrets} from "./src/utils/secrets"; + +const fallbackDatabaseUrl = "postgres://postgres:wJw7aNpEBJdcxgoct6GXNpvY4Cn6ECqu@fedeo-db-001.vpn.internal:5432/fedeo" +const databaseUrl = process.env.DATABASE_URL || fallbackDatabaseUrl export default defineConfig({ dialect: "postgresql", schema: "./db/schema", out: "./db/migrations", dbCredentials: { - url: secrets.DATABASE_URL || "postgres://postgres:wJw7aNpEBJdcxgoct6GXNpvY4Cn6ECqu@fedeo-db-001.vpn.internal:5432/fedeo", + url: databaseUrl, }, -}) \ No newline at end of file +}) diff --git a/backend/package.json b/backend/package.json index 7aee79f..55b5409 100644 --- a/backend/package.json +++ b/backend/package.json @@ -5,6 +5,7 @@ "main": "index.js", "scripts": { "dev": "tsx watch src/index.ts", + "migrate": "tsx scripts/migrate.ts", "fill": "ts-node src/webdav/fill-file-sizes.ts", "dev:dav": "tsx watch src/webdav/server.ts", "build": "tsc", diff --git a/backend/src/routes/auth/me.ts b/backend/src/routes/auth/me.ts index 5ef98ca..24eac9d 100644 --- a/backend/src/routes/auth/me.ts +++ b/backend/src/routes/auth/me.ts @@ -52,6 +52,7 @@ export default async function meRoutes(server: FastifyInstance) { id: tenants.id, name: tenants.name, short: tenants.short, + hasActiveLicense: tenants.hasActiveLicense, locked: tenants.locked, features: tenants.features, extraModules: tenants.extraModules, diff --git a/frontend/components/MainNav.vue b/frontend/components/MainNav.vue index c191326..7ab1d56 100644 --- a/frontend/components/MainNav.vue +++ b/frontend/components/MainNav.vue @@ -136,6 +136,11 @@ const links = computed(() => { to: "/incomingInvoices", icon: "i-heroicons-document-text", } : null, + (featureEnabled("incomingInvoices") || featureEnabled("banking")) ? { + label: "Abschreibungen", + to: "/accounting/depreciation", + icon: "i-heroicons-calendar-days", + } : null, ((featureEnabled("createDocument") || featureEnabled("incomingInvoices")) || featureEnabled("accounts") || featureEnabled("ownaccounts") || featureEnabled("costcentres")) ? { label: "Auswertungen", icon: "i-heroicons-chart-pie", diff --git a/frontend/components/displayBWASummary.vue b/frontend/components/displayBWASummary.vue index 6d28e8f..bd68b67 100644 --- a/frontend/components/displayBWASummary.vue +++ b/frontend/components/displayBWASummary.vue @@ -4,16 +4,24 @@ import { getCreatedDocumentTaxBreakdown, getIncomingInvoiceTaxBreakdown } from "~/composables/useTaxEvaluation" +import { + getIncomingInvoiceDepreciationRows, + getIncomingInvoiceImmediateExpenseNet, + getStatementAllocationDepreciationRow, + getStatementAllocationImmediateExpenseAmount +} from "~/composables/useDepreciation" const loading = ref(true) const summary = ref({ label: "", income: 0, expenses: 0, + depreciations: 0, result: 0, taxBalance: 0, incomeCount: 0, - expenseCount: 0 + expenseCount: 0, + depreciationCount: 0 }) const formatCurrency = (value: number) => { @@ -91,13 +99,20 @@ const loadSummary = async () => { }, 0) const invoiceExpenses = inputDocs.reduce((sum: number, invoice: any) => { - return sum + (invoice.accounts || []).reduce((accountSum: number, account: any) => accountSum + Number(account.amountNet || 0), 0) + return sum + getIncomingInvoiceImmediateExpenseNet(invoice) }, 0) const directAccountExpenses = directExpenses.reduce((sum: number, allocation: any) => { - return sum + Math.abs(Number(allocation.amount || 0)) + return sum + getStatementAllocationImmediateExpenseAmount(allocation) }, 0) + const depreciationRows = [ + ...inputDocs.flatMap((invoice: any) => getIncomingInvoiceDepreciationRows(invoice, bounds.start, bounds.end)), + ...(allocations || []).map((allocation: any) => getStatementAllocationDepreciationRow(allocation, bounds.start, bounds.end)).filter(Boolean) + ] + + const depreciations = depreciationRows.reduce((sum: number, row: any) => sum + Number(row.amount || 0), 0) + const outputTax = outputDocs.reduce((sum: number, doc: any) => { const breakdown = getCreatedDocumentTaxBreakdown(doc) return sum + breakdown.tax19 + breakdown.tax7 @@ -108,16 +123,18 @@ const loadSummary = async () => { return sum + breakdown.tax19 + breakdown.tax7 }, 0) - const expenses = invoiceExpenses + directAccountExpenses + const expenses = invoiceExpenses + directAccountExpenses + depreciations summary.value = { label: dayjs().format("MMMM YYYY"), income: Number(income.toFixed(2)), expenses: Number(expenses.toFixed(2)), + depreciations: Number(depreciations.toFixed(2)), result: Number((income - expenses).toFixed(2)), taxBalance: Number((outputTax - inputTax).toFixed(2)), incomeCount: outputDocs.length, - expenseCount: inputDocs.length + directExpenses.length + expenseCount: inputDocs.filter((invoice: any) => getIncomingInvoiceImmediateExpenseNet(invoice) > 0).length + directExpenses.filter((allocation: any) => getStatementAllocationImmediateExpenseAmount(allocation) > 0).length, + depreciationCount: depreciationRows.length } } finally { loading.value = false @@ -159,6 +176,13 @@ onMounted(loadSummary) +
+ Davon Abschreibungen + + {{ loading ? "..." : formatCurrency(summary.depreciations) }} + +
+
Ergebnis @@ -167,7 +191,7 @@ onMounted(loadSummary)
- {{ summary.incomeCount }} Einnahmenbelege | {{ summary.expenseCount }} Ausgabenbelege | USt-Saldo {{ formatCurrency(summary.taxBalance) }} + {{ summary.incomeCount }} Einnahmenbelege | {{ summary.expenseCount }} Ausgabenbelege | {{ summary.depreciationCount }} Abschreibungen | USt-Saldo {{ formatCurrency(summary.taxBalance) }}
diff --git a/frontend/composables/useDepreciation.ts b/frontend/composables/useDepreciation.ts new file mode 100644 index 0000000..d833449 --- /dev/null +++ b/frontend/composables/useDepreciation.ts @@ -0,0 +1,394 @@ +import dayjs from "dayjs" + +export const EXPENSE_BOOKING_MODE_ITEMS = [ + { label: "Sofortaufwand", value: "expense" }, + { label: "Abschreibung einzeln", value: "depreciation_single" }, + { label: "Abschreibung Sammelposten", value: "depreciation_bundle" }, +] + +export const DEPRECIATION_METHOD_ITEMS = [ + { label: "Linear", value: "linear" }, + { label: "Degressiv", value: "degressive" }, +] + +export const normalizeExpenseBookingMode = (value?: string | null) => { + if (value === "depreciation_single" || value === "depreciation_bundle") return value + return "expense" +} + +export const isDepreciationBookingMode = (value?: string | null) => { + return normalizeExpenseBookingMode(value) !== "expense" +} + +export const normalizeDepreciationMethod = (value?: string | null) => { + return value === "degressive" ? "degressive" : "linear" +} + +export const createIncomingInvoiceAccount = (overrides: Record = {}) => ({ + account: null, + amountNet: null, + amountTax: null, + taxType: "19", + costCentre: null, + amountGross: null, + description: "", + bookingMode: "expense", + depreciationMonths: null, + depreciationStartDate: null, + depreciationMethod: "linear", + depreciationLabel: "", + depreciationGroup: "", + residualValue: 0, + ...overrides, +}) + +export const normalizeIncomingInvoiceAccount = (account: Record = {}, fallbackDate?: any) => { + const bookingMode = normalizeExpenseBookingMode(account?.bookingMode) + + return { + ...createIncomingInvoiceAccount(account), + bookingMode, + depreciationMonths: account?.depreciationMonths ? Number(account.depreciationMonths) : null, + depreciationStartDate: account?.depreciationStartDate || fallbackDate || null, + depreciationMethod: normalizeDepreciationMethod(account?.depreciationMethod), + depreciationLabel: String(account?.depreciationLabel || account?.description || "").trim(), + depreciationGroup: String(account?.depreciationGroup || "").trim(), + residualValue: Number(account?.residualValue || 0), + } +} + +export const normalizeIncomingInvoiceAccounts = (accounts: any[] = [], fallbackDate?: any) => { + const normalized = (accounts || []).map((account) => normalizeIncomingInvoiceAccount(account, fallbackDate)) + return normalized.length > 0 ? normalized : [createIncomingInvoiceAccount({ depreciationStartDate: fallbackDate || null })] +} + +export const ensureDepreciationDefaults = (item: Record, fallbackDate?: any) => { + item.bookingMode = normalizeExpenseBookingMode(item?.bookingMode) + + if (!isDepreciationBookingMode(item.bookingMode)) { + item.depreciationMonths = null + item.depreciationStartDate = null + item.depreciationMethod = "linear" + item.depreciationGroup = "" + item.residualValue = 0 + if (!item.depreciationLabel) item.depreciationLabel = item.description || "" + return item + } + + if (!Number(item.depreciationMonths)) item.depreciationMonths = 36 + if (!item.depreciationStartDate) item.depreciationStartDate = fallbackDate || null + item.depreciationMethod = normalizeDepreciationMethod(item.depreciationMethod) + if (!item.depreciationLabel) item.depreciationLabel = item.description || "" + if (item.bookingMode !== "depreciation_bundle") item.depreciationGroup = "" + item.residualValue = Number(item.residualValue || 0) + return item +} + +const distributeLinearDepreciation = (amount: number, months: number) => { + const totalCents = Math.round(Number(amount || 0) * 100) + const totalMonths = Math.max(1, Math.round(Number(months || 0))) + const base = Math.trunc(totalCents / totalMonths) + const remainder = totalCents - (base * totalMonths) + + return Array.from({ length: totalMonths }, (_, index) => { + return base + (index < remainder ? 1 : 0) + }) +} + +const distributeDegressiveDepreciation = (amount: number, months: number, residualValue: number) => { + const startCents = Math.round(Math.max(0, Number(amount || 0)) * 100) + const residualCents = Math.round(Math.max(0, Number(residualValue || 0)) * 100) + const totalMonths = Math.max(1, Math.round(Number(months || 0))) + const targetResidual = Math.min(startCents, residualCents) + const depreciable = Math.max(0, startCents - targetResidual) + + if (!depreciable) return Array.from({ length: totalMonths }, () => 0) + + // Monthly degressive rate derived from start and target residual over the selected duration. + const rate = targetResidual > 0 + ? 1 - Math.pow(targetResidual / startCents, 1 / totalMonths) + : 1 - Math.pow(0.01 / Math.max(startCents, 1), 1 / totalMonths) + + const values: number[] = [] + let currentBookValue = startCents + let depreciated = 0 + + for (let index = 0; index < totalMonths; index += 1) { + const remainingDepreciable = Math.max(0, depreciable - depreciated) + if (remainingDepreciable <= 0) { + values.push(0) + continue + } + + if (index === totalMonths - 1) { + values.push(remainingDepreciable) + depreciated += remainingDepreciable + currentBookValue = targetResidual + continue + } + + const raw = Math.round(currentBookValue * rate) + const maxAllowed = Math.max(1, remainingDepreciable - Math.max(0, totalMonths - index - 1)) + const monthValue = Math.max(1, Math.min(raw || 1, maxAllowed)) + values.push(monthValue) + depreciated += monthValue + currentBookValue = Math.max(targetResidual, currentBookValue - monthValue) + } + + return values +} + +export const getDepreciationPlan = ({ + amount, + months, + startDate, + method, + residualValue, +}: { + amount: number + months: number + startDate: any + method?: string + residualValue?: number +}) => { + const start = dayjs(startDate).startOf("month") + const totalAmount = Number(amount || 0) + const totalMonths = Math.max(1, Math.round(Number(months || 0))) + const normalizedMethod = normalizeDepreciationMethod(method) + const normalizedResidual = Number(residualValue || 0) + + if (!start.isValid() || totalAmount <= 0) return [] + + const distributed = normalizedMethod === "degressive" + ? distributeDegressiveDepreciation(totalAmount, totalMonths, normalizedResidual) + : distributeLinearDepreciation(Math.max(0, totalAmount - normalizedResidual), totalMonths) + + return distributed.map((cents, index) => ({ + index, + date: start.add(index, "month"), + amount: Number((cents / 100).toFixed(2)), + })) +} + +export const getLinearDepreciationAmountForRange = ({ + amount, + months, + startDate, + rangeStart, + rangeEnd, + method, + residualValue, +}: { + amount: number + months: number + startDate: any + rangeStart: any + rangeEnd: any + method?: string + residualValue?: number +}) => { + const start = dayjs(startDate).startOf("month") + const periodStart = dayjs(rangeStart).startOf("month") + const periodEnd = dayjs(rangeEnd).endOf("month") + + if (!start.isValid() || !periodStart.isValid() || !periodEnd.isValid()) return 0 + + const distributed = getDepreciationPlan({ + amount, + months, + startDate, + method, + residualValue, + }) + let resultCents = 0 + + distributed.forEach((value) => { + const monthDate = dayjs(value.date) + if ((monthDate.isAfter(periodStart) || monthDate.isSame(periodStart, "month")) + && (monthDate.isBefore(periodEnd) || monthDate.isSame(periodEnd, "month"))) { + resultCents += Math.round(Number(value.amount || 0) * 100) + } + }) + + return Number((resultCents / 100).toFixed(2)) +} + +export const getIncomingInvoiceImmediateExpenseNet = (invoice: any) => { + return Number(((invoice?.accounts || []).reduce((sum: number, account: any) => { + const normalized = normalizeIncomingInvoiceAccount(account, invoice?.date) + if (isDepreciationBookingMode(normalized.bookingMode)) return sum + return sum + Number(normalized.amountNet || 0) + }, 0)).toFixed(2)) +} + +export const getIncomingInvoiceImmediateExpenseGross = (invoice: any) => { + return Number(((invoice?.accounts || []).reduce((sum: number, account: any) => { + const normalized = normalizeIncomingInvoiceAccount(account, invoice?.date) + if (isDepreciationBookingMode(normalized.bookingMode)) return sum + + const amountGross = Number(normalized.amountGross) + return sum + (Number.isFinite(amountGross) ? amountGross : Number(normalized.amountNet || 0) + Number(normalized.amountTax || 0)) + }, 0)).toFixed(2)) +} + +export const getIncomingInvoiceDepreciationRows = (invoice: any, rangeStart: any, rangeEnd: any) => { + return (invoice?.accounts || []) + .map((account: any, index: number) => { + const normalized = ensureDepreciationDefaults( + normalizeIncomingInvoiceAccount(account, invoice?.date), + invoice?.date + ) + + if (!isDepreciationBookingMode(normalized.bookingMode)) return null + + const amount = Number(normalized.amountNet || 0) + const months = Number(normalized.depreciationMonths || 0) + const plan = getDepreciationPlan({ + amount, + months, + startDate: normalized.depreciationStartDate || invoice?.date, + method: normalized.depreciationMethod, + residualValue: normalized.residualValue, + }) + const periodAmount = Number(plan.reduce((sum, item) => { + const monthDate = dayjs(item.date) + const periodStart = dayjs(rangeStart).startOf("month") + const periodEnd = dayjs(rangeEnd).endOf("month") + if ((monthDate.isAfter(periodStart) || monthDate.isSame(periodStart, "month")) + && (monthDate.isBefore(periodEnd) || monthDate.isSame(periodEnd, "month"))) { + return sum + Number(item.amount || 0) + } + return sum + }, 0).toFixed(2)) + + if (!periodAmount) return null + + const alreadyDepreciated = Number(plan + .filter((entry) => dayjs(entry.date).isBefore(dayjs().startOf("month")) || dayjs(entry.date).isSame(dayjs().startOf("month"), "month")) + .reduce((sum, entry) => sum + Number(entry.amount || 0), 0) + .toFixed(2)) + const residualBookValue = Number(Math.max(0, amount - alreadyDepreciated).toFixed(2)) + + return { + source: "incominginvoice", + sourceId: invoice?.id, + index, + mode: normalized.bookingMode, + label: normalized.depreciationLabel || normalized.description || invoice?.reference || `Eingangsbeleg ${invoice?.id}`, + group: normalized.depreciationGroup || null, + amount: periodAmount, + months, + startDate: normalized.depreciationStartDate || invoice?.date, + method: normalized.depreciationMethod, + residualValue: Number(normalized.residualValue || 0), + alreadyDepreciated, + residualBookValue, + vendor: invoice?.vendor, + reference: invoice?.reference, + } + }) + .filter(Boolean) +} + +export const getStatementAllocationImmediateExpenseAmount = (allocation: any) => { + const mode = normalizeExpenseBookingMode(allocation?.bookingMode) + const amount = Number(allocation?.amount || 0) + if (mode !== "expense" || amount >= 0) return 0 + return Number(Math.abs(amount).toFixed(2)) +} + +export const getStatementAllocationDepreciationAmount = (allocation: any, rangeStart: any, rangeEnd: any) => { + const mode = normalizeExpenseBookingMode(allocation?.bookingMode) + const rawAmount = Number(allocation?.amount || 0) + const amount = Math.abs(rawAmount) + if (mode === "expense" || rawAmount >= 0 || amount <= 0) return 0 + + return getLinearDepreciationAmountForRange({ + amount, + months: Number(allocation?.depreciationMonths || 0), + startDate: allocation?.depreciationStartDate || allocation?.created_at, + rangeStart, + rangeEnd, + method: allocation?.depreciationMethod, + residualValue: allocation?.residualValue, + }) +} + +export const getStatementAllocationDepreciationRow = (allocation: any, rangeStart: any, rangeEnd: any) => { + const totalAmount = Math.abs(Number(allocation?.amount || 0)) + const months = Number(allocation?.depreciationMonths || 0) + const startDate = allocation?.depreciationStartDate || allocation?.created_at + const method = normalizeDepreciationMethod(allocation?.depreciationMethod) + const residualValue = Number(allocation?.residualValue || 0) + const plan = getDepreciationPlan({ + amount: totalAmount, + months, + startDate, + method, + residualValue, + }) + const amount = Number(plan.reduce((sum, item) => { + const monthDate = dayjs(item.date) + const periodStart = dayjs(rangeStart).startOf("month") + const periodEnd = dayjs(rangeEnd).endOf("month") + if ((monthDate.isAfter(periodStart) || monthDate.isSame(periodStart, "month")) + && (monthDate.isBefore(periodEnd) || monthDate.isSame(periodEnd, "month"))) { + return sum + Number(item.amount || 0) + } + return sum + }, 0).toFixed(2)) + if (!amount) return null + + const alreadyDepreciated = Number(plan + .filter((entry) => dayjs(entry.date).isBefore(dayjs().startOf("month")) || dayjs(entry.date).isSame(dayjs().startOf("month"), "month")) + .reduce((sum, entry) => sum + Number(entry.amount || 0), 0) + .toFixed(2)) + const residualBookValue = Number(Math.max(0, totalAmount - alreadyDepreciated).toFixed(2)) + + return { + source: "statementallocation", + sourceId: allocation?.id, + mode: normalizeExpenseBookingMode(allocation?.bookingMode), + label: allocation?.depreciationLabel || allocation?.description || "Direkte Abschreibung", + group: allocation?.depreciationGroup || null, + amount, + months, + startDate, + method, + residualValue, + alreadyDepreciated, + residualBookValue, + } +} + +export const getAssetDepreciationStatus = (asset: any, asOfDate?: any) => { + const amount = Number(asset?.amount || asset?.amountNet || 0) + const months = Number(asset?.depreciationMonths || 0) + const startDate = asset?.depreciationStartDate || asset?.date || asset?.created_at + const method = normalizeDepreciationMethod(asset?.depreciationMethod) + const residualValue = Number(asset?.residualValue || 0) + const plan = getDepreciationPlan({ + amount, + months, + startDate, + method, + residualValue, + }) + const cutoff = dayjs(asOfDate || new Date()).endOf("month") + const depreciated = Number(plan + .filter((entry) => dayjs(entry.date).isBefore(cutoff) || dayjs(entry.date).isSame(cutoff, "month")) + .reduce((sum, entry) => sum + Number(entry.amount || 0), 0) + .toFixed(2)) + const remaining = Number(Math.max(0, amount - depreciated).toFixed(2)) + const depreciableBase = Number(Math.max(0, amount - residualValue).toFixed(2)) + + return { + plan, + amount: Number(amount.toFixed(2)), + depreciated, + remaining, + residualValue: Number(residualValue.toFixed(2)), + depreciableBase, + progressPercent: depreciableBase > 0 ? Math.min(100, Number(((depreciated / depreciableBase) * 100).toFixed(2))) : 0, + } +} diff --git a/frontend/pages/accounting/bwa.vue b/frontend/pages/accounting/bwa.vue index e7f12c4..d4da15e 100644 --- a/frontend/pages/accounting/bwa.vue +++ b/frontend/pages/accounting/bwa.vue @@ -4,6 +4,15 @@ import { getCreatedDocumentTaxBreakdown, getIncomingInvoiceTaxBreakdown } from "~/composables/useTaxEvaluation" +import { + getIncomingInvoiceDepreciationRows, + getIncomingInvoiceImmediateExpenseGross, + getIncomingInvoiceImmediateExpenseNet, + isDepreciationBookingMode, + normalizeIncomingInvoiceAccount, + getStatementAllocationDepreciationRow, + getStatementAllocationImmediateExpenseAmount +} from "~/composables/useDepreciation" const router = useRouter() @@ -51,6 +60,14 @@ const ownAccountColumns = [ { accessorKey: "bookings", header: "Buchungen" } ] +const depreciationColumns = [ + { accessorKey: "label", header: "Abschreibung" }, + { accessorKey: "groupLabel", header: "Gruppe" }, + { accessorKey: "modeLabel", header: "Art" }, + { accessorKey: "amount", header: "Betrag" }, + { accessorKey: "bookings", header: "Positionen" } +] + const isRelevantOutputDocument = (doc: any) => { return doc?.state === "Gebucht" && ["invoices", "advanceInvoices", "cancellationInvoices"].includes(doc?.type) } @@ -97,16 +114,6 @@ const computeDocumentNet = (doc: any) => { }, 0).toFixed(2)) } -const computeIncomingInvoiceGross = (invoice: any) => { - return Number((invoice?.accounts || []).reduce((sum: number, account: any) => { - const amountNet = Number(account?.amountNet || 0) - const amountTax = Number(account?.amountTax || 0) - const amountGross = Number(account?.amountGross) - - return sum + (Number.isFinite(amountGross) ? amountGross : amountNet + amountTax) - }, 0).toFixed(2)) -} - const yearItems = computed(() => { const years = new Set([String(dayjs().year())]) @@ -152,32 +159,46 @@ const filteredAccountStatementAllocations = computed(() => { return filteredStatementAllocations.value.filter((allocation) => allocation.account !== null && allocation.account !== undefined) }) +const selectedPeriodBounds = computed(() => { + const start = selectedMonth.value === "all" + ? dayjs(`${selectedYear.value}-01-01`).startOf("day") + : dayjs(`${selectedYear.value}-${String(selectedMonth.value).padStart(2, "0")}-01`).startOf("month") + + const end = selectedMonth.value === "all" + ? dayjs(`${selectedYear.value}-12-31`).endOf("day") + : start.endOf("month") + + return { start, end } +}) + const incomeTotal = computed(() => { return Number(filteredDocuments.value.reduce((sum, doc) => sum + computeDocumentNet(doc), 0).toFixed(2)) }) const expenseNetTotal = computed(() => { const invoiceExpenses = filteredIncomingInvoices.value.reduce((sum, invoice) => { - return sum + (invoice.accounts || []).reduce((accountSum: number, account: any) => accountSum + Number(account.amountNet || 0), 0) + return sum + getIncomingInvoiceImmediateExpenseNet(invoice) }, 0) const directAccountExpenses = filteredAccountStatementAllocations.value.reduce((sum, allocation) => { - const amount = Number(allocation.amount || 0) - return amount < 0 ? sum + Math.abs(amount) : sum + return sum + getStatementAllocationImmediateExpenseAmount(allocation) }, 0) - return Number((invoiceExpenses + directAccountExpenses).toFixed(2)) + const depreciations = depreciationTotal.value + + return Number((invoiceExpenses + directAccountExpenses + depreciations).toFixed(2)) }) const expenseGrossTotal = computed(() => { - const invoiceExpenses = filteredIncomingInvoices.value.reduce((sum, invoice) => sum + computeIncomingInvoiceGross(invoice), 0) + const invoiceExpenses = filteredIncomingInvoices.value.reduce((sum, invoice) => sum + getIncomingInvoiceImmediateExpenseGross(invoice), 0) const directAccountExpenses = filteredAccountStatementAllocations.value.reduce((sum, allocation) => { - const amount = Number(allocation.amount || 0) - return amount < 0 ? sum + Math.abs(amount) : sum + return sum + getStatementAllocationImmediateExpenseAmount(allocation) }, 0) - return Number((invoiceExpenses + directAccountExpenses).toFixed(2)) + const depreciations = depreciationTotal.value + + return Number((invoiceExpenses + directAccountExpenses + depreciations).toFixed(2)) }) const taxSummary = computed(() => { @@ -221,7 +242,42 @@ const operatingResult = computed(() => { const incomeDocumentCount = computed(() => filteredDocuments.value.length) const expenseDocumentCount = computed(() => { - return filteredIncomingInvoices.value.length + filteredAccountStatementAllocations.value.length + const directExpenseCount = filteredAccountStatementAllocations.value.filter((allocation) => getStatementAllocationImmediateExpenseAmount(allocation) > 0).length + return filteredIncomingInvoices.value.filter((invoice) => getIncomingInvoiceImmediateExpenseNet(invoice) > 0).length + directExpenseCount +}) + +const depreciationRows = computed(() => { + const invoiceRows = filteredIncomingInvoices.value.flatMap((invoice) => getIncomingInvoiceDepreciationRows(invoice, selectedPeriodBounds.value.start, selectedPeriodBounds.value.end)) + + const allocationRows = filteredStatementAllocations.value + .map((allocation) => getStatementAllocationDepreciationRow(allocation, selectedPeriodBounds.value.start, selectedPeriodBounds.value.end)) + .filter(Boolean) + + const grouped = new Map() + + ;[...invoiceRows, ...allocationRows].forEach((row: any) => { + const key = row.group || `${row.mode}:${row.label}` + const current = grouped.get(key) || { + id: key, + label: row.group || row.label, + groupLabel: row.group || "-", + modeLabel: row.mode === "depreciation_bundle" ? "Sammelposten" : "Einzeln", + amount: 0, + bookings: 0 + } + + current.amount += Number(row.amount || 0) + current.bookings += 1 + grouped.set(key, current) + }) + + return Array.from(grouped.values()) + .map((row) => ({ ...row, amount: Number(row.amount.toFixed(2)) })) + .sort((left, right) => Number(right.amount) - Number(left.amount)) +}) + +const depreciationTotal = computed(() => { + return Number(depreciationRows.value.reduce((sum, row) => sum + Number(row.amount || 0), 0).toFixed(2)) }) const accountRows = computed(() => { @@ -229,6 +285,7 @@ const accountRows = computed(() => { .map((account) => { const invoiceBookings = filteredIncomingInvoices.value.flatMap((invoice) => { return (invoice.accounts || []) + .filter((invoiceAccount: any) => !isDepreciationBookingMode(normalizeIncomingInvoiceAccount(invoiceAccount, invoice?.date).bookingMode)) .filter((invoiceAccount: any) => sameId(invoiceAccount.account?.id || invoiceAccount.account, account.id)) .map((invoiceAccount: any) => ({ type: "incominginvoice", @@ -241,6 +298,7 @@ const accountRows = computed(() => { }) const directBookings = filteredAccountStatementAllocations.value + .filter((allocation) => getStatementAllocationImmediateExpenseAmount(allocation) > 0) .filter((allocation) => sameId(allocation.account?.id || allocation.account, account.id)) .map((allocation) => { const amount = Number(allocation.amount || 0) @@ -387,7 +445,7 @@ onMounted(setupPage) -
+
Einnahmen netto
{{ useCurrency(incomeTotal) }}
@@ -398,12 +456,20 @@ onMounted(setupPage)
Ausgaben netto
-
{{ useCurrency(expenseNetTotal) }}
+
{{ useCurrency(expenseNetTotal) }}
Brutto: {{ useCurrency(expenseGrossTotal) }}
+ +
Abschreibungen
+
{{ useCurrency(depreciationTotal) }}
+
+ {{ depreciationRows.length }} periodisierte Buchungen +
+
+
Einnahmen Belege
{{ incomeDocumentCount }}
@@ -503,10 +569,10 @@ onMounted(setupPage)
-
- - diff --git a/frontend/pages/accounting/depreciation.vue b/frontend/pages/accounting/depreciation.vue new file mode 100644 index 0000000..dddb7b5 --- /dev/null +++ b/frontend/pages/accounting/depreciation.vue @@ -0,0 +1,411 @@ + + + diff --git a/frontend/pages/banking/statements/[mode]/[[id]].vue b/frontend/pages/banking/statements/[mode]/[[id]].vue index 937594f..703ec19 100644 --- a/frontend/pages/banking/statements/[mode]/[[id]].vue +++ b/frontend/pages/banking/statements/[mode]/[[id]].vue @@ -1,5 +1,11 @@ @@ -526,6 +590,12 @@ setup() {{ getAllocationLabel(item) }}
{{ item.description }}
+
+ {{ getAllocationBookingModeLabel(item) }} + {{ item.depreciationGroup }} + {{ item.depreciationMonths }} Monate + {{ item.depreciationMethod === 'degressive' ? 'Degressiv' : 'Linear' }} +
+
+ + + + + + + + + + + +
+ +
+ + + + + + + +
+ +
+ + + + + + + +
+
{ itemInfo.value = { ...invoiceData, vendor: invoiceData.vendor?.id || invoiceData.vendor, - accounts: invoiceData.accounts || [] + accounts: normalizeIncomingInvoiceAccounts(invoiceData.accounts || [], invoiceData.date) } // Fallback Accounts if(itemInfo.value.accounts.length === 0) { - itemInfo.value.accounts.push({ account: null, amountNet: null, amountTax: null, taxType: "19", costCentre: null }) + itemInfo.value.accounts.push(createIncomingInvoiceAccount({ depreciationStartDate: itemInfo.value.date || null })) } // Datei laden @@ -92,6 +93,14 @@ const setup = async () => { setup() +watch(() => itemInfo.value.date, (value) => { + ;(itemInfo.value.accounts || []).forEach((account) => { + if (isDepreciationItem(account) && !account.depreciationStartDate) { + account.depreciationStartDate = value || null + } + }) +}) + // --- Berechnungslogik --- const useNetMode = ref(false) @@ -144,6 +153,11 @@ const totalCalculated = computed(() => { const hasAmount = (value) => value !== null && value !== undefined && value !== "" const hasValidNumber = (value) => hasAmount(value) && Number.isFinite(Number(value)) +const isDepreciationItem = (item) => isDepreciationBookingMode(item?.bookingMode) + +const updateBookingMode = (item) => { + ensureDepreciationDefaults(item, itemInfo.value.date) +} const recalculateItem = (item, source) => { const taxRate = Number(taxOptions.value.find(i => i.key === item.taxType)?.percentage || 0); @@ -186,6 +200,7 @@ const updateIncomingInvoice = async (setBooked = false) => { } let item = { ...itemInfo.value } + item.accounts = (item.accounts || []).map((account) => ensureDepreciationDefaults({ ...account }, item.date)) delete item.files item.state = setBooked ? "Gebucht" : "Entwurf" @@ -205,6 +220,7 @@ const findIncomingInvoiceErrors = computed(() => { if(!i.accounts || i.accounts.length === 0) errors.push({message: "Es ist keine Position vorhanden", type: "breaking"}) i.accounts.forEach((account, idx) => { + ensureDepreciationDefaults(account, i.date) if(!account.account) errors.push({message: `Pos ${idx+1}: Keine Kategorie`, type: "breaking"}) if(!hasValidNumber(account.amountNet) && !hasValidNumber(account.amountGross)) { errors.push({message: `Pos ${idx+1}: Kein gültiger Betrag`, type: "breaking"}) @@ -213,6 +229,12 @@ const findIncomingInvoiceErrors = computed(() => { if(hasValidNumber(account.amountNet) && !hasValidNumber(account.amountTax)) { errors.push({message: `Pos ${idx+1}: Steuerbetrag fehlt, bitte Steuer neu berechnen`, type: "warning"}) } + if(isDepreciationItem(account) && !Number(account.depreciationMonths)) { + errors.push({message: `Pos ${idx+1}: Abschreibungsdauer fehlt`, type: "breaking"}) + } + if(account.bookingMode === "depreciation_bundle" && !String(account.depreciationGroup || "").trim()) { + errors.push({message: `Pos ${idx+1}: Sammelposten benötigt einen Gruppennamen`, type: "breaking"}) + } }) const order = { breaking: 0, warning: 1 } @@ -509,7 +531,7 @@ const hasBlockingIncomingInvoiceErrors = computed(() => blockingIncomingInvoiceE value-key="id" :disabled="mode === 'show'" :filter-fields="['label', 'number']" - :color="item.account ? 'primary' : 'error'" + :color="item.account ? 'primary' : 'error'" >