diff --git a/CLAUDE.md b/CLAUDE.md index 00d81d1b48..5a6512b371 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,3 +1,3 @@ To have an overview of what this app does, see @.cursor/rules/windmill-overview.mdc -For backend modifications, follow the rules mentioned here @.cursor/rules/rust-best-practices.mdc +For backend modifications, follow the rules mentioned here @.cursor/rules/rust-best-practices.mdc. You also have access to a summarized version of the database schema here @backend/summarized_schema.txt For frontend modifications, follow the rules mentioned here @.cursor/rules/svelte5-best-practices.mdc diff --git a/backend/summarize_schema.py b/backend/summarize_schema.py new file mode 100644 index 0000000000..a6d929ba9a --- /dev/null +++ b/backend/summarize_schema.py @@ -0,0 +1,154 @@ +# This script is used to summarize the database schema. +# You can use pg_dump to dump the schema to a file. +# pg_dump --file "schema.sql" --host "localhost" --port "5432" --username "postgres" --no-password --format=c --large-objects --schema-only --no-owner --no-privileges --no-tablespaces --no-unlogged-table-data --no-comments --no-publications --no-subscriptions --no-security-labels --no-toast-compression --no-table-access-method --verbose --schema "public" "windmill" +# Then you can run python summarize_schema.py schema.sql to get the summarized schema. + +import re +import sys +from collections import defaultdict + +def summarize_schema(file_path): + """ + Parses a PostgreSQL dump file and extracts a summarized schema. + """ + tables = defaultdict(lambda: {'columns': [], 'pks': set(), 'fks': [], 'indexes': []}) + enums = defaultdict(list) + + # Use state variables to parse multi-line definitions + current_table = None + current_enum = None + + with open(file_path, 'r', encoding='utf-8') as f: + for line in f: + line = line.strip() + + # --- State Resets --- + if line.startswith(');'): + current_table = None + current_enum = None + continue + + # --- Parse ENUM definitions --- + match_enum = re.match(r"CREATE TYPE public\.(\w+) AS ENUM \($", line) + if match_enum: + current_enum = match_enum.group(1) + continue + + if current_enum: + # Extract enum values, which are typically like 'value', + value = line.strip("',") + if value and not value.startswith('--'): + enums[current_enum].append(value) + continue + + # --- Parse TABLE definitions --- + match_table = re.match(r"CREATE TABLE public\.(\w+) \($", line) + if match_table: + current_table = match_table.group(1) + continue + + if current_table: + # Parse columns within a CREATE TABLE block + # e.g., "column_name type NOT NULL," + # e.g., "id bigint NOT NULL," + match_column = re.match(r'^"?(\w+)"?\s+([\w\d\.\[\]\(\)]+)', line) + if match_column: + col_name = match_column.group(1) + col_type = match_column.group(2) + tables[current_table]['columns'].append(f"{col_name} ({col_type})") + + # Parse PRIMARY KEY defined inside the table + match_pk = re.search(r"CONSTRAINT \w+ PRIMARY KEY \((.+)\)", line) + if match_pk: + # Handle multiple PK columns: "col1, col2, col3" + pk_cols = [p.strip().strip('"') for p in match_pk.group(1).split(',')] + tables[current_table]['pks'].update(pk_cols) + continue + + # --- Parse Foreign Keys (defined outside CREATE TABLE) --- + match_fk = re.match(r"ALTER TABLE ONLY public\.(\w+)\s+ADD CONSTRAINT \w+ FOREIGN KEY \(([\w,\s\"]+)\) REFERENCES public\.(\w+)\(([\w,\s\"]+)\);", line) + if match_fk: + from_table, from_cols, to_table, to_cols = match_fk.groups() + # Clean up column names + from_cols_clean = ', '.join([c.strip().strip('"') for c in from_cols.split(',')]) + to_cols_clean = ', '.join([c.strip().strip('"') for c in to_cols.split(',')]) + + fk_string = f"({from_cols_clean}) -> {to_table}({to_cols_clean})" + tables[from_table]['fks'].append(fk_string) + + # --- Parse Index definitions --- + match_index = re.match(r"CREATE (UNIQUE )?INDEX (\w+) ON public\.(\w+) USING (\w+) \((.+)\);", line) + if match_index: + is_unique = match_index.group(1) is not None + index_name = match_index.group(2) + table_name = match_index.group(3) + index_type = match_index.group(4) + columns = match_index.group(5) + + # Clean up column expressions + columns_clean = columns.replace('"', '') + + unique_str = "UNIQUE " if is_unique else "" + index_string = f"{unique_str}INDEX {index_name} ({index_type}) ON ({columns_clean})" + tables[table_name]['indexes'].append(index_string) + + return enums, tables + +def format_output(enums, tables): + """ + Formats the parsed schema data into a clean, readable string. + """ + output = [] + + output.append("### Simplified Database Schema ###") + output.append("\n--- Custom Data Types (ENUMs) ---\n") + if not enums: + output.append("No custom ENUM types found.") + else: + for name, values in sorted(enums.items()): + output.append(f"{name}:") + for v in values: + output.append(f" - {v}") + output.append("") + + output.append("\n--- Tables and Relationships ---\n") + if not tables: + output.append("No tables found.") + else: + for name, data in sorted(tables.items()): + output.append(f"TABLE: {name}") + for col in data['columns']: + col_name = col.split(' ')[0] + marker = " (PK)" if col_name in data['pks'] else "" + output.append(f" - {col}{marker}") + + if data['fks']: + output.append(" Relationships:") + for fk in data['fks']: + output.append(f" - {fk}") + + if data['indexes']: + output.append(" Indexes:") + for idx in data['indexes']: + output.append(f" - {idx}") + output.append("-" * 20) + + return "\n".join(output) + +if __name__ == "__main__": + if len(sys.argv) != 2: + print(f"Usage: python {sys.argv[0]} ") + sys.exit(1) + + input_file = sys.argv[1] + + try: + enums_data, tables_data = summarize_schema(input_file) + formatted_summary = format_output(enums_data, tables_data) + print(formatted_summary) + except FileNotFoundError: + print(f"Error: The file '{input_file}' was not found.") + sys.exit(1) + except Exception as e: + print(f"An unexpected error occurred: {e}") + sys.exit(1) \ No newline at end of file diff --git a/backend/summarized_schema.txt b/backend/summarized_schema.txt new file mode 100644 index 0000000000..a1ae0c1847 --- /dev/null +++ b/backend/summarized_schema.txt @@ -0,0 +1,1085 @@ +### Simplified Database Schema ### + +--- Custom Data Types (ENUMs) --- + +action_kind: + - create + - update + - delete + - execute + +authentication_method: + - none + - windmill + - api_key + - basic_http + - custom_script + - signature + +autoscaling_event_type: + - full_scaleout + - scalein + - scaleout + +aws_auth_resource_type: + - oidc + - credentials + +delivery_mode: + - push + - pull + +draft_type: + - script + - flow + - app + +favorite_kind: + - app + - script + - flow + - raw_app + +gcp_subscription_mode: + - create_update + - existing + +http_method: + - get + - post + - put + - delete + - patch + +importer_kind: + - script + - flow + - app + +job_kind: + - script + - preview + - flow + - dependencies + - flowpreview + - script_hub + - identity + - flowdependencies + - http + - graphql + - postgresql + - noop + - appdependencies + - deploymentcallback + - singlescriptflow + - flowscript + - flownode + - appscript + +job_status: + - success + - failure + - canceled + - skipped + +job_trigger_kind: + - webhook + - http + - websocket + - kafka + - email + - nats + - schedule + - app + - ui + - postgres + - sqs + - gcp + +log_mode: + - standalone + - server + - worker + - agent + - indexer + - mcp + +login_type: + - password + - github + +metric_kind: + - scalar_int + - scalar_float + - timeseries_int + - timeseries_float + +mqtt_client_version: + - v3 + - v5 + +runnable_type: + - ScriptHash + - ScriptPath + - FlowPath + +script_kind: + - script + - trigger + - failure + - command + - approval + - preprocessor + +script_lang: + - python3 + - deno + - go + - bash + - postgresql + - nativets + - bun + - mysql + - bigquery + - snowflake + - graphql + - powershell + - mssql + - php + - bunnative + - rust + - ansible + - csharp + - oracledb + - nu + - java + - duckdb + +trigger_kind: + - webhook + - http + - websocket + - kafka + - email + - nats + - postgres + - sqs + - mqtt + - gcp + +workspace_key_kind: + - cloud + + +--- Tables and Relationships --- + +TABLE: _sqlx_migrations + - version (bigint) + - description (text) + - installed_on (timestamp) + - success (boolean) + - checksum (bytea) + - execution_time (bigint) +-------------------- +TABLE: account + - workspace_id (character) + - id (integer) + - expires_at (timestamp) + - refresh_token (character) + - client (character) + - refresh_error (text) +-------------------- +TABLE: alerts + - id (integer) + - alert_type (character) + - message (text) + - created_at (timestamp) + - acknowledged (boolean) + - workspace_id (text) + - acknowledged_workspace (boolean) + - resource (text) + Indexes: + - INDEX alerts_by_workspace (btree) ON (workspace_id) +-------------------- +TABLE: app + - id (bigint) + - workspace_id (character) + - path (character) + - summary (character) + - policy (jsonb) + - versions (bigint[]) + - extra_perms (jsonb) + - draft_only (boolean) + - custom_path (text) + - CONSTRAINT (app_custom_path_check) +-------------------- +TABLE: app_script + - id (bigint) + - app (bigint) + - hash (character(64)) + - lock (text) + - code (text) + - code_sha256 (character(64)) +-------------------- +TABLE: app_version + - id (bigint) + - app_id (bigint) + - value (json) + - created_by (character) + - created_at (timestamp) + - raw_app (boolean) +-------------------- +TABLE: app_version_lite + - id (bigint) + - value (jsonb) +-------------------- +TABLE: audit + - workspace_id (character) + - id (integer) + - timestamp (timestamp) + - username (character) + - operation (character) + - action_kind (public.action_kind) + - resource (character) + - parameters (jsonb) + Indexes: + - INDEX ix_audit_timestamps (btree) ON (timestamp DESC) +-------------------- +TABLE: autoscaling_event + - id (integer) + - worker_group (text) + - event_type (public.autoscaling_event_type) + - desired_workers (integer) + - applied_at (timestamp) + - reason (text) + Indexes: + - INDEX autoscaling_event_worker_group_idx (btree) ON (worker_group, applied_at) +-------------------- +TABLE: capture + - workspace_id (character) + - path (character) + - created_at (timestamp) + - created_by (character) + - main_args (jsonb) + - is_flow (boolean) + - trigger_kind (public.trigger_kind) + - preprocessor_args (jsonb) + - id (bigint) + - CONSTRAINT (capture_payload_too_big) +-------------------- +TABLE: capture_config + - workspace_id (character) + - path (character) + - is_flow (boolean) + - trigger_kind (public.trigger_kind) + - trigger_config (jsonb) + - owner (character) + - email (character) + - server_id (character) + - last_client_ping (timestamp) + - last_server_ping (timestamp) + - error (text) +-------------------- +TABLE: cloud_workspace_settings + - workspace_id (character) + - threshold_alert_amount (integer) + - last_alert_sent (timestamp) + - last_warning_sent (timestamp) +-------------------- +TABLE: concurrency_counter + - concurrency_id (character) + - job_uuids (jsonb) +-------------------- +TABLE: concurrency_key + - key (character) + - ended_at (timestamp) + - job_id (uuid) + Indexes: + - INDEX concurrency_key_ended_at_idx (btree) ON (key, ended_at DESC) +-------------------- +TABLE: concurrency_locks + - id (character) + - last_locked_at (timestamp) + - owner (character) +-------------------- +TABLE: config + - name (character) + - config (jsonb) +-------------------- +TABLE: custom_concurrency_key_ended + - key (character) + - ended_at (timestamp) +-------------------- +TABLE: dependency_map + - workspace_id (character) + - importer_path (character) + - importer_kind (public.importer_kind) + - imported_path (character) + - importer_node_id (character) + Indexes: + - INDEX dependency_map_imported_path_idx (btree) ON (workspace_id, imported_path) +-------------------- +TABLE: deployment_metadata + - workspace_id (character) + - path (character) + - script_hash (bigint) + - app_version (bigint) + - callback_job_ids (uuid[]) + - deployment_msg (text) + - flow_version (bigint) + Indexes: + - UNIQUE INDEX deployment_metadata_app (btree) ON (workspace_id, path, app_version) WHERE (app_version IS NOT NULL) + - UNIQUE INDEX deployment_metadata_flow (btree) ON (workspace_id, path, flow_version) WHERE (flow_version IS NOT NULL) + - UNIQUE INDEX deployment_metadata_script (btree) ON (workspace_id, script_hash) WHERE (script_hash IS NOT NULL) +-------------------- +TABLE: draft + - workspace_id (character) + - path (character) + - typ (public.draft_type) + - value (json) + - created_at (timestamp) +-------------------- +TABLE: email_to_igroup + - email (character) + - igroup (character) +-------------------- +TABLE: favorite + - usr (character) + - workspace_id (character) + - path (character) + - favorite_kind (public.favorite_kind) +-------------------- +TABLE: flow + - workspace_id (character) + - path (character) + - summary (text) + - description (text) + - value (jsonb) + - edited_by (character) + - edited_at (timestamp) + - archived (boolean) + - schema (json) + - extra_perms (jsonb) + - dependency_job (uuid) + - draft_only (boolean) + - tag (character) + - ws_error_handler_muted (boolean) + - dedicated_worker (boolean) + - timeout (integer) + - visible_to_runner_only (boolean) + - concurrency_key (character) + - versions (bigint[]) + - on_behalf_of_email (text) + - lock_error_logs (text) + - CONSTRAINT (proper_id) + Indexes: + - INDEX flow_extra_perms (gin) ON (extra_perms) +-------------------- +TABLE: flow_node + - id (bigint) + - workspace_id (character) + - hash (bigint) + - path (character) + - lock (text) + - code (text) + - flow (jsonb) + - hash_v2 (character(64)) + Indexes: + - INDEX flow_node_hash (btree) ON (hash) +-------------------- +TABLE: flow_version + - id (bigint) + - workspace_id (character) + - path (character) + - value (jsonb) + - schema (json) + - created_by (character) + - created_at (timestamp) + Indexes: + - INDEX index_flow_version_path_created_at (btree) ON (path, created_at) +-------------------- +TABLE: flow_version_lite + - id (bigint) + - value (jsonb) +-------------------- +TABLE: folder + - name (character) + - workspace_id (character) + - display_name (character) + - owners (character) + - extra_perms (jsonb) + - summary (text) + - edited_at (timestamp) + - created_by (character) + Indexes: + - INDEX folder_extra_perms (gin) ON (extra_perms) + - INDEX folder_owners (gin) ON (owners) +-------------------- +TABLE: gcp_trigger + - gcp_resource_path (character) + - topic_id (character) + - subscription_id (character) + - delivery_type (public.delivery_mode) + - delivery_config (jsonb) + - path (character) + - script_path (character) + - is_flow (boolean) + - workspace_id (character) + - edited_by (character) + - email (character) + - edited_at (timestamp) + - extra_perms (jsonb) + - server_id (character) + - last_server_ping (timestamp) + - error (text) + - enabled (boolean) + - subscription_mode (public.gcp_subscription_mode) + - CONSTRAINT (gcp_trigger_check) + - CONSTRAINT (gcp_trigger_subscription_id_check) + - CONSTRAINT (gcp_trigger_topic_id_check) + Indexes: + - UNIQUE INDEX unique_subscription_per_gcp_resource (btree) ON (subscription_id, gcp_resource_path, workspace_id) +-------------------- +TABLE: global_settings + - name (character) + - value (jsonb) + - updated_at (timestamp) +-------------------- +TABLE: group_ + - workspace_id (character) + - name (character) + - summary (text) + - extra_perms (jsonb) + - CONSTRAINT (proper_name) + Indexes: + - INDEX group_extra_perms (gin) ON (extra_perms) +-------------------- +TABLE: healthchecks + - id (bigint) + - check_type (character) + - healthy (boolean) + - created_at (timestamp) + Indexes: + - INDEX healthchecks_check_type_created_at (btree) ON (check_type, created_at) +-------------------- +TABLE: http_trigger + - path (character) + - route_path (character) + - route_path_key (character) + - script_path (character) + - is_flow (boolean) + - workspace_id (character) + - edited_by (character) + - email (character) + - edited_at (timestamp) + - extra_perms (jsonb) + - is_async (boolean) + - authentication_method (public.authentication_method) + - http_method (public.http_method) + - static_asset_config (jsonb) + - is_static_website (boolean) + - workspaced_route (boolean) + - wrap_body (boolean) + - raw_string (boolean) + - authentication_resource_path (character) +-------------------- +TABLE: input + - id (uuid) + - workspace_id (character) + - runnable_id (character) + - runnable_type (public.runnable_type) + - name (text) + - args (jsonb) + - created_at (timestamp) + - created_by (character) + - is_public (boolean) +-------------------- +TABLE: instance_group + - name (character) + - summary (character) + - id (character) + - scim_display_name (character) + - external_id (character) +-------------------- +TABLE: job_logs + - job_id (uuid) + - workspace_id (character) + - created_at (timestamp) + - logs (text) + - log_offset (integer) + - log_file_index (text[]) +-------------------- +TABLE: job_perms + - job_id (uuid) + - email (character) + - username (character) + - is_admin (boolean) + - is_operator (boolean) + - created_at (timestamp) + - workspace_id (character) + - groups (text[]) + - folders (jsonb[]) +-------------------- +TABLE: job_stats + - workspace_id (character) + - job_id (uuid) + - metric_id (character) + - metric_name (character) + - metric_kind (public.metric_kind) + - scalar_int (integer) + - scalar_float (real) + - timestamps (timestamp) + - timeseries_int (integer[]) + - timeseries_float (real[]) + Indexes: + - INDEX job_stats_id (btree) ON (job_id) +-------------------- +TABLE: kafka_trigger + - path (character) + - kafka_resource_path (character) + - topics (character) + - group_id (character) + - script_path (character) + - is_flow (boolean) + - workspace_id (character) + - edited_by (character) + - email (character) + - edited_at (timestamp) + - extra_perms (jsonb) + - server_id (character) + - last_server_ping (timestamp) + - error (text) + - enabled (boolean) +-------------------- +TABLE: log_file + - hostname (character) + - log_ts (timestamp) + - ok_lines (bigint) + - err_lines (bigint) + - mode (public.log_mode) + - worker_group (character) + - file_path (character) + - json_fmt (boolean) + Indexes: + - INDEX log_file_log_ts_idx (btree) ON (log_ts) +-------------------- +TABLE: magic_link + - email (character) + - token (character) + - expiration (timestamp) + Indexes: + - INDEX index_magic_link_exp (btree) ON (expiration) +-------------------- +TABLE: metrics + - id (character) + - value (jsonb) + - created_at (timestamp) + Indexes: + - INDEX idx_metrics_id_created_at (btree) ON (id, created_at DESC) WHERE ((id)::text ~~ 'queue_%'::text) + - INDEX metrics_key_idx (btree) ON (id) + - INDEX metrics_sort_idx (btree) ON (created_at DESC) +-------------------- +TABLE: mqtt_trigger + - mqtt_resource_path (character) + - subscribe_topics (jsonb[]) + - client_version (public.mqtt_client_version) + - v5_config (jsonb) + - v3_config (jsonb) + - client_id (character) + - path (character) + - script_path (character) + - is_flow (boolean) + - workspace_id (character) + - edited_by (character) + - email (character) + - edited_at (timestamp) + - extra_perms (jsonb) + - server_id (character) + - last_server_ping (timestamp) + - error (text) + - enabled (boolean) +-------------------- +TABLE: nats_trigger + - path (character) + - nats_resource_path (character) + - subjects (character) + - stream_name (character) + - consumer_name (character) + - use_jetstream (boolean) + - script_path (character) + - is_flow (boolean) + - workspace_id (character) + - edited_by (character) + - email (character) + - edited_at (timestamp) + - extra_perms (jsonb) + - server_id (character) + - last_server_ping (timestamp) + - error (text) + - enabled (boolean) +-------------------- +TABLE: outstanding_wait_time + - job_id (uuid) + - self_wait_time_ms (bigint) + - aggregate_wait_time_ms (bigint) +-------------------- +TABLE: parallel_monitor_lock + - parent_flow_id (uuid) + - job_id (uuid) + - last_ping (timestamp) +-------------------- +TABLE: password + - email (character) + - password_hash (character) + - login_type (character) + - super_admin (boolean) + - verified (boolean) + - name (character) + - company (character) + - first_time_user (boolean) + - username (character) + - devops (boolean) +-------------------- +TABLE: pending_user + - email (character) + - created_at (timestamp) + - username (character) +-------------------- +TABLE: pip_resolution_cache + - hash (character) + - expiration (timestamp) + - lockfile (text) +-------------------- +TABLE: postgres_trigger + - path (character) + - script_path (character) + - is_flow (boolean) + - workspace_id (character) + - edited_by (character) + - email (character) + - edited_at (timestamp) + - extra_perms (jsonb) + - postgres_resource_path (character) + - error (text) + - server_id (character) + - last_server_ping (timestamp) + - replication_slot_name (character) + - publication_name (character) + - enabled (boolean) +-------------------- +TABLE: raw_app + - path (character) + - version (integer) + - workspace_id (character) + - summary (character) + - edited_at (timestamp) + - data (text) + - extra_perms (jsonb) +-------------------- +TABLE: resource + - workspace_id (character) + - path (character) + - value (jsonb) + - description (text) + - resource_type (character) + - extra_perms (jsonb) + - edited_at (timestamp) + - created_by (character) + - CONSTRAINT (proper_id) + Indexes: + - INDEX resource_extra_perms (gin) ON (extra_perms) +-------------------- +TABLE: resource_type + - workspace_id (character) + - name (character) + - schema (jsonb) + - description (text) + - edited_at (timestamp) + - created_by (character) + - format_extension (character) + - CONSTRAINT (proper_name) +-------------------- +TABLE: resume_job + - id (uuid) + - job (uuid) + - flow (uuid) + - created_at (timestamp) + - value (jsonb) + - approver (character) + - resume_id (integer) + - approved (boolean) +-------------------- +TABLE: schedule + - workspace_id (character) + - path (character) + - edited_by (character) + - edited_at (timestamp) + - schedule (character) + - enabled (boolean) + - script_path (character) + - args (jsonb) + - extra_perms (jsonb) + - is_flow (boolean) + - email (character) + - error (text) + - timezone (character) + - on_failure (character) + - on_recovery (character) + - on_failure_times (integer) + - on_failure_exact (boolean) + - on_failure_extra_args (jsonb) + - on_recovery_times (integer) + - on_recovery_extra_args (jsonb) + - ws_error_handler_muted (boolean) + - retry (jsonb) + - summary (character) + - no_flow_overlap (boolean) + - tag (character) + - paused_until (timestamp) + - on_success (character) + - on_success_extra_args (jsonb) + - cron_version (text) + - description (text) + - CONSTRAINT (proper_id) + Indexes: + - INDEX schedule_extra_perms (gin) ON (extra_perms) +-------------------- +TABLE: script + - workspace_id (character) + - hash (bigint) + - path (character) + - parent_hashes (bigint[]) + - summary (text) + - description (text) + - content (text) + - created_by (character) + - created_at (timestamp) + - archived (boolean) + - schema (json) + - deleted (boolean) + - is_template (boolean) + - extra_perms (jsonb) + - lock (text) + - lock_error_logs (text) + - language (public.script_lang) + - kind (public.script_kind) + - tag (character) + - draft_only (boolean) + - envs (character) + - concurrent_limit (integer) + - concurrency_time_window_s (integer) + - cache_ttl (integer) + - dedicated_worker (boolean) + - ws_error_handler_muted (boolean) + - priority (smallint) + - timeout (integer) + - delete_after_use (boolean) + - restart_unless_cancelled (boolean) + - concurrency_key (character) + - visible_to_runner_only (boolean) + - no_main_func (boolean) + - codebase (character) + - has_preprocessor (boolean) + - on_behalf_of_email (text) + - schema_validation (boolean) + - CONSTRAINT (proper_id) + Indexes: + - INDEX index_script_on_path_created_at (btree) ON (workspace_id, path, created_at DESC) + - INDEX script_extra_perms (gin) ON (extra_perms) +-------------------- +TABLE: sqs_trigger + - path (character) + - queue_url (character) + - aws_resource_path (character) + - message_attributes (text[]) + - script_path (character) + - is_flow (boolean) + - workspace_id (character) + - edited_by (character) + - email (character) + - edited_at (timestamp) + - extra_perms (jsonb) + - error (text) + - server_id (character) + - last_server_ping (timestamp) + - enabled (boolean) + - aws_auth_resource_type (public.aws_auth_resource_type) +-------------------- +TABLE: token + - token (character) + - label (character) + - expiration (timestamp) + - workspace_id (character) + - owner (character) + - email (character) + - super_admin (boolean) + - created_at (timestamp) + - last_used_at (timestamp) + - scopes (text[]) + - job (uuid) + Indexes: + - INDEX index_token_exp (btree) ON (expiration) +-------------------- +TABLE: tutorial_progress + - email (character) + - progress (bit(64)) +-------------------- +TABLE: usage + - id (character) + - is_workspace (boolean) + - month_ (integer) + - usage (integer) +-------------------- +TABLE: usr + - workspace_id (character) + - username (character) + - email (character) + - is_admin (boolean) + - created_at (timestamp) + - operator (boolean) + - disabled (boolean) + - role (character) + - CONSTRAINT (proper_email) + - CONSTRAINT (proper_username) + Indexes: + - INDEX index_usr_email (btree) ON (email) +-------------------- +TABLE: usr_to_group + - workspace_id (character) + - group_ (character) + - usr (character) +-------------------- +TABLE: v2_job + - id (uuid) + - raw_code (text) + - raw_lock (text) + - raw_flow (jsonb) + - tag (character) + - workspace_id (character) + - created_at (timestamp) + - created_by (character) + - permissioned_as (character) + - permissioned_as_email (character) + - kind (public.job_kind) + - runnable_id (bigint) + - runnable_path (character) + - parent_job (uuid) + - root_job (uuid) + - script_lang (public.script_lang) + - script_entrypoint_override (character) + - flow_step (integer) + - flow_step_id (character) + - flow_innermost_root_job (uuid) + - trigger (character) + - trigger_kind (public.job_trigger_kind) + - same_worker (boolean) + - visible_to_owner (boolean) + - concurrent_limit (integer) + - concurrency_time_window_s (integer) + - cache_ttl (integer) + - timeout (integer) + - priority (smallint) + - preprocessed (boolean) + - args (jsonb) + - labels (text[]) + - pre_run_error (text) + Indexes: + - INDEX ix_job_created_at (btree) ON (created_at DESC) + - INDEX ix_job_root_job_index_by_path_2 (btree) ON (workspace_id, runnable_path, created_at DESC) WHERE (parent_job IS NULL) + - INDEX ix_job_workspace_id_created_at_new_3 (btree) ON (workspace_id, created_at DESC) + - INDEX ix_job_workspace_id_created_at_new_5 (btree) ON (workspace_id, created_at DESC) WHERE ((kind = ANY (ARRAY['preview'::public.job_kind, 'flowpreview'::public.job_kind])) AND (parent_job IS NULL)) + - INDEX ix_job_workspace_id_created_at_new_8 (btree) ON (workspace_id, created_at DESC) WHERE ((kind = 'deploymentcallback'::public.job_kind) AND (parent_job IS NULL)) + - INDEX ix_job_workspace_id_created_at_new_9 (btree) ON (workspace_id, created_at DESC) WHERE ((kind = ANY (ARRAY['dependencies'::public.job_kind, 'flowdependencies'::public.job_kind, 'appdependencies'::public.job_kind])) AND (parent_job IS NULL)) + - INDEX ix_v2_job_labels (gin) ON (labels) WHERE (labels IS NOT NULL) + - INDEX ix_v2_job_workspace_id_created_at (btree) ON (workspace_id, created_at DESC) WHERE ((kind = ANY (ARRAY['script'::public.job_kind, 'flow'::public.job_kind, 'singlescriptflow'::public.job_kind])) AND (parent_job IS NULL)) +-------------------- +TABLE: v2_job_completed + - id (uuid) + - workspace_id (character) + - duration_ms (bigint) + - result (jsonb) + - deleted (boolean) + - canceled_by (character) + - canceled_reason (text) + - flow_status (jsonb) + - started_at (timestamp) + - memory_peak (integer) + - status (public.job_status) + - completed_at (timestamp) + - worker (character) + - workflow_as_code_status (jsonb) + - result_columns (text[]) + - retries (uuid[]) + - extras (jsonb) + Indexes: + - INDEX ix_completed_job_workspace_id_started_at_new_2 (btree) ON (workspace_id, started_at DESC) + - INDEX ix_job_completed_completed_at (btree) ON (completed_at DESC) + - INDEX labeled_jobs_on_jobs (gin) ON (((result -> 'wm_labels'::text))) WHERE (result ? 'wm_labels'::text) +-------------------- +TABLE: v2_job_queue + - id (uuid) + - workspace_id (character) + - created_at (timestamp) + - started_at (timestamp) + - scheduled_for (timestamp) + - running (boolean) + - canceled_by (character) + - canceled_reason (text) + - suspend (integer) + - suspend_until (timestamp) + - tag (character) + - priority (smallint) + - worker (character) + - extras (jsonb) + Indexes: + - INDEX queue_sort_v2 (btree) ON (priority DESC NULLS LAST, scheduled_for, tag) WHERE (running = false) + - INDEX queue_suspended (btree) ON (priority DESC NULLS LAST, created_at, suspend_until, suspend, tag) WHERE (suspend_until IS NOT NULL) + - INDEX root_queue_index_by_path (btree) ON (workspace_id, created_at) + - INDEX v2_job_queue_suspend (btree) ON (workspace_id, suspend) WHERE (suspend > 0) +-------------------- +TABLE: v2_job_runtime + - id (uuid) + - ping (timestamp) + - memory_peak (integer) +-------------------- +TABLE: v2_job_status + - id (uuid) + - flow_status (jsonb) + - flow_leaf_jobs (jsonb) + - workflow_as_code_status (jsonb) +-------------------- +TABLE: variable + - workspace_id (character) + - path (character) + - value (character) + - is_secret (boolean) + - description (character) + - extra_perms (jsonb) + - account (integer) + - is_oauth (boolean) + - expires_at (timestamp) + - CONSTRAINT (proper_id) + Indexes: + - INDEX variable_extra_perms (gin) ON (extra_perms) +-------------------- +TABLE: websocket_trigger + - path (character) + - url (character) + - script_path (character) + - is_flow (boolean) + - workspace_id (character) + - edited_by (character) + - email (character) + - edited_at (timestamp) + - extra_perms (jsonb) + - server_id (character) + - last_server_ping (timestamp) + - error (text) + - enabled (boolean) + - filters (jsonb[]) + - initial_messages (jsonb[]) + - url_runnable_args (jsonb) + - can_return_message (boolean) +-------------------- +TABLE: windmill_migrations + - name (text) + - created_at (timestamp) +-------------------- +TABLE: worker_ping + - worker (character) + - worker_instance (character) + - ping_at (timestamp) + - started_at (timestamp) + - ip (character) + - jobs_executed (integer) + - custom_tags (text[]) + - worker_group (character) + - dedicated_worker (character) + - wm_version (character) + - current_job_id (uuid) + - current_job_workspace_id (character) + - vcpus (bigint) + - memory (bigint) + - occupancy_rate (real) + - memory_usage (bigint) + - wm_memory_usage (bigint) + - occupancy_rate_15s (real) + - occupancy_rate_5m (real) + - occupancy_rate_30m (real) + Indexes: + - INDEX worker_ping_on_ping_at (btree) ON (ping_at) +-------------------- +TABLE: workspace + - id (character) + - name (character) + - owner (character) + - deleted (boolean) + - premium (boolean) + - CONSTRAINT (proper_id) +-------------------- +TABLE: workspace_env + - workspace_id (character) + - name (character) + - value (character) +-------------------- +TABLE: workspace_invite + - workspace_id (character) + - email (character) + - is_admin (boolean) + - operator (boolean) + - CONSTRAINT (proper_email) +-------------------- +TABLE: workspace_key + - workspace_id (character) + - kind (public.workspace_key_kind) + - key (character) +-------------------- +TABLE: workspace_runnable_dependencies + - flow_path (character) + - runnable_path (character) + - script_hash (bigint) + - runnable_is_flow (boolean) + - workspace_id (character) + - app_path (character) + - CONSTRAINT (workspace_runnable_dependencies_path_exclusive) + Indexes: + - UNIQUE INDEX app_workspace_with_hash_unique_idx (btree) ON (app_path, runnable_path, script_hash, runnable_is_flow, workspace_id) WHERE (script_hash IS NOT NULL) + - UNIQUE INDEX app_workspace_without_hash_unique_idx (btree) ON (app_path, runnable_path, runnable_is_flow, workspace_id) WHERE (script_hash IS NULL) + - INDEX flow_workspace_runnable_path_is_flow_idx (btree) ON (runnable_path, runnable_is_flow, workspace_id) + - UNIQUE INDEX flow_workspace_with_hash_unique_idx (btree) ON (flow_path, runnable_path, script_hash, runnable_is_flow, workspace_id) WHERE (script_hash IS NOT NULL) + - UNIQUE INDEX flow_workspace_without_hash_unique_idx (btree) ON (flow_path, runnable_path, runnable_is_flow, workspace_id) WHERE (script_hash IS NULL) +-------------------- +TABLE: workspace_settings + - workspace_id (character) + - slack_team_id (character) + - slack_name (character) + - slack_command_script (character) + - slack_email (character) + - auto_invite_domain (character) + - auto_invite_operator (boolean) + - customer_id (character) + - plan (character) + - webhook (text) + - deploy_to (character) + - error_handler (character) + - ai_config (jsonb) + - error_handler_extra_args (json) + - error_handler_muted_on_cancel (boolean) + - large_file_storage (jsonb) + - git_sync (jsonb) + - default_app (character) + - auto_add (boolean) + - default_scripts (jsonb) + - deploy_ui (jsonb) + - mute_critical_alerts (boolean) + - color (character) + - operator_settings (jsonb) + - teams_command_script (text) + - teams_team_id (text) + - teams_team_name (text) + - git_app_installations (jsonb) +-------------------- +TABLE: zombie_job_counter + - job_id (uuid) + - counter (integer) +--------------------