From 7607a583cf44503272b789d09f151cd133ffa791 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Thu, 5 Mar 2026 13:30:52 -0600 Subject: [PATCH] perf(ci): optimize database setup with structure.sql (99.7% faster) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace sequential migration execution (4m8s for 172 migrations) with structure.sql loading (416ms), reducing CI database setup time by 99.7%. Changes: - Configure Ecto to dump/load schema from priv/repo/structure.sql - Update test alias: ecto.migrate → ecto.load - Remove redundant database setup step from CI workflow - Commit structure.sql to repository for version control Benefits: - CI database setup: 4m8s → 416ms (248s → 0.4s) - Consistent schema snapshots across environments - Faster local test runs Maintenance: - Run 'mix ecto.dump' after adding new migrations - Structure file auto-updates with schema changes --- .forgejo/workflows/build.yaml | 3 - CHANGELOG.txt | 12 + config/config.exs | 6 + mix.exs | 2 +- priv/repo/structure.sql | 5476 +++++++++++++++++++++++++++++++++ 5 files changed, 5495 insertions(+), 4 deletions(-) create mode 100644 priv/repo/structure.sql diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index a4c88f98..d51b3415 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -85,9 +85,6 @@ jobs: done echo "PostgreSQL is ready!" - - name: Setup database - run: mix ecto.create - - name: Check code formatting run: mix format --check-formatted diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 04fc5e7c..f212d709 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,4 +1,16 @@ 2026-03-05 +perf: optimize CI database setup with structure.sql dumps (99.7% faster) + - Replace sequential migration runs (4m8s) with structure.sql loading (416ms) + - Configure Ecto to dump schema to priv/repo/structure.sql + - Update test alias to use ecto.load instead of ecto.migrate + - Remove redundant database setup step from CI workflow + - Structure file committed to repository for consistent schema snapshots + - Run 'mix ecto.dump' after migrations to update structure.sql +Files: config/config.exs, + mix.exs, + .forgejo/workflows/build.yaml, + priv/repo/structure.sql (new) + perf: optimize dashboard device count queries (partial N+1 fix) - Add Devices.batch_count_site_devices/1 for batching site device counts - Replaces 2N queries with 1 query (count_site_devices + count_site_devices_down) diff --git a/config/config.exs b/config/config.exs index 01a3e138..79db457b 100644 --- a/config/config.exs +++ b/config/config.exs @@ -102,6 +102,12 @@ config :tailwind, # at the `config/runtime.exs`. config :towerops, Towerops.Mailer, adapter: Swoosh.Adapters.Local +# Configure Ecto to use SQL structure dumps for faster test setup +# This allows CI to load the schema instantly instead of running 172+ migrations +config :towerops, Towerops.Repo, + dump_path: "priv/repo/structure.sql", + migration_timestamps: [type: :naive_datetime_usec] + # Configure the endpoint config :towerops, ToweropsWeb.Endpoint, url: [host: "localhost"], diff --git a/mix.exs b/mix.exs index 6fdab8d4..01dc3fc8 100644 --- a/mix.exs +++ b/mix.exs @@ -122,7 +122,7 @@ defmodule Towerops.MixProject do setup: ["deps.get", "ecto.setup", "assets.setup", "assets.build"], "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"], "ecto.reset": ["ecto.drop", "ecto.setup"], - test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"], + test: ["ecto.create --quiet", "ecto.load --quiet", "test"], "assets.setup": ["tailwind.install --if-missing", "esbuild.install --if-missing"], "assets.build": ["compile", "tailwind towerops", "esbuild towerops"], "assets.deploy": [ diff --git a/priv/repo/structure.sql b/priv/repo/structure.sql new file mode 100644 index 00000000..b5e687ce --- /dev/null +++ b/priv/repo/structure.sql @@ -0,0 +1,5476 @@ +-- +-- PostgreSQL database dump +-- + +\restrict r3N6TGQGFjg82OQMzKEaIDkXV6NW6WJUq2RgUxqvirlVBMgNcH04JLB0uwke4FU + +-- Dumped from database version 17.9 (Homebrew) +-- Dumped by pg_dump version 17.9 (Homebrew) + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET transaction_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +-- +-- Name: timescaledb; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS timescaledb WITH SCHEMA public; + + +-- +-- Name: EXTENSION timescaledb; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION timescaledb IS 'Enables scalable inserts and complex queries for time-series data (Community Edition)'; + + +-- +-- Name: citext; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS citext WITH SCHEMA public; + + +-- +-- Name: EXTENSION citext; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION citext IS 'data type for case-insensitive character strings'; + + +-- +-- Name: pg_stat_statements; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS pg_stat_statements WITH SCHEMA public; + + +-- +-- Name: EXTENSION pg_stat_statements; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION pg_stat_statements IS 'track planning and execution statistics of all SQL statements executed'; + + +-- +-- Name: sslinfo; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS sslinfo WITH SCHEMA public; + + +-- +-- Name: EXTENSION sslinfo; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION sslinfo IS 'information about SSL certificates'; + + +-- +-- Name: oban_job_state; Type: TYPE; Schema: public; Owner: - +-- + +CREATE TYPE public.oban_job_state AS ENUM ( + 'available', + 'scheduled', + 'executing', + 'retryable', + 'completed', + 'discarded', + 'cancelled' +); + + +-- +-- Name: oban_state_to_bit(public.oban_job_state); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.oban_state_to_bit(state public.oban_job_state) RETURNS jsonb + LANGUAGE sql IMMUTABLE STRICT + AS $$ +SELECT CASE + WHEN state = 'scheduled' THEN '0'::jsonb + WHEN state = 'available' THEN '1'::jsonb + WHEN state = 'executing' THEN '2'::jsonb + WHEN state = 'retryable' THEN '3'::jsonb + WHEN state = 'completed' THEN '4'::jsonb + WHEN state = 'cancelled' THEN '5'::jsonb + WHEN state = 'discarded' THEN '6'::jsonb + END; +$$; + + +SET default_tablespace = ''; + +SET default_table_access_method = heap; + +-- +-- Name: agent_assignments; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.agent_assignments ( + id uuid NOT NULL, + enabled boolean DEFAULT true NOT NULL, + agent_token_id uuid NOT NULL, + device_id uuid NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: agent_tokens; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.agent_tokens ( + id uuid NOT NULL, + name character varying(255) NOT NULL, + last_seen_at timestamp(0) without time zone, + last_ip character varying(255), + enabled boolean DEFAULT true NOT NULL, + metadata jsonb DEFAULT '{}'::jsonb NOT NULL, + organization_id uuid, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL, + token text NOT NULL, + is_cloud_poller boolean DEFAULT false NOT NULL, + allow_remote_debug boolean DEFAULT false NOT NULL, + CONSTRAINT cloud_poller_no_org CHECK ((((is_cloud_poller = false) AND (organization_id IS NOT NULL)) OR ((is_cloud_poller = true) AND (organization_id IS NULL)))) +); + + +-- +-- Name: alerts; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.alerts ( + id uuid NOT NULL, + device_id uuid, + alert_type character varying(255) NOT NULL, + triggered_at timestamp(0) without time zone NOT NULL, + acknowledged_at timestamp(0) without time zone, + acknowledged_by_id uuid, + resolved_at timestamp(0) without time zone, + message text, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL, + email_sent_at timestamp(0) without time zone, + check_id uuid, + severity integer DEFAULT 2, + notification_sent boolean DEFAULT false, + notification_sent_at timestamp(0) without time zone, + output text, + gaiia_impact jsonb, + organization_id uuid +); + + +-- +-- Name: api_tokens; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.api_tokens ( + id uuid NOT NULL, + organization_id uuid NOT NULL, + name character varying(255) NOT NULL, + token_hash character varying(255) NOT NULL, + last_used_at timestamp(0) without time zone, + expires_at timestamp(0) without time zone, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL, + user_id uuid +); + + +-- +-- Name: application_settings; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.application_settings ( + id uuid NOT NULL, + key character varying(255) NOT NULL, + value text, + value_type character varying(255) DEFAULT 'string'::character varying NOT NULL, + description text, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: audit_logs; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.audit_logs ( + id uuid NOT NULL, + action character varying(255) NOT NULL, + superuser_id uuid, + target_user_id uuid, + metadata jsonb DEFAULT '{}'::jsonb, + ip_address character varying(255), + inserted_at timestamp(0) without time zone NOT NULL, + user_agent text, + request_path character varying(255), + data_accessed jsonb +); + + +-- +-- Name: browser_sessions; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.browser_sessions ( + id uuid NOT NULL, + user_id uuid, + user_token_id uuid NOT NULL, + device_name character varying(255), + browser_name character varying(255), + browser_version character varying(255), + os_name character varying(255), + os_version character varying(255), + device_type character varying(255), + ip_address character varying(255) NOT NULL, + country_code character varying(255), + country_name character varying(255), + city_name character varying(255), + subdivision_1_name character varying(255), + last_activity_at timestamp(0) without time zone NOT NULL, + expires_at timestamp(0) without time zone NOT NULL, + anonymized_at timestamp(0) without time zone, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: check_results; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.check_results ( + id uuid NOT NULL, + checked_at timestamp(0) without time zone NOT NULL, + organization_id uuid NOT NULL, + check_id uuid NOT NULL, + status integer NOT NULL, + output text, + response_time_ms double precision, + agent_token_id uuid, + value double precision +); + + +-- +-- Name: checks; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.checks ( + id uuid NOT NULL, + organization_id uuid NOT NULL, + device_id uuid, + name character varying(255) NOT NULL, + check_type character varying(255) NOT NULL, + description text, + interval_seconds integer DEFAULT 60 NOT NULL, + retry_interval_seconds integer DEFAULT 30 NOT NULL, + max_check_attempts integer DEFAULT 3 NOT NULL, + timeout_ms integer DEFAULT 5000 NOT NULL, + enabled boolean DEFAULT true NOT NULL, + config jsonb DEFAULT '{}'::jsonb NOT NULL, + current_state integer DEFAULT 3 NOT NULL, + current_state_type character varying(255) DEFAULT 'soft'::character varying NOT NULL, + current_check_attempt integer DEFAULT 1 NOT NULL, + last_check_at timestamp(0) without time zone, + last_state_change_at timestamp(0) without time zone, + last_hard_state_change_at timestamp(0) without time zone, + enable_flapping boolean DEFAULT false NOT NULL, + flapping_threshold_low double precision DEFAULT 25.0 NOT NULL, + flapping_threshold_high double precision DEFAULT 30.0 NOT NULL, + is_flapping boolean DEFAULT false NOT NULL, + flapping_state_changes integer DEFAULT 0 NOT NULL, + flapping_window_start_at timestamp(0) without time zone, + enable_passive_checks boolean DEFAULT false NOT NULL, + freshness_threshold_seconds integer, + check_key character varying(255), + agent_token_id uuid, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL, + source_type character varying(255), + source_id uuid +); + + +-- +-- Name: config_change_events; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.config_change_events ( + id uuid NOT NULL, + device_id uuid NOT NULL, + organization_id uuid NOT NULL, + backup_before_id uuid, + backup_after_id uuid, + changed_at timestamp(0) without time zone NOT NULL, + diff_summary text, + sections_changed character varying(255)[] DEFAULT ARRAY[]::character varying[], + change_size integer DEFAULT 0, + inserted_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: device_backup_requests; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.device_backup_requests ( + id uuid NOT NULL, + device_id uuid NOT NULL, + job_id character varying(255) NOT NULL, + requested_at timestamp(0) without time zone NOT NULL, + completed_at timestamp(0) without time zone, + status character varying(255) NOT NULL, + error_message text, + inserted_at timestamp(0) without time zone NOT NULL, + source character varying(255) DEFAULT 'daily_cron'::character varying +); + + +-- +-- Name: device_events; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.device_events ( + id uuid NOT NULL, + device_id uuid NOT NULL, + event_type character varying(255) NOT NULL, + severity character varying(255) NOT NULL, + message text NOT NULL, + metadata jsonb DEFAULT '{}'::jsonb, + occurred_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: device_firmware_history; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.device_firmware_history ( + id uuid NOT NULL, + snmp_device_id uuid NOT NULL, + old_version character varying(255), + new_version character varying(255) NOT NULL, + detected_at timestamp(0) without time zone NOT NULL, + detection_method character varying(255), + inserted_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: device_link_evidence; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.device_link_evidence ( + id uuid NOT NULL, + device_link_id uuid NOT NULL, + evidence_type character varying(255) NOT NULL, + evidence_data jsonb DEFAULT '{}'::jsonb, + observed_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: device_links; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.device_links ( + id uuid NOT NULL, + source_device_id uuid NOT NULL, + target_device_id uuid, + source_interface_id uuid, + target_interface_id uuid, + link_type character varying(255) NOT NULL, + confidence double precision DEFAULT 0.5 NOT NULL, + metadata jsonb DEFAULT '{}'::jsonb, + discovered_remote_name character varying(255), + discovered_remote_ip character varying(255), + discovered_remote_mac character varying(255), + last_confirmed_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: device_mikrotik_backups; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.device_mikrotik_backups ( + id uuid NOT NULL, + device_id uuid NOT NULL, + config_compressed bytea NOT NULL, + config_hash character varying(255) NOT NULL, + config_hash_normalized character varying(255) NOT NULL, + config_size_bytes integer, + compressed_size_bytes integer, + backed_up_at timestamp(0) without time zone NOT NULL, + trigger_source character varying(255) DEFAULT 'daily_cron'::character varying, + inserted_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: device_neighbors; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.device_neighbors ( + id uuid NOT NULL, + device_id uuid NOT NULL, + neighbor_device_id uuid, + neighbor_name character varying(255) NOT NULL, + local_port character varying(255) NOT NULL, + remote_port character varying(255), + remote_port_id character varying(255), + management_addresses character varying(255)[] DEFAULT ARRAY[]::character varying[], + discovered_at timestamp(0) without time zone NOT NULL, + last_seen_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: device_profiles; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.device_profiles ( + id uuid NOT NULL, + name character varying(255) NOT NULL, + vendor character varying(255) NOT NULL, + detection_pattern text, + detection_oid text, + priority integer DEFAULT 100, + enabled boolean DEFAULT true, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: device_subscriber_links; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.device_subscriber_links ( + id uuid NOT NULL, + organization_id uuid NOT NULL, + device_id uuid NOT NULL, + gaiia_account_id uuid NOT NULL, + gaiia_inventory_item_id uuid, + match_method character varying(255) NOT NULL, + confidence character varying(255) NOT NULL, + subscriber_ip character varying(255), + subscriber_mac character varying(255), + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: devices; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.devices ( + id uuid NOT NULL, + site_id uuid, + name character varying(255), + ip_address character varying(255) NOT NULL, + description text, + status character varying(255) DEFAULT 'unknown'::character varying NOT NULL, + last_checked_at timestamp(0) without time zone, + last_status_change_at timestamp(0) without time zone, + monitoring_enabled boolean DEFAULT true NOT NULL, + check_interval_seconds integer DEFAULT 300 NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL, + snmp_enabled boolean DEFAULT true NOT NULL, + snmp_version character varying(255), + snmp_community character varying(255), + snmp_port integer DEFAULT 161, + last_discovery_at timestamp(0) without time zone, + last_snmp_poll_at timestamp(0) without time zone, + display_order integer, + snmp_community_source character varying(255) DEFAULT 'device'::character varying, + mikrotik_username character varying, + mikrotik_password bytea, + mikrotik_port integer, + mikrotik_use_ssl boolean, + mikrotik_enabled boolean, + mikrotik_credential_source character varying(255) DEFAULT 'site'::character varying, + mikrotik_ssh_port integer, + snmpv3_security_level character varying(255), + snmpv3_username character varying(255), + snmpv3_auth_protocol character varying(255), + snmpv3_auth_password bytea, + snmpv3_priv_protocol character varying(255), + snmpv3_priv_password bytea, + snmpv3_credential_source character varying(255) DEFAULT 'site'::character varying, + organization_id uuid NOT NULL, + snmp_transport character varying(255) DEFAULT 'udp'::character varying NOT NULL, + snmp_transport_source character varying(255) DEFAULT 'organization'::character varying NOT NULL, + device_role character varying(255), + device_role_source character varying(255) DEFAULT 'inferred'::character varying +); + + +-- +-- Name: error_tracker_errors; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.error_tracker_errors ( + id bigint NOT NULL, + kind character varying(255) NOT NULL, + reason text NOT NULL, + source_line text NOT NULL, + source_function text NOT NULL, + status character varying(255) NOT NULL, + fingerprint character varying(255) NOT NULL, + last_occurrence_at timestamp without time zone NOT NULL, + inserted_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + muted boolean DEFAULT false NOT NULL +); + + +-- +-- Name: error_tracker_errors_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.error_tracker_errors_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: error_tracker_errors_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.error_tracker_errors_id_seq OWNED BY public.error_tracker_errors.id; + + +-- +-- Name: error_tracker_meta; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.error_tracker_meta ( + key character varying(255) NOT NULL, + value character varying(255) NOT NULL +); + + +-- +-- Name: error_tracker_occurrences; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.error_tracker_occurrences ( + id bigint NOT NULL, + context jsonb NOT NULL, + reason text NOT NULL, + stacktrace jsonb NOT NULL, + error_id bigint NOT NULL, + inserted_at timestamp without time zone NOT NULL, + breadcrumbs character varying(255)[] DEFAULT ARRAY[]::character varying[] NOT NULL +); + + +-- +-- Name: error_tracker_occurrences_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.error_tracker_occurrences_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: error_tracker_occurrences_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.error_tracker_occurrences_id_seq OWNED BY public.error_tracker_occurrences.id; + + +-- +-- Name: firmware_releases; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.firmware_releases ( + id uuid NOT NULL, + vendor character varying(255) NOT NULL, + product_line character varying(255), + version character varying(255) NOT NULL, + release_date date, + download_url character varying(255), + changelog_url character varying(255), + metadata jsonb DEFAULT '{}'::jsonb NOT NULL, + fetched_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: gaiia_accounts; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.gaiia_accounts ( + id uuid NOT NULL, + organization_id uuid NOT NULL, + gaiia_id character varying(255) NOT NULL, + readable_id character varying(255), + name character varying(255), + status character varying(255), + account_type character varying(255), + address jsonb, + subscription_count integer, + mrr numeric, + raw_data jsonb, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: gaiia_billing_subscriptions; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.gaiia_billing_subscriptions ( + id uuid NOT NULL, + organization_id uuid NOT NULL, + gaiia_id character varying(255) NOT NULL, + account_gaiia_id character varying(255), + status character varying(255), + product_name character varying(255), + mrr_amount numeric, + currency character varying(255), + speed_download integer, + speed_upload integer, + raw_data jsonb, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: gaiia_inventory_items; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.gaiia_inventory_items ( + id uuid NOT NULL, + organization_id uuid NOT NULL, + gaiia_id character varying(255) NOT NULL, + name character varying(255), + status character varying(255), + serial_number character varying(255), + mac_address character varying(255), + ip_address character varying(255), + model_name character varying(255), + manufacturer_name character varying(255), + category character varying(255), + assigned_account_gaiia_id character varying(255), + assigned_network_site_gaiia_id character varying(255), + device_id uuid, + raw_data jsonb, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: gaiia_network_sites; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.gaiia_network_sites ( + id uuid NOT NULL, + organization_id uuid NOT NULL, + gaiia_id character varying(255) NOT NULL, + name character varying(255), + address jsonb, + ip_blocks character varying(255)[] DEFAULT ARRAY[]::character varying[], + account_count integer, + total_mrr numeric, + site_id uuid, + raw_data jsonb, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: geoip_blocks; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.geoip_blocks ( + id uuid NOT NULL, + network character varying(255), + start_ip_int bigint NOT NULL, + end_ip_int bigint NOT NULL, + geoname_id integer, + registered_country_geoname_id integer, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: geoip_locations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.geoip_locations ( + geoname_id integer NOT NULL, + country_code character varying(2), + country_name character varying(255), + city_name character varying(255), + subdivision_1_name character varying(255), + subdivision_2_name character varying(255), + latitude double precision, + longitude double precision, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: integrations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.integrations ( + id uuid NOT NULL, + organization_id uuid NOT NULL, + provider character varying(255) NOT NULL, + enabled boolean DEFAULT false NOT NULL, + credentials bytea, + sync_interval_minutes integer DEFAULT 10, + last_synced_at timestamp(0) without time zone, + last_sync_status character varying(255) DEFAULT 'never'::character varying, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL, + last_sync_message text, + subscriber_count integer DEFAULT 0, + total_mrr numeric DEFAULT 0 +); + + +-- +-- Name: ip_blocks; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.ip_blocks ( + id uuid NOT NULL, + ip_address character varying(255) NOT NULL, + offense_count integer DEFAULT 1 NOT NULL, + banned_until timestamp(0) without time zone, + last_violation_at timestamp(0) without time zone NOT NULL, + reason text, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: ip_whitelist; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.ip_whitelist ( + id uuid NOT NULL, + ip_or_cidr character varying(255) NOT NULL, + description text, + added_by_id uuid, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: login_attempts; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.login_attempts ( + id uuid NOT NULL, + user_id uuid, + email character varying(255), + success boolean NOT NULL, + method character varying(255) NOT NULL, + failure_reason character varying(255), + ip_address character varying(255) NOT NULL, + user_agent text, + country_code character varying(255), + country_name character varying(255), + city_name character varying(255), + subdivision_1_name character varying(255), + anonymized_at timestamp(0) without time zone, + inserted_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: maintenance_windows; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.maintenance_windows ( + id uuid NOT NULL, + organization_id uuid NOT NULL, + site_id uuid, + device_id uuid, + name character varying(255) NOT NULL, + reason character varying(255), + starts_at timestamp(0) without time zone NOT NULL, + ends_at timestamp(0) without time zone NOT NULL, + created_by_id uuid NOT NULL, + recurring boolean DEFAULT false, + recurrence_rule character varying(255), + suppress_alerts boolean DEFAULT true, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL, + CONSTRAINT ends_at_after_starts_at CHECK ((ends_at > starts_at)) +); + + +-- +-- Name: mobile_sessions; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.mobile_sessions ( + id uuid NOT NULL, + user_id uuid NOT NULL, + token character varying(255) NOT NULL, + device_name character varying(255), + device_os character varying(255), + app_version character varying(255), + last_used_at timestamp(0) without time zone NOT NULL, + expires_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL, + alerts_enabled boolean DEFAULT true NOT NULL, + push_token text, + push_platform character varying(255) +); + + +-- +-- Name: monitoring_checks; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.monitoring_checks ( + id uuid NOT NULL, + device_id uuid NOT NULL, + status character varying(255) NOT NULL, + response_time_ms double precision, + checked_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + agent_token_id uuid +); + + +-- +-- Name: oban_crons; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.oban_crons ( + name text NOT NULL, + expression text NOT NULL, + worker text NOT NULL, + opts jsonb NOT NULL, + insertions timestamp without time zone[] DEFAULT ARRAY[]::timestamp without time zone[] NOT NULL, + paused boolean DEFAULT false NOT NULL, + lock_version integer DEFAULT 1, + inserted_at timestamp without time zone DEFAULT timezone('utc'::text, now()) NOT NULL, + updated_at timestamp without time zone DEFAULT timezone('utc'::text, now()) NOT NULL +); + + +-- +-- Name: oban_jobs; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.oban_jobs ( + id bigint NOT NULL, + state public.oban_job_state DEFAULT 'available'::public.oban_job_state NOT NULL, + queue text DEFAULT 'default'::text NOT NULL, + worker text NOT NULL, + args jsonb DEFAULT '{}'::jsonb NOT NULL, + errors jsonb[] DEFAULT ARRAY[]::jsonb[] NOT NULL, + attempt integer DEFAULT 0 NOT NULL, + max_attempts integer DEFAULT 20 NOT NULL, + inserted_at timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL, + scheduled_at timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL, + attempted_at timestamp without time zone, + completed_at timestamp without time zone, + attempted_by text[], + discarded_at timestamp without time zone, + priority integer DEFAULT 0 NOT NULL, + tags text[] DEFAULT ARRAY[]::text[], + meta jsonb DEFAULT '{}'::jsonb, + cancelled_at timestamp without time zone, + uniq_key text GENERATED ALWAYS AS ( +CASE + WHEN ((meta -> 'uniq_bmp'::text) @> public.oban_state_to_bit(state)) THEN (meta ->> 'uniq_key'::text) + ELSE NULL::text +END) STORED, + partition_key text GENERATED ALWAYS AS ( +CASE + WHEN (meta ? 'partition_key'::text) THEN (meta ->> 'partition_key'::text) + ELSE NULL::text +END) STORED, + CONSTRAINT attempt_range CHECK (((attempt >= 0) AND (attempt <= max_attempts))), + CONSTRAINT positive_max_attempts CHECK ((max_attempts > 0)), + CONSTRAINT queue_length CHECK (((char_length(queue) > 0) AND (char_length(queue) < 128))), + CONSTRAINT worker_length CHECK (((char_length(worker) > 0) AND (char_length(worker) < 128))) +); + + +-- +-- Name: TABLE oban_jobs; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE public.oban_jobs IS '12'; + + +-- +-- Name: oban_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.oban_jobs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: oban_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.oban_jobs_id_seq OWNED BY public.oban_jobs.id; + + +-- +-- Name: oban_peers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE UNLOGGED TABLE public.oban_peers ( + name text NOT NULL, + node text NOT NULL, + started_at timestamp without time zone NOT NULL, + expires_at timestamp without time zone NOT NULL +); + + +-- +-- Name: oban_producers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE UNLOGGED TABLE public.oban_producers ( + uuid uuid NOT NULL, + name text NOT NULL, + node text NOT NULL, + queue text NOT NULL, + meta jsonb DEFAULT '{}'::jsonb NOT NULL, + started_at timestamp without time zone DEFAULT timezone('utc'::text, now()) NOT NULL, + updated_at timestamp without time zone DEFAULT timezone('utc'::text, now()) NOT NULL +); + + +-- +-- Name: TABLE oban_producers; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON TABLE public.oban_producers IS '1.6.0-schemas,1.6.0-indexes'; + + +-- +-- Name: oban_queues; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.oban_queues ( + name text NOT NULL, + opts jsonb DEFAULT '{}'::jsonb NOT NULL, + "only" jsonb DEFAULT '{}'::jsonb NOT NULL, + lock_version integer DEFAULT 1, + inserted_at timestamp without time zone DEFAULT timezone('utc'::text, now()) NOT NULL, + updated_at timestamp without time zone DEFAULT timezone('utc'::text, now()) NOT NULL, + hash text +); + + +-- +-- Name: organization_invitations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.organization_invitations ( + id uuid NOT NULL, + organization_id uuid NOT NULL, + email character varying(255) NOT NULL, + role character varying(255) NOT NULL, + token character varying(255) NOT NULL, + invited_by_id uuid, + accepted_at timestamp(0) without time zone, + accepted_by_id uuid, + expires_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: organization_memberships; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.organization_memberships ( + id uuid NOT NULL, + organization_id uuid NOT NULL, + user_id uuid NOT NULL, + role character varying(255) NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL, + is_default boolean DEFAULT false NOT NULL +); + + +-- +-- Name: organizations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.organizations ( + id uuid NOT NULL, + name character varying(255) NOT NULL, + slug character varying(255) NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL, + default_agent_token_id uuid, + snmp_version character varying(255) DEFAULT '2c'::character varying, + snmp_community character varying(255), + subscription_plan character varying(255) DEFAULT 'free'::character varying NOT NULL, + mikrotik_username character varying, + mikrotik_password bytea, + mikrotik_port integer DEFAULT 8729, + mikrotik_use_ssl boolean DEFAULT true, + mikrotik_enabled boolean DEFAULT false, + mikrotik_ssh_port integer DEFAULT 22, + snmp_port integer DEFAULT 161 NOT NULL, + snmpv3_security_level character varying(255), + snmpv3_username character varying(255), + snmpv3_auth_protocol character varying(255) DEFAULT 'SHA-256'::character varying, + snmpv3_auth_password bytea, + snmpv3_priv_protocol character varying(255) DEFAULT 'AES'::character varying, + snmpv3_priv_password bytea, + use_sites boolean DEFAULT false NOT NULL, + snmp_transport character varying(255) DEFAULT 'udp'::character varying NOT NULL, + onboarding_completed boolean DEFAULT false NOT NULL +); + + +-- +-- Name: policy_versions; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.policy_versions ( + id uuid NOT NULL, + policy_type character varying(255) NOT NULL, + version character varying(255) NOT NULL, + content text NOT NULL, + effective_date timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: preseem_access_points; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.preseem_access_points ( + id uuid NOT NULL, + organization_id uuid NOT NULL, + preseem_id character varying(255) NOT NULL, + name character varying(255), + mac_address character varying(255), + ip_address character varying(255), + model character varying(255), + firmware character varying(255), + capacity_score double precision, + qoe_score double precision, + rf_score double precision, + busy_hours integer, + airtime_utilization double precision, + subscriber_count integer, + device_id uuid, + match_confidence character varying(255) DEFAULT 'unmatched'::character varying, + raw_data jsonb, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: preseem_device_baselines; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.preseem_device_baselines ( + id uuid NOT NULL, + preseem_access_point_id uuid NOT NULL, + metric_name character varying(255) NOT NULL, + period character varying(255) NOT NULL, + mean double precision, + stddev double precision, + p5 double precision, + p95 double precision, + sample_count integer, + computed_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: preseem_fleet_profiles; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.preseem_fleet_profiles ( + id uuid NOT NULL, + organization_id uuid NOT NULL, + manufacturer character varying(255) NOT NULL, + model character varying(255) NOT NULL, + firmware_version character varying(255), + device_count integer NOT NULL, + avg_subscribers double precision, + avg_qoe_score double precision, + avg_capacity_score double precision, + capacity_ceiling integer, + avg_busy_hours double precision, + performance_data jsonb, + computed_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: preseem_insights; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.preseem_insights ( + id uuid NOT NULL, + organization_id uuid NOT NULL, + preseem_access_point_id uuid, + device_id uuid, + type character varying(255) NOT NULL, + urgency character varying(255) NOT NULL, + status character varying(255) DEFAULT 'active'::character varying NOT NULL, + channel character varying(255) NOT NULL, + title character varying(255) NOT NULL, + description text, + metadata jsonb, + dismissed_at timestamp(0) without time zone, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL, + source character varying(255) DEFAULT 'preseem'::character varying NOT NULL, + site_id uuid, + agent_token_id uuid +); + + +-- +-- Name: preseem_subscriber_metrics; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.preseem_subscriber_metrics ( + id uuid NOT NULL, + preseem_access_point_id uuid NOT NULL, + avg_latency double precision, + avg_jitter double precision, + avg_loss double precision, + avg_throughput double precision, + p95_latency double precision, + subscriber_count integer, + recorded_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: preseem_sync_logs; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.preseem_sync_logs ( + id uuid NOT NULL, + organization_id uuid NOT NULL, + integration_id uuid NOT NULL, + status character varying(255) NOT NULL, + records_synced integer DEFAULT 0, + errors jsonb, + duration_ms integer, + inserted_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: profile_device_oids; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.profile_device_oids ( + id uuid NOT NULL, + profile_id uuid NOT NULL, + field character varying(255) NOT NULL, + mib_name character varying(255) NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: profile_sensor_oids; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.profile_sensor_oids ( + id uuid NOT NULL, + profile_id uuid NOT NULL, + sensor_type character varying(255) NOT NULL, + mib_name character varying(255) NOT NULL, + sensor_descr character varying(255), + sensor_unit character varying(255), + sensor_divisor integer DEFAULT 1, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: qr_login_tokens; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.qr_login_tokens ( + id uuid NOT NULL, + user_id uuid NOT NULL, + token character varying(255) NOT NULL, + expires_at timestamp(0) without time zone NOT NULL, + completed_at timestamp(0) without time zone, + mobile_session_id uuid, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.schema_migrations ( + version bigint NOT NULL, + inserted_at timestamp(0) without time zone +); + + +-- +-- Name: sites; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.sites ( + id uuid NOT NULL, + organization_id uuid NOT NULL, + parent_site_id uuid, + name character varying(255) NOT NULL, + description text, + location character varying(255), + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL, + agent_token_id uuid, + snmp_version character varying(255), + snmp_community character varying(255), + display_order integer, + mikrotik_username character varying, + mikrotik_password bytea, + mikrotik_port integer, + mikrotik_use_ssl boolean, + mikrotik_enabled boolean, + mikrotik_ssh_port integer, + snmp_port integer, + snmpv3_security_level character varying(255), + snmpv3_username character varying(255), + snmpv3_auth_protocol character varying(255), + snmpv3_auth_password bytea, + snmpv3_priv_protocol character varying(255), + snmpv3_priv_password bytea, + snmp_transport character varying(255), + address character varying(255), + latitude double precision, + longitude double precision +); + + +-- +-- Name: snmp_arp_entries; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.snmp_arp_entries ( + id uuid NOT NULL, + device_id uuid NOT NULL, + interface_id uuid, + ip_address character varying(255) NOT NULL, + mac_address character varying(255) NOT NULL, + entry_type character varying(255), + if_index integer, + last_seen_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: snmp_devices; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.snmp_devices ( + id uuid NOT NULL, + device_id uuid NOT NULL, + sys_descr text, + sys_object_id character varying(255), + sys_name character varying(255), + sys_uptime bigint, + sys_contact character varying(255), + sys_location character varying(255), + manufacturer character varying(255), + model character varying(255), + firmware_version character varying(255), + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL, + serial_number character varying(255), + raw_discovery_data jsonb, + last_discovery_at timestamp(0) without time zone +); + + +-- +-- Name: snmp_interface_stats; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.snmp_interface_stats ( + id uuid NOT NULL, + interface_id uuid NOT NULL, + if_in_octets bigint, + if_out_octets bigint, + if_in_errors bigint, + if_out_errors bigint, + if_in_discards bigint, + if_out_discards bigint, + checked_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: snmp_interfaces; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.snmp_interfaces ( + id uuid NOT NULL, + snmp_device_id uuid NOT NULL, + if_index integer NOT NULL, + if_name character varying(255), + if_descr character varying(255), + if_alias character varying(255), + if_type integer, + if_speed bigint, + if_phys_address character varying(255), + if_admin_status character varying(255), + if_oper_status character varying(255), + monitored boolean DEFAULT true NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: snmp_ip_addresses; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.snmp_ip_addresses ( + id uuid NOT NULL, + snmp_interface_id uuid NOT NULL, + ip_address character varying(255) NOT NULL, + subnet_mask character varying(255), + prefix_length integer, + ip_type character varying(255) DEFAULT 'ipv4'::character varying NOT NULL, + is_primary boolean DEFAULT false, + last_checked_at timestamp(0) without time zone, + metadata jsonb DEFAULT '{}'::jsonb, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: snmp_mac_addresses; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.snmp_mac_addresses ( + id uuid NOT NULL, + device_id uuid NOT NULL, + interface_id uuid, + mac_address character varying(255) NOT NULL, + vlan_id integer, + port_index integer, + entry_status character varying(255), + last_seen_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: snmp_memory_pools; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.snmp_memory_pools ( + id uuid NOT NULL, + snmp_device_id uuid NOT NULL, + pool_index character varying(255) NOT NULL, + pool_name character varying(255), + pool_type character varying(255) NOT NULL, + total_bytes bigint, + used_bytes bigint, + last_checked_at timestamp(0) without time zone, + metadata jsonb DEFAULT '{}'::jsonb, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: snmp_neighbors; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.snmp_neighbors ( + id uuid NOT NULL, + device_id uuid NOT NULL, + interface_id uuid NOT NULL, + protocol character varying(255) NOT NULL, + remote_chassis_id character varying(255), + remote_system_name character varying(255), + remote_system_description text, + remote_platform character varying(255), + remote_port_id character varying(255), + remote_port_description character varying(255), + remote_address character varying(255), + remote_capabilities character varying(255)[] DEFAULT ARRAY[]::character varying[], + last_discovered_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: snmp_physical_entities; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.snmp_physical_entities ( + id uuid NOT NULL, + snmp_device_id uuid NOT NULL, + entity_index integer NOT NULL, + entity_class character varying(255) NOT NULL, + description character varying(255), + model_name character varying(255), + serial_number character varying(255), + firmware_revision character varying(255), + hardware_revision character varying(255), + manufacturer_name character varying(255), + "position" integer, + last_checked_at timestamp(0) without time zone, + metadata jsonb DEFAULT '{}'::jsonb, + parent_entity_id uuid, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: snmp_processor_readings; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.snmp_processor_readings ( + id uuid NOT NULL, + processor_id uuid NOT NULL, + load_percent double precision, + status character varying(255) DEFAULT 'ok'::character varying NOT NULL, + checked_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: snmp_processors; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.snmp_processors ( + id uuid NOT NULL, + snmp_device_id uuid NOT NULL, + processor_index character varying(255) NOT NULL, + description character varying(255), + processor_type character varying(255) NOT NULL, + load_percent double precision, + last_checked_at timestamp(0) without time zone, + metadata jsonb DEFAULT '{}'::jsonb, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: snmp_sensor_readings; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.snmp_sensor_readings ( + id uuid NOT NULL, + sensor_id uuid NOT NULL, + value double precision, + status character varying(255) NOT NULL, + checked_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + state_descr character varying(255) +); + + +-- +-- Name: snmp_sensors; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.snmp_sensors ( + id uuid NOT NULL, + snmp_device_id uuid NOT NULL, + sensor_type character varying(255) NOT NULL, + sensor_index character varying(255) NOT NULL, + sensor_oid character varying(255) NOT NULL, + sensor_descr character varying(255), + sensor_unit character varying(255), + sensor_divisor integer DEFAULT 1 NOT NULL, + monitored boolean DEFAULT true NOT NULL, + last_value double precision, + last_checked_at timestamp(0) without time zone, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL, + metadata jsonb DEFAULT '{}'::jsonb +); + + +-- +-- Name: snmp_state_sensors; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.snmp_state_sensors ( + id uuid NOT NULL, + snmp_device_id uuid NOT NULL, + sensor_index character varying(255) NOT NULL, + sensor_oid character varying(255) NOT NULL, + sensor_descr character varying(255), + entity_type character varying(255), + state_value integer, + state_descr character varying(255), + status character varying(255) DEFAULT 'unknown'::character varying, + last_checked_at timestamp(0) without time zone, + metadata jsonb DEFAULT '{}'::jsonb, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: snmp_storage; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.snmp_storage ( + id uuid NOT NULL, + snmp_device_id uuid NOT NULL, + storage_index integer NOT NULL, + storage_type character varying(255) NOT NULL, + description character varying(255), + device_name character varying(255), + total_bytes bigint, + used_bytes bigint, + allocation_units integer, + last_checked_at timestamp(0) without time zone, + metadata jsonb DEFAULT '{}'::jsonb, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: snmp_storage_readings; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.snmp_storage_readings ( + id uuid NOT NULL, + storage_id uuid NOT NULL, + used_bytes bigint, + total_bytes bigint, + usage_percent double precision, + checked_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: snmp_vlans; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.snmp_vlans ( + id uuid NOT NULL, + snmp_device_id uuid NOT NULL, + vlan_id integer NOT NULL, + vlan_name character varying(255), + vlan_type character varying(255), + status character varying(255) DEFAULT 'active'::character varying, + last_checked_at timestamp(0) without time zone, + metadata jsonb DEFAULT '{}'::jsonb, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: user_consents; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.user_consents ( + id uuid NOT NULL, + user_id uuid NOT NULL, + consent_type character varying(255) NOT NULL, + version character varying(255) NOT NULL, + granted_at timestamp(0) without time zone NOT NULL, + revoked_at timestamp(0) without time zone, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: user_recovery_codes; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.user_recovery_codes ( + id uuid NOT NULL, + user_id uuid NOT NULL, + code_hash character varying(255) NOT NULL, + used_at timestamp(0) without time zone, + created_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: user_totp_devices; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.user_totp_devices ( + id uuid NOT NULL, + user_id uuid NOT NULL, + name character varying(255) NOT NULL, + totp_secret bytea NOT NULL, + last_used_at timestamp(0) without time zone, + created_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: users; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.users ( + id uuid NOT NULL, + email public.citext NOT NULL, + hashed_password character varying(255), + confirmed_at timestamp(0) without time zone, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL, + is_superuser boolean DEFAULT false NOT NULL, + timezone character varying(255) DEFAULT 'UTC'::character varying, + totp_secret bytea, + last_sudo_at timestamp(0) without time zone, + first_name character varying(255), + last_name character varying(255), + time_format character varying(255) DEFAULT '24h'::character varying NOT NULL, + default_organization_id uuid, + language character varying(255) DEFAULT 'en'::character varying NOT NULL +); + + +-- +-- Name: users_tokens; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.users_tokens ( + id uuid NOT NULL, + user_id uuid NOT NULL, + token bytea NOT NULL, + context character varying(255) NOT NULL, + sent_to character varying(255), + authenticated_at timestamp(0) without time zone, + inserted_at timestamp(0) without time zone NOT NULL, + totp_verified_at timestamp(0) without time zone +); + + +-- +-- Name: weather_alerts; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.weather_alerts ( + id uuid NOT NULL, + site_id uuid NOT NULL, + event character varying(255) NOT NULL, + sender character varying(255), + description text, + starts_at timestamp(0) without time zone, + ends_at timestamp(0) without time zone, + tags character varying(255)[] DEFAULT ARRAY[]::character varying[], + severity character varying(255), + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: weather_observations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.weather_observations ( + id uuid NOT NULL, + site_id uuid NOT NULL, + condition character varying(255), + condition_detail character varying(255), + icon character varying(255), + temperature_c double precision, + feels_like_c double precision, + humidity integer, + pressure_hpa integer, + visibility_m integer, + wind_speed_ms double precision, + wind_gust_ms double precision, + wind_deg integer, + rain_1h_mm double precision, + snow_1h_mm double precision, + clouds_pct integer, + raw jsonb, + observed_at timestamp(0) without time zone NOT NULL, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: wireless_clients; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.wireless_clients ( + id uuid NOT NULL, + device_id uuid NOT NULL, + organization_id uuid NOT NULL, + mac_address character varying(255) NOT NULL, + ip_address character varying(255), + hostname character varying(255), + signal_strength integer, + snr integer, + distance integer, + tx_rate integer, + rx_rate integer, + uptime_seconds integer, + last_seen_at timestamp(0) without time zone NOT NULL, + metadata jsonb DEFAULT '{}'::jsonb, + inserted_at timestamp(0) without time zone NOT NULL, + updated_at timestamp(0) without time zone NOT NULL +); + + +-- +-- Name: error_tracker_errors id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.error_tracker_errors ALTER COLUMN id SET DEFAULT nextval('public.error_tracker_errors_id_seq'::regclass); + + +-- +-- Name: error_tracker_occurrences id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.error_tracker_occurrences ALTER COLUMN id SET DEFAULT nextval('public.error_tracker_occurrences_id_seq'::regclass); + + +-- +-- Name: oban_jobs id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.oban_jobs ALTER COLUMN id SET DEFAULT nextval('public.oban_jobs_id_seq'::regclass); + + +-- +-- Name: agent_assignments agent_assignments_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.agent_assignments + ADD CONSTRAINT agent_assignments_pkey PRIMARY KEY (id); + + +-- +-- Name: agent_tokens agent_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.agent_tokens + ADD CONSTRAINT agent_tokens_pkey PRIMARY KEY (id); + + +-- +-- Name: alerts alerts_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.alerts + ADD CONSTRAINT alerts_pkey PRIMARY KEY (id); + + +-- +-- Name: api_tokens api_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.api_tokens + ADD CONSTRAINT api_tokens_pkey PRIMARY KEY (id); + + +-- +-- Name: application_settings application_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.application_settings + ADD CONSTRAINT application_settings_pkey PRIMARY KEY (id); + + +-- +-- Name: audit_logs audit_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.audit_logs + ADD CONSTRAINT audit_logs_pkey PRIMARY KEY (id); + + +-- +-- Name: browser_sessions browser_sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.browser_sessions + ADD CONSTRAINT browser_sessions_pkey PRIMARY KEY (id); + + +-- +-- Name: check_results check_results_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.check_results + ADD CONSTRAINT check_results_pkey PRIMARY KEY (id, checked_at); + + +-- +-- Name: checks checks_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.checks + ADD CONSTRAINT checks_pkey PRIMARY KEY (id); + + +-- +-- Name: config_change_events config_change_events_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.config_change_events + ADD CONSTRAINT config_change_events_pkey PRIMARY KEY (id); + + +-- +-- Name: device_backup_requests device_backup_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_backup_requests + ADD CONSTRAINT device_backup_requests_pkey PRIMARY KEY (id); + + +-- +-- Name: device_firmware_history device_firmware_history_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_firmware_history + ADD CONSTRAINT device_firmware_history_pkey PRIMARY KEY (id); + + +-- +-- Name: device_link_evidence device_link_evidence_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_link_evidence + ADD CONSTRAINT device_link_evidence_pkey PRIMARY KEY (id); + + +-- +-- Name: device_links device_links_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_links + ADD CONSTRAINT device_links_pkey PRIMARY KEY (id); + + +-- +-- Name: device_mikrotik_backups device_mikrotik_backups_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_mikrotik_backups + ADD CONSTRAINT device_mikrotik_backups_pkey PRIMARY KEY (id); + + +-- +-- Name: device_neighbors device_neighbors_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_neighbors + ADD CONSTRAINT device_neighbors_pkey PRIMARY KEY (id); + + +-- +-- Name: device_profiles device_profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_profiles + ADD CONSTRAINT device_profiles_pkey PRIMARY KEY (id); + + +-- +-- Name: device_subscriber_links device_subscriber_links_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_subscriber_links + ADD CONSTRAINT device_subscriber_links_pkey PRIMARY KEY (id); + + +-- +-- Name: devices devices_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.devices + ADD CONSTRAINT devices_pkey PRIMARY KEY (id); + + +-- +-- Name: device_events equipment_events_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_events + ADD CONSTRAINT equipment_events_pkey PRIMARY KEY (id); + + +-- +-- Name: error_tracker_errors error_tracker_errors_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.error_tracker_errors + ADD CONSTRAINT error_tracker_errors_pkey PRIMARY KEY (id); + + +-- +-- Name: error_tracker_meta error_tracker_meta_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.error_tracker_meta + ADD CONSTRAINT error_tracker_meta_pkey PRIMARY KEY (key); + + +-- +-- Name: error_tracker_occurrences error_tracker_occurrences_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.error_tracker_occurrences + ADD CONSTRAINT error_tracker_occurrences_pkey PRIMARY KEY (id); + + +-- +-- Name: firmware_releases firmware_releases_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.firmware_releases + ADD CONSTRAINT firmware_releases_pkey PRIMARY KEY (id); + + +-- +-- Name: gaiia_accounts gaiia_accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gaiia_accounts + ADD CONSTRAINT gaiia_accounts_pkey PRIMARY KEY (id); + + +-- +-- Name: gaiia_billing_subscriptions gaiia_billing_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gaiia_billing_subscriptions + ADD CONSTRAINT gaiia_billing_subscriptions_pkey PRIMARY KEY (id); + + +-- +-- Name: gaiia_inventory_items gaiia_inventory_items_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gaiia_inventory_items + ADD CONSTRAINT gaiia_inventory_items_pkey PRIMARY KEY (id); + + +-- +-- Name: gaiia_network_sites gaiia_network_sites_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gaiia_network_sites + ADD CONSTRAINT gaiia_network_sites_pkey PRIMARY KEY (id); + + +-- +-- Name: geoip_blocks geoip_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.geoip_blocks + ADD CONSTRAINT geoip_blocks_pkey PRIMARY KEY (id); + + +-- +-- Name: geoip_locations geoip_locations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.geoip_locations + ADD CONSTRAINT geoip_locations_pkey PRIMARY KEY (geoname_id); + + +-- +-- Name: integrations integrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.integrations + ADD CONSTRAINT integrations_pkey PRIMARY KEY (id); + + +-- +-- Name: ip_blocks ip_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.ip_blocks + ADD CONSTRAINT ip_blocks_pkey PRIMARY KEY (id); + + +-- +-- Name: ip_whitelist ip_whitelist_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.ip_whitelist + ADD CONSTRAINT ip_whitelist_pkey PRIMARY KEY (id); + + +-- +-- Name: login_attempts login_attempts_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.login_attempts + ADD CONSTRAINT login_attempts_pkey PRIMARY KEY (id); + + +-- +-- Name: maintenance_windows maintenance_windows_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.maintenance_windows + ADD CONSTRAINT maintenance_windows_pkey PRIMARY KEY (id); + + +-- +-- Name: mobile_sessions mobile_sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mobile_sessions + ADD CONSTRAINT mobile_sessions_pkey PRIMARY KEY (id); + + +-- +-- Name: monitoring_checks monitoring_checks_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.monitoring_checks + ADD CONSTRAINT monitoring_checks_pkey PRIMARY KEY (id); + + +-- +-- Name: oban_jobs non_negative_priority; Type: CHECK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE public.oban_jobs + ADD CONSTRAINT non_negative_priority CHECK ((priority >= 0)) NOT VALID; + + +-- +-- Name: oban_crons oban_crons_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.oban_crons + ADD CONSTRAINT oban_crons_pkey PRIMARY KEY (name); + + +-- +-- Name: oban_jobs oban_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.oban_jobs + ADD CONSTRAINT oban_jobs_pkey PRIMARY KEY (id); + + +-- +-- Name: oban_peers oban_peers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.oban_peers + ADD CONSTRAINT oban_peers_pkey PRIMARY KEY (name); + + +-- +-- Name: oban_producers oban_producers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.oban_producers + ADD CONSTRAINT oban_producers_pkey PRIMARY KEY (uuid); + + +-- +-- Name: oban_queues oban_queues_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.oban_queues + ADD CONSTRAINT oban_queues_pkey PRIMARY KEY (name); + + +-- +-- Name: organization_invitations organization_invitations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.organization_invitations + ADD CONSTRAINT organization_invitations_pkey PRIMARY KEY (id); + + +-- +-- Name: organization_memberships organization_memberships_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.organization_memberships + ADD CONSTRAINT organization_memberships_pkey PRIMARY KEY (id); + + +-- +-- Name: organizations organizations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.organizations + ADD CONSTRAINT organizations_pkey PRIMARY KEY (id); + + +-- +-- Name: policy_versions policy_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.policy_versions + ADD CONSTRAINT policy_versions_pkey PRIMARY KEY (id); + + +-- +-- Name: preseem_access_points preseem_access_points_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_access_points + ADD CONSTRAINT preseem_access_points_pkey PRIMARY KEY (id); + + +-- +-- Name: preseem_device_baselines preseem_device_baselines_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_device_baselines + ADD CONSTRAINT preseem_device_baselines_pkey PRIMARY KEY (id); + + +-- +-- Name: preseem_fleet_profiles preseem_fleet_profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_fleet_profiles + ADD CONSTRAINT preseem_fleet_profiles_pkey PRIMARY KEY (id); + + +-- +-- Name: preseem_insights preseem_insights_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_insights + ADD CONSTRAINT preseem_insights_pkey PRIMARY KEY (id); + + +-- +-- Name: preseem_subscriber_metrics preseem_subscriber_metrics_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_subscriber_metrics + ADD CONSTRAINT preseem_subscriber_metrics_pkey PRIMARY KEY (id); + + +-- +-- Name: preseem_sync_logs preseem_sync_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_sync_logs + ADD CONSTRAINT preseem_sync_logs_pkey PRIMARY KEY (id); + + +-- +-- Name: profile_device_oids profile_device_oids_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.profile_device_oids + ADD CONSTRAINT profile_device_oids_pkey PRIMARY KEY (id); + + +-- +-- Name: profile_sensor_oids profile_sensor_oids_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.profile_sensor_oids + ADD CONSTRAINT profile_sensor_oids_pkey PRIMARY KEY (id); + + +-- +-- Name: qr_login_tokens qr_login_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.qr_login_tokens + ADD CONSTRAINT qr_login_tokens_pkey PRIMARY KEY (id); + + +-- +-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.schema_migrations + ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); + + +-- +-- Name: sites sites_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.sites + ADD CONSTRAINT sites_pkey PRIMARY KEY (id); + + +-- +-- Name: snmp_arp_entries snmp_arp_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_arp_entries + ADD CONSTRAINT snmp_arp_entries_pkey PRIMARY KEY (id); + + +-- +-- Name: snmp_devices snmp_devices_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_devices + ADD CONSTRAINT snmp_devices_pkey PRIMARY KEY (id); + + +-- +-- Name: snmp_interface_stats snmp_interface_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_interface_stats + ADD CONSTRAINT snmp_interface_stats_pkey PRIMARY KEY (id); + + +-- +-- Name: snmp_interfaces snmp_interfaces_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_interfaces + ADD CONSTRAINT snmp_interfaces_pkey PRIMARY KEY (id); + + +-- +-- Name: snmp_ip_addresses snmp_ip_addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_ip_addresses + ADD CONSTRAINT snmp_ip_addresses_pkey PRIMARY KEY (id); + + +-- +-- Name: snmp_mac_addresses snmp_mac_addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_mac_addresses + ADD CONSTRAINT snmp_mac_addresses_pkey PRIMARY KEY (id); + + +-- +-- Name: snmp_memory_pools snmp_memory_pools_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_memory_pools + ADD CONSTRAINT snmp_memory_pools_pkey PRIMARY KEY (id); + + +-- +-- Name: snmp_neighbors snmp_neighbors_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_neighbors + ADD CONSTRAINT snmp_neighbors_pkey PRIMARY KEY (id); + + +-- +-- Name: snmp_physical_entities snmp_physical_entities_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_physical_entities + ADD CONSTRAINT snmp_physical_entities_pkey PRIMARY KEY (id); + + +-- +-- Name: snmp_processor_readings snmp_processor_readings_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_processor_readings + ADD CONSTRAINT snmp_processor_readings_pkey PRIMARY KEY (id); + + +-- +-- Name: snmp_processors snmp_processors_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_processors + ADD CONSTRAINT snmp_processors_pkey PRIMARY KEY (id); + + +-- +-- Name: snmp_sensor_readings snmp_sensor_readings_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_sensor_readings + ADD CONSTRAINT snmp_sensor_readings_pkey PRIMARY KEY (id); + + +-- +-- Name: snmp_sensors snmp_sensors_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_sensors + ADD CONSTRAINT snmp_sensors_pkey PRIMARY KEY (id); + + +-- +-- Name: snmp_state_sensors snmp_state_sensors_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_state_sensors + ADD CONSTRAINT snmp_state_sensors_pkey PRIMARY KEY (id); + + +-- +-- Name: snmp_storage snmp_storage_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_storage + ADD CONSTRAINT snmp_storage_pkey PRIMARY KEY (id); + + +-- +-- Name: snmp_storage_readings snmp_storage_readings_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_storage_readings + ADD CONSTRAINT snmp_storage_readings_pkey PRIMARY KEY (id); + + +-- +-- Name: snmp_vlans snmp_vlans_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_vlans + ADD CONSTRAINT snmp_vlans_pkey PRIMARY KEY (id); + + +-- +-- Name: user_consents user_consents_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_consents + ADD CONSTRAINT user_consents_pkey PRIMARY KEY (id); + + +-- +-- Name: user_recovery_codes user_recovery_codes_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_recovery_codes + ADD CONSTRAINT user_recovery_codes_pkey PRIMARY KEY (id); + + +-- +-- Name: user_totp_devices user_totp_devices_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_totp_devices + ADD CONSTRAINT user_totp_devices_pkey PRIMARY KEY (id); + + +-- +-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.users + ADD CONSTRAINT users_pkey PRIMARY KEY (id); + + +-- +-- Name: users_tokens users_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.users_tokens + ADD CONSTRAINT users_tokens_pkey PRIMARY KEY (id); + + +-- +-- Name: weather_alerts weather_alerts_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.weather_alerts + ADD CONSTRAINT weather_alerts_pkey PRIMARY KEY (id); + + +-- +-- Name: weather_observations weather_observations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.weather_observations + ADD CONSTRAINT weather_observations_pkey PRIMARY KEY (id); + + +-- +-- Name: wireless_clients wireless_clients_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.wireless_clients + ADD CONSTRAINT wireless_clients_pkey PRIMARY KEY (id); + + +-- +-- Name: agent_assignments_agent_token_id_enabled_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX agent_assignments_agent_token_id_enabled_index ON public.agent_assignments USING btree (agent_token_id, enabled); + + +-- +-- Name: agent_assignments_agent_token_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX agent_assignments_agent_token_id_index ON public.agent_assignments USING btree (agent_token_id); + + +-- +-- Name: agent_assignments_device_id_enabled_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX agent_assignments_device_id_enabled_index ON public.agent_assignments USING btree (device_id, enabled); + + +-- +-- Name: agent_assignments_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX agent_assignments_device_id_index ON public.agent_assignments USING btree (device_id); + + +-- +-- Name: agent_assignments_enabled_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX agent_assignments_enabled_index ON public.agent_assignments USING btree (enabled); + + +-- +-- Name: agent_tokens_allow_remote_debug_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX agent_tokens_allow_remote_debug_index ON public.agent_tokens USING btree (allow_remote_debug); + + +-- +-- Name: agent_tokens_is_cloud_poller_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX agent_tokens_is_cloud_poller_index ON public.agent_tokens USING btree (is_cloud_poller); + + +-- +-- Name: agent_tokens_last_seen_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX agent_tokens_last_seen_at_index ON public.agent_tokens USING btree (last_seen_at); + + +-- +-- Name: agent_tokens_organization_id_enabled_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX agent_tokens_organization_id_enabled_index ON public.agent_tokens USING btree (organization_id, enabled); + + +-- +-- Name: agent_tokens_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX agent_tokens_organization_id_index ON public.agent_tokens USING btree (organization_id); + + +-- +-- Name: agent_tokens_organization_id_last_seen_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX agent_tokens_organization_id_last_seen_at_index ON public.agent_tokens USING btree (organization_id, last_seen_at); + + +-- +-- Name: alerts_acknowledged_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX alerts_acknowledged_at_index ON public.alerts USING btree (acknowledged_at); + + +-- +-- Name: alerts_active_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX alerts_active_idx ON public.alerts USING btree (resolved_at) WHERE (resolved_at IS NULL); + + +-- +-- Name: alerts_alert_type_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX alerts_alert_type_index ON public.alerts USING btree (alert_type); + + +-- +-- Name: alerts_check_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX alerts_check_id_index ON public.alerts USING btree (check_id); + + +-- +-- Name: alerts_email_sent_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX alerts_email_sent_at_index ON public.alerts USING btree (email_sent_at); + + +-- +-- Name: alerts_equipment_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX alerts_equipment_id_index ON public.alerts USING btree (device_id); + + +-- +-- Name: alerts_notification_sent_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX alerts_notification_sent_index ON public.alerts USING btree (notification_sent); + + +-- +-- Name: alerts_resolved_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX alerts_resolved_at_index ON public.alerts USING btree (resolved_at); + + +-- +-- Name: alerts_severity_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX alerts_severity_index ON public.alerts USING btree (severity); + + +-- +-- Name: alerts_triggered_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX alerts_triggered_at_index ON public.alerts USING btree (triggered_at); + + +-- +-- Name: api_tokens_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX api_tokens_organization_id_index ON public.api_tokens USING btree (organization_id); + + +-- +-- Name: api_tokens_token_hash_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX api_tokens_token_hash_index ON public.api_tokens USING btree (token_hash); + + +-- +-- Name: api_tokens_user_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX api_tokens_user_id_index ON public.api_tokens USING btree (user_id); + + +-- +-- Name: application_settings_key_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX application_settings_key_index ON public.application_settings USING btree (key); + + +-- +-- Name: audit_logs_action_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX audit_logs_action_index ON public.audit_logs USING btree (action); + + +-- +-- Name: audit_logs_inserted_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX audit_logs_inserted_at_index ON public.audit_logs USING btree (inserted_at); + + +-- +-- Name: audit_logs_request_path_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX audit_logs_request_path_index ON public.audit_logs USING btree (request_path); + + +-- +-- Name: audit_logs_superuser_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX audit_logs_superuser_id_index ON public.audit_logs USING btree (superuser_id); + + +-- +-- Name: audit_logs_target_user_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX audit_logs_target_user_id_index ON public.audit_logs USING btree (target_user_id); + + +-- +-- Name: browser_sessions_anonymized_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX browser_sessions_anonymized_at_index ON public.browser_sessions USING btree (anonymized_at); + + +-- +-- Name: browser_sessions_expires_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX browser_sessions_expires_at_index ON public.browser_sessions USING btree (expires_at); + + +-- +-- Name: browser_sessions_last_activity_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX browser_sessions_last_activity_at_index ON public.browser_sessions USING btree (last_activity_at); + + +-- +-- Name: browser_sessions_user_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX browser_sessions_user_id_index ON public.browser_sessions USING btree (user_id); + + +-- +-- Name: browser_sessions_user_token_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX browser_sessions_user_token_id_index ON public.browser_sessions USING btree (user_token_id); + + +-- +-- Name: check_results_check_id_checked_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX check_results_check_id_checked_at_index ON public.check_results USING btree (check_id, checked_at); + + +-- +-- Name: check_results_organization_id_checked_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX check_results_organization_id_checked_at_index ON public.check_results USING btree (organization_id, checked_at); + + +-- +-- Name: check_results_organization_id_status_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX check_results_organization_id_status_index ON public.check_results USING btree (organization_id, status); + + +-- +-- Name: check_results_value_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX check_results_value_index ON public.check_results USING btree (value); + + +-- +-- Name: checks_agent_token_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX checks_agent_token_id_index ON public.checks USING btree (agent_token_id); + + +-- +-- Name: checks_check_key_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX checks_check_key_index ON public.checks USING btree (check_key) WHERE (check_key IS NOT NULL); + + +-- +-- Name: checks_check_type_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX checks_check_type_index ON public.checks USING btree (check_type); + + +-- +-- Name: checks_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX checks_device_id_index ON public.checks USING btree (device_id); + + +-- +-- Name: checks_enabled_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX checks_enabled_index ON public.checks USING btree (enabled); + + +-- +-- Name: checks_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX checks_organization_id_index ON public.checks USING btree (organization_id); + + +-- +-- Name: checks_source_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX checks_source_id_index ON public.checks USING btree (source_id); + + +-- +-- Name: checks_source_type_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX checks_source_type_index ON public.checks USING btree (source_type); + + +-- +-- Name: checks_source_type_source_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX checks_source_type_source_id_index ON public.checks USING btree (source_type, source_id); + + +-- +-- Name: config_change_events_changed_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX config_change_events_changed_at_index ON public.config_change_events USING btree (changed_at); + + +-- +-- Name: config_change_events_device_id_changed_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX config_change_events_device_id_changed_at_index ON public.config_change_events USING btree (device_id, changed_at); + + +-- +-- Name: config_change_events_organization_id_changed_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX config_change_events_organization_id_changed_at_index ON public.config_change_events USING btree (organization_id, changed_at); + + +-- +-- Name: device_backup_requests_device_id_status_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX device_backup_requests_device_id_status_index ON public.device_backup_requests USING btree (device_id, status); + + +-- +-- Name: device_backup_requests_job_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX device_backup_requests_job_id_index ON public.device_backup_requests USING btree (job_id); + + +-- +-- Name: device_backup_requests_requested_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX device_backup_requests_requested_at_index ON public.device_backup_requests USING btree (requested_at); + + +-- +-- Name: device_firmware_history_detected_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX device_firmware_history_detected_at_index ON public.device_firmware_history USING btree (detected_at); + + +-- +-- Name: device_firmware_history_snmp_device_id_detected_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX device_firmware_history_snmp_device_id_detected_at_index ON public.device_firmware_history USING btree (snmp_device_id, detected_at); + + +-- +-- Name: device_link_evidence_device_link_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX device_link_evidence_device_link_id_index ON public.device_link_evidence USING btree (device_link_id); + + +-- +-- Name: device_link_evidence_observed_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX device_link_evidence_observed_at_index ON public.device_link_evidence USING btree (observed_at); + + +-- +-- Name: device_links_source_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX device_links_source_device_id_index ON public.device_links USING btree (source_device_id); + + +-- +-- Name: device_links_src_iface_remote_mac; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX device_links_src_iface_remote_mac ON public.device_links USING btree (source_device_id, source_interface_id, discovered_remote_mac); + + +-- +-- Name: device_links_target_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX device_links_target_device_id_index ON public.device_links USING btree (target_device_id); + + +-- +-- Name: device_mikrotik_backups_device_id_backed_up_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX device_mikrotik_backups_device_id_backed_up_at_index ON public.device_mikrotik_backups USING btree (device_id, backed_up_at); + + +-- +-- Name: device_neighbors_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX device_neighbors_device_id_index ON public.device_neighbors USING btree (device_id); + + +-- +-- Name: device_neighbors_last_seen_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX device_neighbors_last_seen_at_index ON public.device_neighbors USING btree (last_seen_at); + + +-- +-- Name: device_neighbors_neighbor_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX device_neighbors_neighbor_device_id_index ON public.device_neighbors USING btree (neighbor_device_id); + + +-- +-- Name: device_neighbors_unique_link; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX device_neighbors_unique_link ON public.device_neighbors USING btree (device_id, local_port, neighbor_name); + + +-- +-- Name: device_profiles_enabled_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX device_profiles_enabled_index ON public.device_profiles USING btree (enabled); + + +-- +-- Name: device_profiles_name_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX device_profiles_name_index ON public.device_profiles USING btree (name); + + +-- +-- Name: device_profiles_priority_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX device_profiles_priority_index ON public.device_profiles USING btree (priority); + + +-- +-- Name: device_subscriber_links_device_id_gaiia_account_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX device_subscriber_links_device_id_gaiia_account_id_index ON public.device_subscriber_links USING btree (device_id, gaiia_account_id); + + +-- +-- Name: device_subscriber_links_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX device_subscriber_links_device_id_index ON public.device_subscriber_links USING btree (device_id); + + +-- +-- Name: device_subscriber_links_gaiia_account_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX device_subscriber_links_gaiia_account_id_index ON public.device_subscriber_links USING btree (gaiia_account_id); + + +-- +-- Name: device_subscriber_links_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX device_subscriber_links_organization_id_index ON public.device_subscriber_links USING btree (organization_id); + + +-- +-- Name: devices_monitoring_enabled_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX devices_monitoring_enabled_index ON public.devices USING btree (monitoring_enabled); + + +-- +-- Name: devices_organization_id_display_order_name_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX devices_organization_id_display_order_name_index ON public.devices USING btree (organization_id, display_order, name); + + +-- +-- Name: devices_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX devices_organization_id_index ON public.devices USING btree (organization_id); + + +-- +-- Name: devices_organization_id_status_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX devices_organization_id_status_idx ON public.devices USING btree (organization_id, status); + + +-- +-- Name: devices_site_id_display_order_name_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX devices_site_id_display_order_name_index ON public.devices USING btree (site_id, display_order, name); + + +-- +-- Name: devices_site_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX devices_site_id_index ON public.devices USING btree (site_id); + + +-- +-- Name: devices_snmp_community_source_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX devices_snmp_community_source_index ON public.devices USING btree (snmp_community_source); + + +-- +-- Name: equipment_events_equipment_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX equipment_events_equipment_id_index ON public.device_events USING btree (device_id); + + +-- +-- Name: equipment_events_equipment_id_occurred_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX equipment_events_equipment_id_occurred_at_index ON public.device_events USING btree (device_id, occurred_at); + + +-- +-- Name: equipment_events_event_type_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX equipment_events_event_type_index ON public.device_events USING btree (event_type); + + +-- +-- Name: equipment_events_occurred_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX equipment_events_occurred_at_index ON public.device_events USING btree (occurred_at); + + +-- +-- Name: equipment_last_snmp_poll_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX equipment_last_snmp_poll_at_index ON public.devices USING btree (last_snmp_poll_at); + + +-- +-- Name: equipment_status_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX equipment_status_index ON public.devices USING btree (status); + + +-- +-- Name: error_tracker_errors_fingerprint_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX error_tracker_errors_fingerprint_index ON public.error_tracker_errors USING btree (fingerprint); + + +-- +-- Name: error_tracker_errors_last_occurrence_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX error_tracker_errors_last_occurrence_at_index ON public.error_tracker_errors USING btree (last_occurrence_at); + + +-- +-- Name: error_tracker_occurrences_error_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX error_tracker_occurrences_error_id_index ON public.error_tracker_occurrences USING btree (error_id); + + +-- +-- Name: firmware_releases_vendor_product_line_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX firmware_releases_vendor_product_line_index ON public.firmware_releases USING btree (vendor, product_line); + + +-- +-- Name: gaiia_accounts_organization_id_gaiia_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX gaiia_accounts_organization_id_gaiia_id_index ON public.gaiia_accounts USING btree (organization_id, gaiia_id); + + +-- +-- Name: gaiia_accounts_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX gaiia_accounts_organization_id_index ON public.gaiia_accounts USING btree (organization_id); + + +-- +-- Name: gaiia_billing_subscriptions_account_gaiia_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX gaiia_billing_subscriptions_account_gaiia_id_index ON public.gaiia_billing_subscriptions USING btree (account_gaiia_id); + + +-- +-- Name: gaiia_billing_subscriptions_organization_id_gaiia_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX gaiia_billing_subscriptions_organization_id_gaiia_id_index ON public.gaiia_billing_subscriptions USING btree (organization_id, gaiia_id); + + +-- +-- Name: gaiia_billing_subscriptions_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX gaiia_billing_subscriptions_organization_id_index ON public.gaiia_billing_subscriptions USING btree (organization_id); + + +-- +-- Name: gaiia_inventory_items_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX gaiia_inventory_items_device_id_index ON public.gaiia_inventory_items USING btree (device_id); + + +-- +-- Name: gaiia_inventory_items_organization_id_gaiia_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX gaiia_inventory_items_organization_id_gaiia_id_index ON public.gaiia_inventory_items USING btree (organization_id, gaiia_id); + + +-- +-- Name: gaiia_inventory_items_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX gaiia_inventory_items_organization_id_index ON public.gaiia_inventory_items USING btree (organization_id); + + +-- +-- Name: gaiia_network_sites_organization_id_gaiia_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX gaiia_network_sites_organization_id_gaiia_id_index ON public.gaiia_network_sites USING btree (organization_id, gaiia_id); + + +-- +-- Name: gaiia_network_sites_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX gaiia_network_sites_organization_id_index ON public.gaiia_network_sites USING btree (organization_id); + + +-- +-- Name: gaiia_network_sites_site_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX gaiia_network_sites_site_id_index ON public.gaiia_network_sites USING btree (site_id); + + +-- +-- Name: geoip_blocks_geoname_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX geoip_blocks_geoname_id_index ON public.geoip_blocks USING btree (geoname_id); + + +-- +-- Name: geoip_blocks_network_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX geoip_blocks_network_index ON public.geoip_blocks USING btree (network); + + +-- +-- Name: geoip_blocks_start_ip_int_end_ip_int_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX geoip_blocks_start_ip_int_end_ip_int_index ON public.geoip_blocks USING btree (start_ip_int, end_ip_int); + + +-- +-- Name: idx_alerts_device_type_unresolved; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idx_alerts_device_type_unresolved ON public.alerts USING btree (device_id, alert_type, resolved_at) WHERE (resolved_at IS NULL); + + +-- +-- Name: idx_alerts_org_triggered; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idx_alerts_org_triggered ON public.alerts USING btree (organization_id, triggered_at); + + +-- +-- Name: idx_alerts_org_type_unresolved; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idx_alerts_org_type_unresolved ON public.alerts USING btree (organization_id, alert_type, resolved_at) WHERE (resolved_at IS NULL); + + +-- +-- Name: idx_devices_snmp_monitoring_site; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idx_devices_snmp_monitoring_site ON public.devices USING btree (snmp_enabled, monitoring_enabled, site_id) WHERE ((snmp_enabled = true) AND (monitoring_enabled = true)); + + +-- +-- Name: idx_devices_snmp_poll; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idx_devices_snmp_poll ON public.devices USING btree (snmp_enabled, last_snmp_poll_at) WHERE (snmp_enabled = true); + + +-- +-- Name: integrations_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX integrations_organization_id_index ON public.integrations USING btree (organization_id); + + +-- +-- Name: integrations_organization_id_provider_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX integrations_organization_id_provider_index ON public.integrations USING btree (organization_id, provider); + + +-- +-- Name: ip_blocks_banned_until_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ip_blocks_banned_until_index ON public.ip_blocks USING btree (banned_until); + + +-- +-- Name: ip_blocks_ip_address_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX ip_blocks_ip_address_index ON public.ip_blocks USING btree (ip_address); + + +-- +-- Name: ip_blocks_last_violation_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ip_blocks_last_violation_at_index ON public.ip_blocks USING btree (last_violation_at); + + +-- +-- Name: ip_whitelist_added_by_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ip_whitelist_added_by_id_index ON public.ip_whitelist USING btree (added_by_id); + + +-- +-- Name: ip_whitelist_ip_or_cidr_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX ip_whitelist_ip_or_cidr_index ON public.ip_whitelist USING btree (ip_or_cidr); + + +-- +-- Name: login_attempts_anonymized_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX login_attempts_anonymized_at_index ON public.login_attempts USING btree (anonymized_at); + + +-- +-- Name: login_attempts_email_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX login_attempts_email_index ON public.login_attempts USING btree (email); + + +-- +-- Name: login_attempts_inserted_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX login_attempts_inserted_at_index ON public.login_attempts USING btree (inserted_at); + + +-- +-- Name: login_attempts_ip_address_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX login_attempts_ip_address_index ON public.login_attempts USING btree (ip_address); + + +-- +-- Name: login_attempts_success_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX login_attempts_success_index ON public.login_attempts USING btree (success); + + +-- +-- Name: login_attempts_user_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX login_attempts_user_id_index ON public.login_attempts USING btree (user_id); + + +-- +-- Name: login_attempts_user_id_inserted_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX login_attempts_user_id_inserted_at_index ON public.login_attempts USING btree (user_id, inserted_at); + + +-- +-- Name: maintenance_windows_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX maintenance_windows_device_id_index ON public.maintenance_windows USING btree (device_id); + + +-- +-- Name: maintenance_windows_ends_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX maintenance_windows_ends_at_index ON public.maintenance_windows USING btree (ends_at); + + +-- +-- Name: maintenance_windows_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX maintenance_windows_organization_id_index ON public.maintenance_windows USING btree (organization_id); + + +-- +-- Name: maintenance_windows_site_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX maintenance_windows_site_id_index ON public.maintenance_windows USING btree (site_id); + + +-- +-- Name: maintenance_windows_starts_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX maintenance_windows_starts_at_index ON public.maintenance_windows USING btree (starts_at); + + +-- +-- Name: mobile_sessions_expires_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX mobile_sessions_expires_at_index ON public.mobile_sessions USING btree (expires_at); + + +-- +-- Name: mobile_sessions_token_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX mobile_sessions_token_index ON public.mobile_sessions USING btree (token); + + +-- +-- Name: mobile_sessions_user_id_alerts_enabled_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX mobile_sessions_user_id_alerts_enabled_index ON public.mobile_sessions USING btree (user_id, alerts_enabled); + + +-- +-- Name: mobile_sessions_user_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX mobile_sessions_user_id_index ON public.mobile_sessions USING btree (user_id); + + +-- +-- Name: monitoring_checks_agent_token_id_device_id_checked_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX monitoring_checks_agent_token_id_device_id_checked_at_index ON public.monitoring_checks USING btree (agent_token_id, device_id, checked_at); + + +-- +-- Name: monitoring_checks_checked_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX monitoring_checks_checked_at_index ON public.monitoring_checks USING btree (checked_at); + + +-- +-- Name: monitoring_checks_device_id_agent_token_id_status_checked_at_in; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX monitoring_checks_device_id_agent_token_id_status_checked_at_in ON public.monitoring_checks USING btree (device_id, agent_token_id, status, checked_at); + + +-- +-- Name: monitoring_checks_equipment_id_checked_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX monitoring_checks_equipment_id_checked_at_index ON public.monitoring_checks USING btree (device_id, checked_at); + + +-- +-- Name: monitoring_checks_equipment_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX monitoring_checks_equipment_id_index ON public.monitoring_checks USING btree (device_id); + + +-- +-- Name: oban_jobs_args_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX oban_jobs_args_index ON public.oban_jobs USING gin (args); + + +-- +-- Name: oban_jobs_batch_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX oban_jobs_batch_index ON public.oban_jobs USING btree (state, ((meta ->> 'batch_id'::text)), ((meta ->> 'callback'::text))) WHERE (meta ? 'batch_id'::text); + + +-- +-- Name: oban_jobs_chain_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX oban_jobs_chain_index ON public.oban_jobs USING btree (state, ((meta ->> 'chain_id'::text)), ((meta ->> 'on_hold'::text))) WHERE (meta ? 'chain_id'::text); + + +-- +-- Name: oban_jobs_meta_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX oban_jobs_meta_index ON public.oban_jobs USING gin (meta); + + +-- +-- Name: oban_jobs_partition_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX oban_jobs_partition_index ON public.oban_jobs USING btree (partition_key, queue, priority, scheduled_at, id) WHERE ((state = 'available'::public.oban_job_state) AND (partition_key IS NOT NULL)); + + +-- +-- Name: oban_jobs_state_queue_priority_scheduled_at_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX oban_jobs_state_queue_priority_scheduled_at_id_index ON public.oban_jobs USING btree (state, queue, priority, scheduled_at, id); + + +-- +-- Name: oban_jobs_sup_workflow_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX oban_jobs_sup_workflow_index ON public.oban_jobs USING btree (((meta ->> 'sup_workflow_id'::text)), state, ((meta ->> 'on_hold'::text))) WHERE (meta ? 'sup_workflow_id'::text); + + +-- +-- Name: oban_jobs_unique_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX oban_jobs_unique_index ON public.oban_jobs USING btree (uniq_key) WHERE (uniq_key IS NOT NULL); + + +-- +-- Name: oban_jobs_workflow_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX oban_jobs_workflow_index ON public.oban_jobs USING btree (((meta ->> 'workflow_id'::text)), state, ((meta ->> 'on_hold'::text)), ((meta ->> 'name'::text))) WHERE (meta ? 'workflow_id'::text); + + +-- +-- Name: organization_invitations_email_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX organization_invitations_email_index ON public.organization_invitations USING btree (email); + + +-- +-- Name: organization_invitations_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX organization_invitations_organization_id_index ON public.organization_invitations USING btree (organization_id); + + +-- +-- Name: organization_invitations_token_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX organization_invitations_token_index ON public.organization_invitations USING btree (token); + + +-- +-- Name: organization_memberships_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX organization_memberships_organization_id_index ON public.organization_memberships USING btree (organization_id); + + +-- +-- Name: organization_memberships_organization_id_user_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX organization_memberships_organization_id_user_id_index ON public.organization_memberships USING btree (organization_id, user_id); + + +-- +-- Name: organization_memberships_user_id_default_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX organization_memberships_user_id_default_index ON public.organization_memberships USING btree (user_id, is_default) WHERE (is_default = true); + + +-- +-- Name: organization_memberships_user_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX organization_memberships_user_id_index ON public.organization_memberships USING btree (user_id); + + +-- +-- Name: organizations_default_agent_token_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX organizations_default_agent_token_id_index ON public.organizations USING btree (default_agent_token_id); + + +-- +-- Name: organizations_slug_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX organizations_slug_index ON public.organizations USING btree (slug); + + +-- +-- Name: organizations_subscription_plan_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX organizations_subscription_plan_index ON public.organizations USING btree (subscription_plan); + + +-- +-- Name: policy_versions_effective_date_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX policy_versions_effective_date_index ON public.policy_versions USING btree (effective_date); + + +-- +-- Name: policy_versions_policy_type_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX policy_versions_policy_type_index ON public.policy_versions USING btree (policy_type); + + +-- +-- Name: policy_versions_policy_type_version_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX policy_versions_policy_type_version_index ON public.policy_versions USING btree (policy_type, version); + + +-- +-- Name: preseem_access_points_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX preseem_access_points_device_id_index ON public.preseem_access_points USING btree (device_id); + + +-- +-- Name: preseem_access_points_match_confidence_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX preseem_access_points_match_confidence_index ON public.preseem_access_points USING btree (match_confidence); + + +-- +-- Name: preseem_access_points_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX preseem_access_points_organization_id_index ON public.preseem_access_points USING btree (organization_id); + + +-- +-- Name: preseem_access_points_organization_id_preseem_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX preseem_access_points_organization_id_preseem_id_index ON public.preseem_access_points USING btree (organization_id, preseem_id); + + +-- +-- Name: preseem_device_baselines_ap_metric_period_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX preseem_device_baselines_ap_metric_period_idx ON public.preseem_device_baselines USING btree (preseem_access_point_id, metric_name, period); + + +-- +-- Name: preseem_device_baselines_preseem_access_point_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX preseem_device_baselines_preseem_access_point_id_index ON public.preseem_device_baselines USING btree (preseem_access_point_id); + + +-- +-- Name: preseem_fleet_profiles_org_model_fw_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX preseem_fleet_profiles_org_model_fw_idx ON public.preseem_fleet_profiles USING btree (organization_id, manufacturer, model, firmware_version); + + +-- +-- Name: preseem_fleet_profiles_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX preseem_fleet_profiles_organization_id_index ON public.preseem_fleet_profiles USING btree (organization_id); + + +-- +-- Name: preseem_insights_agent_token_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX preseem_insights_agent_token_id_index ON public.preseem_insights USING btree (agent_token_id); + + +-- +-- Name: preseem_insights_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX preseem_insights_device_id_index ON public.preseem_insights USING btree (device_id); + + +-- +-- Name: preseem_insights_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX preseem_insights_organization_id_index ON public.preseem_insights USING btree (organization_id); + + +-- +-- Name: preseem_insights_organization_id_source_status_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX preseem_insights_organization_id_source_status_index ON public.preseem_insights USING btree (organization_id, source, status); + + +-- +-- Name: preseem_insights_organization_id_status_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX preseem_insights_organization_id_status_index ON public.preseem_insights USING btree (organization_id, status); + + +-- +-- Name: preseem_insights_preseem_access_point_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX preseem_insights_preseem_access_point_id_index ON public.preseem_insights USING btree (preseem_access_point_id); + + +-- +-- Name: preseem_insights_site_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX preseem_insights_site_id_index ON public.preseem_insights USING btree (site_id); + + +-- +-- Name: preseem_subscriber_metrics_preseem_access_point_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX preseem_subscriber_metrics_preseem_access_point_id_index ON public.preseem_subscriber_metrics USING btree (preseem_access_point_id); + + +-- +-- Name: preseem_subscriber_metrics_recorded_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX preseem_subscriber_metrics_recorded_at_index ON public.preseem_subscriber_metrics USING btree (recorded_at); + + +-- +-- Name: preseem_sync_logs_inserted_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX preseem_sync_logs_inserted_at_index ON public.preseem_sync_logs USING btree (inserted_at); + + +-- +-- Name: preseem_sync_logs_integration_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX preseem_sync_logs_integration_id_index ON public.preseem_sync_logs USING btree (integration_id); + + +-- +-- Name: preseem_sync_logs_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX preseem_sync_logs_organization_id_index ON public.preseem_sync_logs USING btree (organization_id); + + +-- +-- Name: profile_device_oids_profile_id_field_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX profile_device_oids_profile_id_field_index ON public.profile_device_oids USING btree (profile_id, field); + + +-- +-- Name: profile_device_oids_profile_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX profile_device_oids_profile_id_index ON public.profile_device_oids USING btree (profile_id); + + +-- +-- Name: profile_sensor_oids_profile_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX profile_sensor_oids_profile_id_index ON public.profile_sensor_oids USING btree (profile_id); + + +-- +-- Name: profile_sensor_oids_sensor_type_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX profile_sensor_oids_sensor_type_index ON public.profile_sensor_oids USING btree (sensor_type); + + +-- +-- Name: qr_login_tokens_expires_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX qr_login_tokens_expires_at_index ON public.qr_login_tokens USING btree (expires_at); + + +-- +-- Name: qr_login_tokens_token_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX qr_login_tokens_token_index ON public.qr_login_tokens USING btree (token); + + +-- +-- Name: qr_login_tokens_user_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX qr_login_tokens_user_id_index ON public.qr_login_tokens USING btree (user_id); + + +-- +-- Name: sites_agent_token_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX sites_agent_token_id_index ON public.sites USING btree (agent_token_id); + + +-- +-- Name: sites_organization_id_display_order_name_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX sites_organization_id_display_order_name_index ON public.sites USING btree (organization_id, display_order, name); + + +-- +-- Name: sites_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX sites_organization_id_index ON public.sites USING btree (organization_id); + + +-- +-- Name: sites_organization_id_latitude_longitude_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX sites_organization_id_latitude_longitude_index ON public.sites USING btree (organization_id, latitude, longitude); + + +-- +-- Name: sites_organization_id_name_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX sites_organization_id_name_index ON public.sites USING btree (organization_id, name); + + +-- +-- Name: sites_parent_site_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX sites_parent_site_id_index ON public.sites USING btree (parent_site_id); + + +-- +-- Name: snmp_arp_entries_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_arp_entries_device_id_index ON public.snmp_arp_entries USING btree (device_id); + + +-- +-- Name: snmp_arp_entries_device_id_ip_address_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_arp_entries_device_id_ip_address_index ON public.snmp_arp_entries USING btree (device_id, ip_address); + + +-- +-- Name: snmp_arp_entries_device_id_ip_address_mac_address_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX snmp_arp_entries_device_id_ip_address_mac_address_index ON public.snmp_arp_entries USING btree (device_id, ip_address, mac_address); + + +-- +-- Name: snmp_arp_entries_mac_address_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_arp_entries_mac_address_index ON public.snmp_arp_entries USING btree (mac_address); + + +-- +-- Name: snmp_devices_equipment_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX snmp_devices_equipment_id_index ON public.snmp_devices USING btree (device_id); + + +-- +-- Name: snmp_interface_stats_checked_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_interface_stats_checked_at_index ON public.snmp_interface_stats USING btree (checked_at); + + +-- +-- Name: snmp_interface_stats_interface_id_checked_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_interface_stats_interface_id_checked_at_index ON public.snmp_interface_stats USING btree (interface_id, checked_at); + + +-- +-- Name: snmp_interface_stats_interface_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_interface_stats_interface_id_index ON public.snmp_interface_stats USING btree (interface_id); + + +-- +-- Name: snmp_interfaces_monitored_true_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_interfaces_monitored_true_idx ON public.snmp_interfaces USING btree (monitored) WHERE (monitored = true); + + +-- +-- Name: snmp_interfaces_snmp_device_id_if_index_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX snmp_interfaces_snmp_device_id_if_index_index ON public.snmp_interfaces USING btree (snmp_device_id, if_index); + + +-- +-- Name: snmp_interfaces_snmp_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_interfaces_snmp_device_id_index ON public.snmp_interfaces USING btree (snmp_device_id); + + +-- +-- Name: snmp_ip_addresses_ip_type_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_ip_addresses_ip_type_index ON public.snmp_ip_addresses USING btree (ip_type); + + +-- +-- Name: snmp_ip_addresses_is_primary_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_ip_addresses_is_primary_index ON public.snmp_ip_addresses USING btree (is_primary); + + +-- +-- Name: snmp_ip_addresses_snmp_interface_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_ip_addresses_snmp_interface_id_index ON public.snmp_ip_addresses USING btree (snmp_interface_id); + + +-- +-- Name: snmp_ip_addresses_snmp_interface_id_ip_address_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX snmp_ip_addresses_snmp_interface_id_ip_address_index ON public.snmp_ip_addresses USING btree (snmp_interface_id, ip_address); + + +-- +-- Name: snmp_mac_addresses_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_mac_addresses_device_id_index ON public.snmp_mac_addresses USING btree (device_id); + + +-- +-- Name: snmp_mac_addresses_device_id_mac_address_vlan_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX snmp_mac_addresses_device_id_mac_address_vlan_id_index ON public.snmp_mac_addresses USING btree (device_id, mac_address, vlan_id) NULLS NOT DISTINCT; + + +-- +-- Name: snmp_mac_addresses_interface_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_mac_addresses_interface_id_index ON public.snmp_mac_addresses USING btree (interface_id); + + +-- +-- Name: snmp_mac_addresses_mac_address_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_mac_addresses_mac_address_index ON public.snmp_mac_addresses USING btree (mac_address); + + +-- +-- Name: snmp_memory_pools_pool_type_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_memory_pools_pool_type_index ON public.snmp_memory_pools USING btree (pool_type); + + +-- +-- Name: snmp_memory_pools_snmp_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_memory_pools_snmp_device_id_index ON public.snmp_memory_pools USING btree (snmp_device_id); + + +-- +-- Name: snmp_memory_pools_snmp_device_id_pool_index_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX snmp_memory_pools_snmp_device_id_pool_index_index ON public.snmp_memory_pools USING btree (snmp_device_id, pool_index); + + +-- +-- Name: snmp_neighbors_equipment_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_neighbors_equipment_id_index ON public.snmp_neighbors USING btree (device_id); + + +-- +-- Name: snmp_neighbors_interface_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_neighbors_interface_id_index ON public.snmp_neighbors USING btree (interface_id); + + +-- +-- Name: snmp_neighbors_interface_id_remote_chassis_id_protocol_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX snmp_neighbors_interface_id_remote_chassis_id_protocol_index ON public.snmp_neighbors USING btree (interface_id, remote_chassis_id, protocol) NULLS NOT DISTINCT; + + +-- +-- Name: snmp_neighbors_last_discovered_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_neighbors_last_discovered_at_index ON public.snmp_neighbors USING btree (last_discovered_at); + + +-- +-- Name: snmp_neighbors_protocol_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_neighbors_protocol_index ON public.snmp_neighbors USING btree (protocol); + + +-- +-- Name: snmp_physical_entities_entity_class_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_physical_entities_entity_class_index ON public.snmp_physical_entities USING btree (entity_class); + + +-- +-- Name: snmp_physical_entities_parent_entity_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_physical_entities_parent_entity_id_index ON public.snmp_physical_entities USING btree (parent_entity_id); + + +-- +-- Name: snmp_physical_entities_serial_number_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_physical_entities_serial_number_index ON public.snmp_physical_entities USING btree (serial_number); + + +-- +-- Name: snmp_physical_entities_snmp_device_id_entity_index_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX snmp_physical_entities_snmp_device_id_entity_index_index ON public.snmp_physical_entities USING btree (snmp_device_id, entity_index); + + +-- +-- Name: snmp_physical_entities_snmp_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_physical_entities_snmp_device_id_index ON public.snmp_physical_entities USING btree (snmp_device_id); + + +-- +-- Name: snmp_processor_readings_checked_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_processor_readings_checked_at_index ON public.snmp_processor_readings USING btree (checked_at); + + +-- +-- Name: snmp_processor_readings_processor_id_checked_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_processor_readings_processor_id_checked_at_index ON public.snmp_processor_readings USING btree (processor_id, checked_at); + + +-- +-- Name: snmp_processor_readings_processor_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_processor_readings_processor_id_index ON public.snmp_processor_readings USING btree (processor_id); + + +-- +-- Name: snmp_processors_snmp_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_processors_snmp_device_id_index ON public.snmp_processors USING btree (snmp_device_id); + + +-- +-- Name: snmp_processors_snmp_device_id_processor_index_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX snmp_processors_snmp_device_id_processor_index_index ON public.snmp_processors USING btree (snmp_device_id, processor_index); + + +-- +-- Name: snmp_sensor_readings_checked_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_sensor_readings_checked_at_index ON public.snmp_sensor_readings USING btree (checked_at); + + +-- +-- Name: snmp_sensor_readings_sensor_id_checked_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_sensor_readings_sensor_id_checked_at_index ON public.snmp_sensor_readings USING btree (sensor_id, checked_at); + + +-- +-- Name: snmp_sensor_readings_sensor_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_sensor_readings_sensor_id_index ON public.snmp_sensor_readings USING btree (sensor_id); + + +-- +-- Name: snmp_sensor_readings_status_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_sensor_readings_status_index ON public.snmp_sensor_readings USING btree (status); + + +-- +-- Name: snmp_sensors_monitored_true_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_sensors_monitored_true_idx ON public.snmp_sensors USING btree (monitored) WHERE (monitored = true); + + +-- +-- Name: snmp_sensors_sensor_type_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_sensors_sensor_type_index ON public.snmp_sensors USING btree (sensor_type); + + +-- +-- Name: snmp_sensors_snmp_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_sensors_snmp_device_id_index ON public.snmp_sensors USING btree (snmp_device_id); + + +-- +-- Name: snmp_sensors_snmp_device_id_sensor_index_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX snmp_sensors_snmp_device_id_sensor_index_index ON public.snmp_sensors USING btree (snmp_device_id, sensor_index); + + +-- +-- Name: snmp_state_sensors_entity_type_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_state_sensors_entity_type_index ON public.snmp_state_sensors USING btree (entity_type); + + +-- +-- Name: snmp_state_sensors_snmp_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_state_sensors_snmp_device_id_index ON public.snmp_state_sensors USING btree (snmp_device_id); + + +-- +-- Name: snmp_state_sensors_snmp_device_id_sensor_index_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX snmp_state_sensors_snmp_device_id_sensor_index_index ON public.snmp_state_sensors USING btree (snmp_device_id, sensor_index); + + +-- +-- Name: snmp_state_sensors_status_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_state_sensors_status_index ON public.snmp_state_sensors USING btree (status); + + +-- +-- Name: snmp_storage_readings_checked_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_storage_readings_checked_at_index ON public.snmp_storage_readings USING btree (checked_at); + + +-- +-- Name: snmp_storage_readings_storage_id_checked_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_storage_readings_storage_id_checked_at_index ON public.snmp_storage_readings USING btree (storage_id, checked_at); + + +-- +-- Name: snmp_storage_readings_storage_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_storage_readings_storage_id_index ON public.snmp_storage_readings USING btree (storage_id); + + +-- +-- Name: snmp_storage_snmp_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_storage_snmp_device_id_index ON public.snmp_storage USING btree (snmp_device_id); + + +-- +-- Name: snmp_storage_snmp_device_id_storage_index_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX snmp_storage_snmp_device_id_storage_index_index ON public.snmp_storage USING btree (snmp_device_id, storage_index); + + +-- +-- Name: snmp_storage_storage_type_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_storage_storage_type_index ON public.snmp_storage USING btree (storage_type); + + +-- +-- Name: snmp_vlans_snmp_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_vlans_snmp_device_id_index ON public.snmp_vlans USING btree (snmp_device_id); + + +-- +-- Name: snmp_vlans_snmp_device_id_vlan_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX snmp_vlans_snmp_device_id_vlan_id_index ON public.snmp_vlans USING btree (snmp_device_id, vlan_id); + + +-- +-- Name: snmp_vlans_status_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX snmp_vlans_status_index ON public.snmp_vlans USING btree (status); + + +-- +-- Name: user_consents_consent_type_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX user_consents_consent_type_index ON public.user_consents USING btree (consent_type); + + +-- +-- Name: user_consents_user_id_consent_type_version_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX user_consents_user_id_consent_type_version_index ON public.user_consents USING btree (user_id, consent_type, version); + + +-- +-- Name: user_consents_user_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX user_consents_user_id_index ON public.user_consents USING btree (user_id); + + +-- +-- Name: user_recovery_codes_code_hash_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX user_recovery_codes_code_hash_index ON public.user_recovery_codes USING btree (code_hash); + + +-- +-- Name: user_recovery_codes_user_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX user_recovery_codes_user_id_index ON public.user_recovery_codes USING btree (user_id); + + +-- +-- Name: user_recovery_codes_user_id_used_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX user_recovery_codes_user_id_used_at_index ON public.user_recovery_codes USING btree (user_id, used_at); + + +-- +-- Name: user_totp_devices_user_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX user_totp_devices_user_id_index ON public.user_totp_devices USING btree (user_id); + + +-- +-- Name: user_totp_devices_user_id_last_used_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX user_totp_devices_user_id_last_used_at_index ON public.user_totp_devices USING btree (user_id, last_used_at); + + +-- +-- Name: users_default_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX users_default_organization_id_index ON public.users USING btree (default_organization_id); + + +-- +-- Name: users_email_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX users_email_index ON public.users USING btree (email); + + +-- +-- Name: users_is_superuser_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX users_is_superuser_index ON public.users USING btree (is_superuser); + + +-- +-- Name: users_tokens_context_token_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX users_tokens_context_token_index ON public.users_tokens USING btree (context, token); + + +-- +-- Name: users_tokens_user_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX users_tokens_user_id_index ON public.users_tokens USING btree (user_id); + + +-- +-- Name: weather_alerts_site_id_ends_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX weather_alerts_site_id_ends_at_index ON public.weather_alerts USING btree (site_id, ends_at); + + +-- +-- Name: weather_alerts_site_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX weather_alerts_site_id_index ON public.weather_alerts USING btree (site_id); + + +-- +-- Name: weather_observations_observed_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX weather_observations_observed_at_index ON public.weather_observations USING btree (observed_at); + + +-- +-- Name: weather_observations_site_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX weather_observations_site_id_index ON public.weather_observations USING btree (site_id); + + +-- +-- Name: weather_observations_site_id_observed_at_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX weather_observations_site_id_observed_at_index ON public.weather_observations USING btree (site_id, observed_at); + + +-- +-- Name: wireless_clients_device_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX wireless_clients_device_id_index ON public.wireless_clients USING btree (device_id); + + +-- +-- Name: wireless_clients_device_id_mac_address_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX wireless_clients_device_id_mac_address_index ON public.wireless_clients USING btree (device_id, mac_address); + + +-- +-- Name: wireless_clients_mac_address_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX wireless_clients_mac_address_index ON public.wireless_clients USING btree (mac_address); + + +-- +-- Name: wireless_clients_organization_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX wireless_clients_organization_id_index ON public.wireless_clients USING btree (organization_id); + + +-- +-- Name: agent_assignments agent_assignments_agent_token_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.agent_assignments + ADD CONSTRAINT agent_assignments_agent_token_id_fkey FOREIGN KEY (agent_token_id) REFERENCES public.agent_tokens(id) ON DELETE RESTRICT; + + +-- +-- Name: agent_assignments agent_assignments_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.agent_assignments + ADD CONSTRAINT agent_assignments_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: agent_tokens agent_tokens_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.agent_tokens + ADD CONSTRAINT agent_tokens_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE RESTRICT; + + +-- +-- Name: alerts alerts_acknowledged_by_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.alerts + ADD CONSTRAINT alerts_acknowledged_by_id_fkey FOREIGN KEY (acknowledged_by_id) REFERENCES public.users(id) ON DELETE SET NULL; + + +-- +-- Name: alerts alerts_check_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.alerts + ADD CONSTRAINT alerts_check_id_fkey FOREIGN KEY (check_id) REFERENCES public.checks(id) ON DELETE CASCADE; + + +-- +-- Name: alerts alerts_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.alerts + ADD CONSTRAINT alerts_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: alerts alerts_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.alerts + ADD CONSTRAINT alerts_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: api_tokens api_tokens_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.api_tokens + ADD CONSTRAINT api_tokens_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: api_tokens api_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.api_tokens + ADD CONSTRAINT api_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: audit_logs audit_logs_superuser_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.audit_logs + ADD CONSTRAINT audit_logs_superuser_id_fkey FOREIGN KEY (superuser_id) REFERENCES public.users(id) ON DELETE SET NULL; + + +-- +-- Name: audit_logs audit_logs_target_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.audit_logs + ADD CONSTRAINT audit_logs_target_user_id_fkey FOREIGN KEY (target_user_id) REFERENCES public.users(id) ON DELETE SET NULL; + + +-- +-- Name: browser_sessions browser_sessions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.browser_sessions + ADD CONSTRAINT browser_sessions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE SET NULL; + + +-- +-- Name: browser_sessions browser_sessions_user_token_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.browser_sessions + ADD CONSTRAINT browser_sessions_user_token_id_fkey FOREIGN KEY (user_token_id) REFERENCES public.users_tokens(id) ON DELETE CASCADE; + + +-- +-- Name: check_results check_results_agent_token_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.check_results + ADD CONSTRAINT check_results_agent_token_id_fkey FOREIGN KEY (agent_token_id) REFERENCES public.agent_tokens(id) ON DELETE SET NULL; + + +-- +-- Name: check_results check_results_check_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.check_results + ADD CONSTRAINT check_results_check_id_fkey FOREIGN KEY (check_id) REFERENCES public.checks(id) ON DELETE CASCADE; + + +-- +-- Name: check_results check_results_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.check_results + ADD CONSTRAINT check_results_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: checks checks_agent_token_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.checks + ADD CONSTRAINT checks_agent_token_id_fkey FOREIGN KEY (agent_token_id) REFERENCES public.agent_tokens(id) ON DELETE SET NULL; + + +-- +-- Name: checks checks_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.checks + ADD CONSTRAINT checks_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: checks checks_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.checks + ADD CONSTRAINT checks_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: config_change_events config_change_events_backup_after_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.config_change_events + ADD CONSTRAINT config_change_events_backup_after_id_fkey FOREIGN KEY (backup_after_id) REFERENCES public.device_mikrotik_backups(id) ON DELETE SET NULL; + + +-- +-- Name: config_change_events config_change_events_backup_before_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.config_change_events + ADD CONSTRAINT config_change_events_backup_before_id_fkey FOREIGN KEY (backup_before_id) REFERENCES public.device_mikrotik_backups(id) ON DELETE SET NULL; + + +-- +-- Name: config_change_events config_change_events_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.config_change_events + ADD CONSTRAINT config_change_events_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: config_change_events config_change_events_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.config_change_events + ADD CONSTRAINT config_change_events_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: device_backup_requests device_backup_requests_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_backup_requests + ADD CONSTRAINT device_backup_requests_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: device_events device_events_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_events + ADD CONSTRAINT device_events_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: device_firmware_history device_firmware_history_snmp_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_firmware_history + ADD CONSTRAINT device_firmware_history_snmp_device_id_fkey FOREIGN KEY (snmp_device_id) REFERENCES public.snmp_devices(id) ON DELETE CASCADE; + + +-- +-- Name: device_link_evidence device_link_evidence_device_link_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_link_evidence + ADD CONSTRAINT device_link_evidence_device_link_id_fkey FOREIGN KEY (device_link_id) REFERENCES public.device_links(id) ON DELETE CASCADE; + + +-- +-- Name: device_links device_links_source_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_links + ADD CONSTRAINT device_links_source_device_id_fkey FOREIGN KEY (source_device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: device_links device_links_source_interface_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_links + ADD CONSTRAINT device_links_source_interface_id_fkey FOREIGN KEY (source_interface_id) REFERENCES public.snmp_interfaces(id) ON DELETE SET NULL; + + +-- +-- Name: device_links device_links_target_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_links + ADD CONSTRAINT device_links_target_device_id_fkey FOREIGN KEY (target_device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: device_links device_links_target_interface_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_links + ADD CONSTRAINT device_links_target_interface_id_fkey FOREIGN KEY (target_interface_id) REFERENCES public.snmp_interfaces(id) ON DELETE SET NULL; + + +-- +-- Name: device_mikrotik_backups device_mikrotik_backups_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_mikrotik_backups + ADD CONSTRAINT device_mikrotik_backups_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: device_neighbors device_neighbors_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_neighbors + ADD CONSTRAINT device_neighbors_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: device_neighbors device_neighbors_neighbor_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_neighbors + ADD CONSTRAINT device_neighbors_neighbor_device_id_fkey FOREIGN KEY (neighbor_device_id) REFERENCES public.devices(id) ON DELETE SET NULL; + + +-- +-- Name: device_subscriber_links device_subscriber_links_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_subscriber_links + ADD CONSTRAINT device_subscriber_links_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: device_subscriber_links device_subscriber_links_gaiia_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_subscriber_links + ADD CONSTRAINT device_subscriber_links_gaiia_account_id_fkey FOREIGN KEY (gaiia_account_id) REFERENCES public.gaiia_accounts(id) ON DELETE CASCADE; + + +-- +-- Name: device_subscriber_links device_subscriber_links_gaiia_inventory_item_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_subscriber_links + ADD CONSTRAINT device_subscriber_links_gaiia_inventory_item_id_fkey FOREIGN KEY (gaiia_inventory_item_id) REFERENCES public.gaiia_inventory_items(id) ON DELETE SET NULL; + + +-- +-- Name: device_subscriber_links device_subscriber_links_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.device_subscriber_links + ADD CONSTRAINT device_subscriber_links_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: devices devices_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.devices + ADD CONSTRAINT devices_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: devices equipment_site_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.devices + ADD CONSTRAINT equipment_site_id_fkey FOREIGN KEY (site_id) REFERENCES public.sites(id) ON DELETE CASCADE; + + +-- +-- Name: error_tracker_occurrences error_tracker_occurrences_error_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.error_tracker_occurrences + ADD CONSTRAINT error_tracker_occurrences_error_id_fkey FOREIGN KEY (error_id) REFERENCES public.error_tracker_errors(id) ON DELETE CASCADE; + + +-- +-- Name: gaiia_accounts gaiia_accounts_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gaiia_accounts + ADD CONSTRAINT gaiia_accounts_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: gaiia_billing_subscriptions gaiia_billing_subscriptions_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gaiia_billing_subscriptions + ADD CONSTRAINT gaiia_billing_subscriptions_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: gaiia_inventory_items gaiia_inventory_items_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gaiia_inventory_items + ADD CONSTRAINT gaiia_inventory_items_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE SET NULL; + + +-- +-- Name: gaiia_inventory_items gaiia_inventory_items_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gaiia_inventory_items + ADD CONSTRAINT gaiia_inventory_items_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: gaiia_network_sites gaiia_network_sites_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gaiia_network_sites + ADD CONSTRAINT gaiia_network_sites_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: gaiia_network_sites gaiia_network_sites_site_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gaiia_network_sites + ADD CONSTRAINT gaiia_network_sites_site_id_fkey FOREIGN KEY (site_id) REFERENCES public.sites(id) ON DELETE SET NULL; + + +-- +-- Name: geoip_blocks geoip_blocks_geoname_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.geoip_blocks + ADD CONSTRAINT geoip_blocks_geoname_id_fkey FOREIGN KEY (geoname_id) REFERENCES public.geoip_locations(geoname_id); + + +-- +-- Name: integrations integrations_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.integrations + ADD CONSTRAINT integrations_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: ip_whitelist ip_whitelist_added_by_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.ip_whitelist + ADD CONSTRAINT ip_whitelist_added_by_id_fkey FOREIGN KEY (added_by_id) REFERENCES public.users(id) ON DELETE SET NULL; + + +-- +-- Name: login_attempts login_attempts_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.login_attempts + ADD CONSTRAINT login_attempts_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE SET NULL; + + +-- +-- Name: maintenance_windows maintenance_windows_created_by_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.maintenance_windows + ADD CONSTRAINT maintenance_windows_created_by_id_fkey FOREIGN KEY (created_by_id) REFERENCES public.users(id) ON DELETE SET NULL; + + +-- +-- Name: maintenance_windows maintenance_windows_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.maintenance_windows + ADD CONSTRAINT maintenance_windows_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: maintenance_windows maintenance_windows_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.maintenance_windows + ADD CONSTRAINT maintenance_windows_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: maintenance_windows maintenance_windows_site_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.maintenance_windows + ADD CONSTRAINT maintenance_windows_site_id_fkey FOREIGN KEY (site_id) REFERENCES public.sites(id) ON DELETE CASCADE; + + +-- +-- Name: mobile_sessions mobile_sessions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mobile_sessions + ADD CONSTRAINT mobile_sessions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: monitoring_checks monitoring_checks_agent_token_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.monitoring_checks + ADD CONSTRAINT monitoring_checks_agent_token_id_fkey FOREIGN KEY (agent_token_id) REFERENCES public.agent_tokens(id) ON DELETE SET NULL; + + +-- +-- Name: monitoring_checks monitoring_checks_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.monitoring_checks + ADD CONSTRAINT monitoring_checks_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: organization_invitations organization_invitations_accepted_by_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.organization_invitations + ADD CONSTRAINT organization_invitations_accepted_by_id_fkey FOREIGN KEY (accepted_by_id) REFERENCES public.users(id) ON DELETE SET NULL; + + +-- +-- Name: organization_invitations organization_invitations_invited_by_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.organization_invitations + ADD CONSTRAINT organization_invitations_invited_by_id_fkey FOREIGN KEY (invited_by_id) REFERENCES public.users(id) ON DELETE SET NULL; + + +-- +-- Name: organization_invitations organization_invitations_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.organization_invitations + ADD CONSTRAINT organization_invitations_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: organization_memberships organization_memberships_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.organization_memberships + ADD CONSTRAINT organization_memberships_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: organization_memberships organization_memberships_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.organization_memberships + ADD CONSTRAINT organization_memberships_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: organizations organizations_default_agent_token_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.organizations + ADD CONSTRAINT organizations_default_agent_token_id_fkey FOREIGN KEY (default_agent_token_id) REFERENCES public.agent_tokens(id) ON DELETE SET NULL; + + +-- +-- Name: preseem_access_points preseem_access_points_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_access_points + ADD CONSTRAINT preseem_access_points_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE SET NULL; + + +-- +-- Name: preseem_access_points preseem_access_points_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_access_points + ADD CONSTRAINT preseem_access_points_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: preseem_device_baselines preseem_device_baselines_preseem_access_point_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_device_baselines + ADD CONSTRAINT preseem_device_baselines_preseem_access_point_id_fkey FOREIGN KEY (preseem_access_point_id) REFERENCES public.preseem_access_points(id) ON DELETE CASCADE; + + +-- +-- Name: preseem_fleet_profiles preseem_fleet_profiles_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_fleet_profiles + ADD CONSTRAINT preseem_fleet_profiles_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: preseem_insights preseem_insights_agent_token_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_insights + ADD CONSTRAINT preseem_insights_agent_token_id_fkey FOREIGN KEY (agent_token_id) REFERENCES public.agent_tokens(id) ON DELETE SET NULL; + + +-- +-- Name: preseem_insights preseem_insights_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_insights + ADD CONSTRAINT preseem_insights_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE SET NULL; + + +-- +-- Name: preseem_insights preseem_insights_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_insights + ADD CONSTRAINT preseem_insights_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: preseem_insights preseem_insights_preseem_access_point_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_insights + ADD CONSTRAINT preseem_insights_preseem_access_point_id_fkey FOREIGN KEY (preseem_access_point_id) REFERENCES public.preseem_access_points(id) ON DELETE CASCADE; + + +-- +-- Name: preseem_insights preseem_insights_site_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_insights + ADD CONSTRAINT preseem_insights_site_id_fkey FOREIGN KEY (site_id) REFERENCES public.sites(id) ON DELETE SET NULL; + + +-- +-- Name: preseem_subscriber_metrics preseem_subscriber_metrics_preseem_access_point_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_subscriber_metrics + ADD CONSTRAINT preseem_subscriber_metrics_preseem_access_point_id_fkey FOREIGN KEY (preseem_access_point_id) REFERENCES public.preseem_access_points(id) ON DELETE CASCADE; + + +-- +-- Name: preseem_sync_logs preseem_sync_logs_integration_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_sync_logs + ADD CONSTRAINT preseem_sync_logs_integration_id_fkey FOREIGN KEY (integration_id) REFERENCES public.integrations(id) ON DELETE CASCADE; + + +-- +-- Name: preseem_sync_logs preseem_sync_logs_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.preseem_sync_logs + ADD CONSTRAINT preseem_sync_logs_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: profile_device_oids profile_device_oids_profile_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.profile_device_oids + ADD CONSTRAINT profile_device_oids_profile_id_fkey FOREIGN KEY (profile_id) REFERENCES public.device_profiles(id) ON DELETE CASCADE; + + +-- +-- Name: profile_sensor_oids profile_sensor_oids_profile_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.profile_sensor_oids + ADD CONSTRAINT profile_sensor_oids_profile_id_fkey FOREIGN KEY (profile_id) REFERENCES public.device_profiles(id) ON DELETE CASCADE; + + +-- +-- Name: qr_login_tokens qr_login_tokens_mobile_session_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.qr_login_tokens + ADD CONSTRAINT qr_login_tokens_mobile_session_id_fkey FOREIGN KEY (mobile_session_id) REFERENCES public.mobile_sessions(id) ON DELETE SET NULL; + + +-- +-- Name: qr_login_tokens qr_login_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.qr_login_tokens + ADD CONSTRAINT qr_login_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: sites sites_agent_token_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.sites + ADD CONSTRAINT sites_agent_token_id_fkey FOREIGN KEY (agent_token_id) REFERENCES public.agent_tokens(id) ON DELETE SET NULL; + + +-- +-- Name: sites sites_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.sites + ADD CONSTRAINT sites_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- Name: sites sites_parent_site_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.sites + ADD CONSTRAINT sites_parent_site_id_fkey FOREIGN KEY (parent_site_id) REFERENCES public.sites(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_arp_entries snmp_arp_entries_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_arp_entries + ADD CONSTRAINT snmp_arp_entries_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_arp_entries snmp_arp_entries_interface_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_arp_entries + ADD CONSTRAINT snmp_arp_entries_interface_id_fkey FOREIGN KEY (interface_id) REFERENCES public.snmp_interfaces(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_devices snmp_devices_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_devices + ADD CONSTRAINT snmp_devices_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_interface_stats snmp_interface_stats_interface_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_interface_stats + ADD CONSTRAINT snmp_interface_stats_interface_id_fkey FOREIGN KEY (interface_id) REFERENCES public.snmp_interfaces(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_interfaces snmp_interfaces_snmp_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_interfaces + ADD CONSTRAINT snmp_interfaces_snmp_device_id_fkey FOREIGN KEY (snmp_device_id) REFERENCES public.snmp_devices(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_ip_addresses snmp_ip_addresses_snmp_interface_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_ip_addresses + ADD CONSTRAINT snmp_ip_addresses_snmp_interface_id_fkey FOREIGN KEY (snmp_interface_id) REFERENCES public.snmp_interfaces(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_mac_addresses snmp_mac_addresses_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_mac_addresses + ADD CONSTRAINT snmp_mac_addresses_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_mac_addresses snmp_mac_addresses_interface_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_mac_addresses + ADD CONSTRAINT snmp_mac_addresses_interface_id_fkey FOREIGN KEY (interface_id) REFERENCES public.snmp_interfaces(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_memory_pools snmp_memory_pools_snmp_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_memory_pools + ADD CONSTRAINT snmp_memory_pools_snmp_device_id_fkey FOREIGN KEY (snmp_device_id) REFERENCES public.snmp_devices(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_neighbors snmp_neighbors_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_neighbors + ADD CONSTRAINT snmp_neighbors_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_neighbors snmp_neighbors_interface_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_neighbors + ADD CONSTRAINT snmp_neighbors_interface_id_fkey FOREIGN KEY (interface_id) REFERENCES public.snmp_interfaces(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_physical_entities snmp_physical_entities_parent_entity_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_physical_entities + ADD CONSTRAINT snmp_physical_entities_parent_entity_id_fkey FOREIGN KEY (parent_entity_id) REFERENCES public.snmp_physical_entities(id) ON DELETE SET NULL; + + +-- +-- Name: snmp_physical_entities snmp_physical_entities_snmp_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_physical_entities + ADD CONSTRAINT snmp_physical_entities_snmp_device_id_fkey FOREIGN KEY (snmp_device_id) REFERENCES public.snmp_devices(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_processor_readings snmp_processor_readings_processor_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_processor_readings + ADD CONSTRAINT snmp_processor_readings_processor_id_fkey FOREIGN KEY (processor_id) REFERENCES public.snmp_processors(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_processors snmp_processors_snmp_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_processors + ADD CONSTRAINT snmp_processors_snmp_device_id_fkey FOREIGN KEY (snmp_device_id) REFERENCES public.snmp_devices(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_sensor_readings snmp_sensor_readings_sensor_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_sensor_readings + ADD CONSTRAINT snmp_sensor_readings_sensor_id_fkey FOREIGN KEY (sensor_id) REFERENCES public.snmp_sensors(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_sensors snmp_sensors_snmp_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_sensors + ADD CONSTRAINT snmp_sensors_snmp_device_id_fkey FOREIGN KEY (snmp_device_id) REFERENCES public.snmp_devices(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_state_sensors snmp_state_sensors_snmp_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_state_sensors + ADD CONSTRAINT snmp_state_sensors_snmp_device_id_fkey FOREIGN KEY (snmp_device_id) REFERENCES public.snmp_devices(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_storage_readings snmp_storage_readings_storage_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_storage_readings + ADD CONSTRAINT snmp_storage_readings_storage_id_fkey FOREIGN KEY (storage_id) REFERENCES public.snmp_storage(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_storage snmp_storage_snmp_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_storage + ADD CONSTRAINT snmp_storage_snmp_device_id_fkey FOREIGN KEY (snmp_device_id) REFERENCES public.snmp_devices(id) ON DELETE CASCADE; + + +-- +-- Name: snmp_vlans snmp_vlans_snmp_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.snmp_vlans + ADD CONSTRAINT snmp_vlans_snmp_device_id_fkey FOREIGN KEY (snmp_device_id) REFERENCES public.snmp_devices(id) ON DELETE CASCADE; + + +-- +-- Name: user_consents user_consents_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_consents + ADD CONSTRAINT user_consents_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: user_recovery_codes user_recovery_codes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_recovery_codes + ADD CONSTRAINT user_recovery_codes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: user_totp_devices user_totp_devices_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.user_totp_devices + ADD CONSTRAINT user_totp_devices_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: users users_default_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.users + ADD CONSTRAINT users_default_organization_id_fkey FOREIGN KEY (default_organization_id) REFERENCES public.organizations(id) ON DELETE SET NULL; + + +-- +-- Name: users_tokens users_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.users_tokens + ADD CONSTRAINT users_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE; + + +-- +-- Name: weather_alerts weather_alerts_site_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.weather_alerts + ADD CONSTRAINT weather_alerts_site_id_fkey FOREIGN KEY (site_id) REFERENCES public.sites(id) ON DELETE CASCADE; + + +-- +-- Name: weather_observations weather_observations_site_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.weather_observations + ADD CONSTRAINT weather_observations_site_id_fkey FOREIGN KEY (site_id) REFERENCES public.sites(id) ON DELETE CASCADE; + + +-- +-- Name: wireless_clients wireless_clients_device_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.wireless_clients + ADD CONSTRAINT wireless_clients_device_id_fkey FOREIGN KEY (device_id) REFERENCES public.devices(id) ON DELETE CASCADE; + + +-- +-- Name: wireless_clients wireless_clients_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.wireless_clients + ADD CONSTRAINT wireless_clients_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organizations(id) ON DELETE CASCADE; + + +-- +-- PostgreSQL database dump complete +-- + +\unrestrict r3N6TGQGFjg82OQMzKEaIDkXV6NW6WJUq2RgUxqvirlVBMgNcH04JLB0uwke4FU + +INSERT INTO public."schema_migrations" (version) VALUES (20251221192340); +INSERT INTO public."schema_migrations" (version) VALUES (20251221192454); +INSERT INTO public."schema_migrations" (version) VALUES (20251221192505); +INSERT INTO public."schema_migrations" (version) VALUES (20251221192513); +INSERT INTO public."schema_migrations" (version) VALUES (20251221193428); +INSERT INTO public."schema_migrations" (version) VALUES (20251221193436); +INSERT INTO public."schema_migrations" (version) VALUES (20251221225717); +INSERT INTO public."schema_migrations" (version) VALUES (20251221231801); +INSERT INTO public."schema_migrations" (version) VALUES (20251224201530); +INSERT INTO public."schema_migrations" (version) VALUES (20251224202206); +INSERT INTO public."schema_migrations" (version) VALUES (20260103191834); +INSERT INTO public."schema_migrations" (version) VALUES (20260103191852); +INSERT INTO public."schema_migrations" (version) VALUES (20260103191853); +INSERT INTO public."schema_migrations" (version) VALUES (20260103191854); +INSERT INTO public."schema_migrations" (version) VALUES (20260103191858); +INSERT INTO public."schema_migrations" (version) VALUES (20260103191859); +INSERT INTO public."schema_migrations" (version) VALUES (20260103192153); +INSERT INTO public."schema_migrations" (version) VALUES (20260103192154); +INSERT INTO public."schema_migrations" (version) VALUES (20260104175728); +INSERT INTO public."schema_migrations" (version) VALUES (20260104190824); +INSERT INTO public."schema_migrations" (version) VALUES (20260104192555); +INSERT INTO public."schema_migrations" (version) VALUES (20260105134321); +INSERT INTO public."schema_migrations" (version) VALUES (20260105134404); +INSERT INTO public."schema_migrations" (version) VALUES (20260105142046); +INSERT INTO public."schema_migrations" (version) VALUES (20260105163301); +INSERT INTO public."schema_migrations" (version) VALUES (20260106184002); +INSERT INTO public."schema_migrations" (version) VALUES (20260106184003); +INSERT INTO public."schema_migrations" (version) VALUES (20260106184151); +INSERT INTO public."schema_migrations" (version) VALUES (20260109184838); +INSERT INTO public."schema_migrations" (version) VALUES (20260109184905); +INSERT INTO public."schema_migrations" (version) VALUES (20260109190858); +INSERT INTO public."schema_migrations" (version) VALUES (20260113192744); +INSERT INTO public."schema_migrations" (version) VALUES (20260114142010); +INSERT INTO public."schema_migrations" (version) VALUES (20260115010646); +INSERT INTO public."schema_migrations" (version) VALUES (20260115011502); +INSERT INTO public."schema_migrations" (version) VALUES (20260115194425); +INSERT INTO public."schema_migrations" (version) VALUES (20260115212928); +INSERT INTO public."schema_migrations" (version) VALUES (20260116185112); +INSERT INTO public."schema_migrations" (version) VALUES (20260116195231); +INSERT INTO public."schema_migrations" (version) VALUES (20260117174218); +INSERT INTO public."schema_migrations" (version) VALUES (20260117190134); +INSERT INTO public."schema_migrations" (version) VALUES (20260117222456); +INSERT INTO public."schema_migrations" (version) VALUES (20260117224818); +INSERT INTO public."schema_migrations" (version) VALUES (20260117231451); +INSERT INTO public."schema_migrations" (version) VALUES (20260118000250); +INSERT INTO public."schema_migrations" (version) VALUES (20260118002432); +INSERT INTO public."schema_migrations" (version) VALUES (20260118152752); +INSERT INTO public."schema_migrations" (version) VALUES (20260118162909); +INSERT INTO public."schema_migrations" (version) VALUES (20260118174155); +INSERT INTO public."schema_migrations" (version) VALUES (20260118174612); +INSERT INTO public."schema_migrations" (version) VALUES (20260118185149); +INSERT INTO public."schema_migrations" (version) VALUES (20260118193856); +INSERT INTO public."schema_migrations" (version) VALUES (20260118220947); +INSERT INTO public."schema_migrations" (version) VALUES (20260118223410); +INSERT INTO public."schema_migrations" (version) VALUES (20260118223700); +INSERT INTO public."schema_migrations" (version) VALUES (20260119162749); +INSERT INTO public."schema_migrations" (version) VALUES (20260119163701); +INSERT INTO public."schema_migrations" (version) VALUES (20260121161424); +INSERT INTO public."schema_migrations" (version) VALUES (20260121162517); +INSERT INTO public."schema_migrations" (version) VALUES (20260121163134); +INSERT INTO public."schema_migrations" (version) VALUES (20260121163706); +INSERT INTO public."schema_migrations" (version) VALUES (20260121164728); +INSERT INTO public."schema_migrations" (version) VALUES (20260121164729); +INSERT INTO public."schema_migrations" (version) VALUES (20260122191230); +INSERT INTO public."schema_migrations" (version) VALUES (20260122214253); +INSERT INTO public."schema_migrations" (version) VALUES (20260122223758); +INSERT INTO public."schema_migrations" (version) VALUES (20260122234739); +INSERT INTO public."schema_migrations" (version) VALUES (20260123142110); +INSERT INTO public."schema_migrations" (version) VALUES (20260123150047); +INSERT INTO public."schema_migrations" (version) VALUES (20260123234053); +INSERT INTO public."schema_migrations" (version) VALUES (20260124003501); +INSERT INTO public."schema_migrations" (version) VALUES (20260124003545); +INSERT INTO public."schema_migrations" (version) VALUES (20260124220530); +INSERT INTO public."schema_migrations" (version) VALUES (20260125180847); +INSERT INTO public."schema_migrations" (version) VALUES (20260125182836); +INSERT INTO public."schema_migrations" (version) VALUES (20260125183652); +INSERT INTO public."schema_migrations" (version) VALUES (20260125214415); +INSERT INTO public."schema_migrations" (version) VALUES (20260125214531); +INSERT INTO public."schema_migrations" (version) VALUES (20260126155907); +INSERT INTO public."schema_migrations" (version) VALUES (20260126155937); +INSERT INTO public."schema_migrations" (version) VALUES (20260126201725); +INSERT INTO public."schema_migrations" (version) VALUES (20260126201941); +INSERT INTO public."schema_migrations" (version) VALUES (20260126225422); +INSERT INTO public."schema_migrations" (version) VALUES (20260126225620); +INSERT INTO public."schema_migrations" (version) VALUES (20260127131415); +INSERT INTO public."schema_migrations" (version) VALUES (20260127194059); +INSERT INTO public."schema_migrations" (version) VALUES (20260128151151); +INSERT INTO public."schema_migrations" (version) VALUES (20260128171916); +INSERT INTO public."schema_migrations" (version) VALUES (20260128185500); +INSERT INTO public."schema_migrations" (version) VALUES (20260128193436); +INSERT INTO public."schema_migrations" (version) VALUES (20260128205714); +INSERT INTO public."schema_migrations" (version) VALUES (20260129164956); +INSERT INTO public."schema_migrations" (version) VALUES (20260129170433); +INSERT INTO public."schema_migrations" (version) VALUES (20260129194732); +INSERT INTO public."schema_migrations" (version) VALUES (20260129194802); +INSERT INTO public."schema_migrations" (version) VALUES (20260130232533); +INSERT INTO public."schema_migrations" (version) VALUES (20260131151011); +INSERT INTO public."schema_migrations" (version) VALUES (20260131154549); +INSERT INTO public."schema_migrations" (version) VALUES (20260131181404); +INSERT INTO public."schema_migrations" (version) VALUES (20260131195010); +INSERT INTO public."schema_migrations" (version) VALUES (20260131195046); +INSERT INTO public."schema_migrations" (version) VALUES (20260131220933); +INSERT INTO public."schema_migrations" (version) VALUES (20260201155525); +INSERT INTO public."schema_migrations" (version) VALUES (20260201155526); +INSERT INTO public."schema_migrations" (version) VALUES (20260201195548); +INSERT INTO public."schema_migrations" (version) VALUES (20260201204935); +INSERT INTO public."schema_migrations" (version) VALUES (20260201211908); +INSERT INTO public."schema_migrations" (version) VALUES (20260201211918); +INSERT INTO public."schema_migrations" (version) VALUES (20260201211919); +INSERT INTO public."schema_migrations" (version) VALUES (20260202000112); +INSERT INTO public."schema_migrations" (version) VALUES (20260202000113); +INSERT INTO public."schema_migrations" (version) VALUES (20260202144931); +INSERT INTO public."schema_migrations" (version) VALUES (20260202164115); +INSERT INTO public."schema_migrations" (version) VALUES (20260202215155); +INSERT INTO public."schema_migrations" (version) VALUES (20260202221637); +INSERT INTO public."schema_migrations" (version) VALUES (20260202225627); +INSERT INTO public."schema_migrations" (version) VALUES (20260202230847); +INSERT INTO public."schema_migrations" (version) VALUES (20260203144612); +INSERT INTO public."schema_migrations" (version) VALUES (20260203184229); +INSERT INTO public."schema_migrations" (version) VALUES (20260203214942); +INSERT INTO public."schema_migrations" (version) VALUES (20260203215025); +INSERT INTO public."schema_migrations" (version) VALUES (20260203215100); +INSERT INTO public."schema_migrations" (version) VALUES (20260204182005); +INSERT INTO public."schema_migrations" (version) VALUES (20260204182038); +INSERT INTO public."schema_migrations" (version) VALUES (20260204182109); +INSERT INTO public."schema_migrations" (version) VALUES (20260204183342); +INSERT INTO public."schema_migrations" (version) VALUES (20260204193548); +INSERT INTO public."schema_migrations" (version) VALUES (20260204220500); +INSERT INTO public."schema_migrations" (version) VALUES (20260204230342); +INSERT INTO public."schema_migrations" (version) VALUES (20260208221636); +INSERT INTO public."schema_migrations" (version) VALUES (20260209152641); +INSERT INTO public."schema_migrations" (version) VALUES (20260210214543); +INSERT INTO public."schema_migrations" (version) VALUES (20260210214544); +INSERT INTO public."schema_migrations" (version) VALUES (20260212155105); +INSERT INTO public."schema_migrations" (version) VALUES (20260212184424); +INSERT INTO public."schema_migrations" (version) VALUES (20260212184428); +INSERT INTO public."schema_migrations" (version) VALUES (20260212184432); +INSERT INTO public."schema_migrations" (version) VALUES (20260212185422); +INSERT INTO public."schema_migrations" (version) VALUES (20260212185433); +INSERT INTO public."schema_migrations" (version) VALUES (20260212185506); +INSERT INTO public."schema_migrations" (version) VALUES (20260212213808); +INSERT INTO public."schema_migrations" (version) VALUES (20260212213840); +INSERT INTO public."schema_migrations" (version) VALUES (20260212225249); +INSERT INTO public."schema_migrations" (version) VALUES (20260212231026); +INSERT INTO public."schema_migrations" (version) VALUES (20260212231052); +INSERT INTO public."schema_migrations" (version) VALUES (20260212231109); +INSERT INTO public."schema_migrations" (version) VALUES (20260213001542); +INSERT INTO public."schema_migrations" (version) VALUES (20260213001547); +INSERT INTO public."schema_migrations" (version) VALUES (20260213144412); +INSERT INTO public."schema_migrations" (version) VALUES (20260213160011); +INSERT INTO public."schema_migrations" (version) VALUES (20260213170408); +INSERT INTO public."schema_migrations" (version) VALUES (20260213201303); +INSERT INTO public."schema_migrations" (version) VALUES (20260213235031); +INSERT INTO public."schema_migrations" (version) VALUES (20260214185554); +INSERT INTO public."schema_migrations" (version) VALUES (20260214200600); +INSERT INTO public."schema_migrations" (version) VALUES (20260214204400); +INSERT INTO public."schema_migrations" (version) VALUES (20260214204700); +INSERT INTO public."schema_migrations" (version) VALUES (20260215222949); +INSERT INTO public."schema_migrations" (version) VALUES (20260215233513); +INSERT INTO public."schema_migrations" (version) VALUES (20260216155500); +INSERT INTO public."schema_migrations" (version) VALUES (20260216155538); +INSERT INTO public."schema_migrations" (version) VALUES (20260216160000); +INSERT INTO public."schema_migrations" (version) VALUES (20260216170000); +INSERT INTO public."schema_migrations" (version) VALUES (20260216180000); +INSERT INTO public."schema_migrations" (version) VALUES (20260217140215); +INSERT INTO public."schema_migrations" (version) VALUES (20260304234205); +INSERT INTO public."schema_migrations" (version) VALUES (20260305144327); +INSERT INTO public."schema_migrations" (version) VALUES (20260305151535); +INSERT INTO public."schema_migrations" (version) VALUES (20260305152524); +INSERT INTO public."schema_migrations" (version) VALUES (20260305152930); +INSERT INTO public."schema_migrations" (version) VALUES (20260305164021); +INSERT INTO public."schema_migrations" (version) VALUES (20260305184122);