@lobu/cli 6.0.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -27
- package/dist/bundled-skills/lobu/SKILL.md +12 -12
- package/dist/commands/_lib/apply/apply-cmd.d.ts +2 -0
- package/dist/commands/_lib/apply/apply-cmd.d.ts.map +1 -1
- package/dist/commands/_lib/apply/apply-cmd.js +26 -0
- package/dist/commands/_lib/apply/apply-cmd.js.map +1 -1
- package/dist/commands/_lib/apply/client.d.ts +1 -1
- package/dist/commands/_lib/apply/client.d.ts.map +1 -1
- package/dist/commands/_lib/apply/desired-state.js +6 -6
- package/dist/commands/_lib/apply/desired-state.js.map +1 -1
- package/dist/commands/agent.d.ts +7 -0
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +65 -1
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/chat.d.ts +12 -9
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +117 -56
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/dev.d.ts +15 -7
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +79 -44
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/doctor.d.ts +1 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +136 -0
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/eval.d.ts +8 -0
- package/dist/commands/eval.d.ts.map +1 -1
- package/dist/commands/eval.js +56 -1
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/init.d.ts +20 -5
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +332 -183
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/link.d.ts +11 -0
- package/dist/commands/link.d.ts.map +1 -0
- package/dist/commands/link.js +28 -0
- package/dist/commands/link.js.map +1 -0
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +14 -2
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/memory/_lib/browser-auth-cmd.d.ts.map +1 -1
- package/dist/commands/memory/_lib/browser-auth-cmd.js +4 -4
- package/dist/commands/memory/_lib/browser-auth-cmd.js.map +1 -1
- package/dist/commands/memory/_lib/install-targets.d.ts.map +1 -1
- package/dist/commands/memory/_lib/install-targets.js +1 -5
- package/dist/commands/memory/_lib/install-targets.js.map +1 -1
- package/dist/commands/memory/_lib/mcp.d.ts +2 -2
- package/dist/commands/memory/_lib/mcp.d.ts.map +1 -1
- package/dist/commands/memory/_lib/mcp.js +24 -12
- package/dist/commands/memory/_lib/mcp.js.map +1 -1
- package/dist/commands/memory/_lib/openclaw-auth.d.ts +1 -0
- package/dist/commands/memory/_lib/openclaw-auth.d.ts.map +1 -1
- package/dist/commands/memory/_lib/openclaw-auth.js +14 -3
- package/dist/commands/memory/_lib/openclaw-auth.js.map +1 -1
- package/dist/commands/memory/_lib/openclaw-cmd.js +1 -1
- package/dist/commands/memory/_lib/openclaw-cmd.js.map +1 -1
- package/dist/commands/memory/_lib/schema.d.ts +2 -2
- package/dist/commands/memory/_lib/schema.d.ts.map +1 -1
- package/dist/commands/memory/_lib/schema.js +3 -3
- package/dist/commands/memory/_lib/schema.js.map +1 -1
- package/dist/commands/memory/_lib/seed-cmd.d.ts.map +1 -1
- package/dist/commands/memory/_lib/seed-cmd.js +5 -6
- package/dist/commands/memory/_lib/seed-cmd.js.map +1 -1
- package/dist/commands/memory/run.d.ts.map +1 -1
- package/dist/commands/memory/run.js +2 -2
- package/dist/commands/memory/run.js.map +1 -1
- package/dist/commands/platforms/platform-prompts.d.ts +0 -1
- package/dist/commands/platforms/platform-prompts.d.ts.map +1 -1
- package/dist/commands/platforms/platform-prompts.js +54 -8
- package/dist/commands/platforms/platform-prompts.js.map +1 -1
- package/dist/commands/telemetry.d.ts +10 -0
- package/dist/commands/telemetry.d.ts.map +1 -0
- package/dist/commands/telemetry.js +68 -0
- package/dist/commands/telemetry.js.map +1 -0
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +1 -1
- package/dist/commands/whoami.js.map +1 -1
- package/dist/connectors/README.md +534 -0
- package/dist/connectors/__tests__/browser-scraper-utils.test.ts +186 -0
- package/dist/connectors/browser-scraper-utils.ts +214 -0
- package/dist/connectors/capterra.ts +273 -0
- package/dist/connectors/g2.ts +286 -0
- package/dist/connectors/github.ts +1553 -0
- package/dist/connectors/glassdoor.ts +291 -0
- package/dist/connectors/gmaps.ts +197 -0
- package/dist/connectors/google_calendar.ts +631 -0
- package/dist/connectors/google_gmail.ts +751 -0
- package/dist/connectors/google_photos.ts +776 -0
- package/dist/connectors/google_play.ts +342 -0
- package/dist/connectors/hackernews.ts +471 -0
- package/dist/connectors/index.ts +23 -0
- package/dist/connectors/ios_appstore.ts +226 -0
- package/dist/connectors/linkedin.ts +471 -0
- package/dist/connectors/microsoft_outlook.ts +410 -0
- package/dist/connectors/producthunt.ts +471 -0
- package/dist/connectors/reddit.ts +600 -0
- package/dist/connectors/rss.ts +448 -0
- package/dist/connectors/spotify.ts +590 -0
- package/dist/connectors/trustpilot.ts +199 -0
- package/dist/connectors/website.ts +629 -0
- package/dist/connectors/whatsapp.ts +1073 -0
- package/dist/connectors/x.ts +526 -0
- package/dist/connectors/youtube.ts +666 -0
- package/dist/db/migrations/00000000000000_baseline.sql +4867 -0
- package/dist/db/migrations/20260405193000_add_mcp_sessions.sql +33 -0
- package/dist/db/migrations/20260408120000_remove_system_connectors.sql +48 -0
- package/dist/db/migrations/20260408120001_optional_compiled_code.sql +6 -0
- package/dist/db/migrations/20260409110000_add_active_watcher_run_index.sql +9 -0
- package/dist/db/migrations/20260409130000_connector_default_config.sql +5 -0
- package/dist/db/migrations/20260410120000_add_agent_secrets.sql +25 -0
- package/dist/db/migrations/20260413170000_add_watcher_group_id.sql +67 -0
- package/dist/db/migrations/20260416120000_add_entity_wa_jid_index.sql +14 -0
- package/dist/db/migrations/20260417100000_add_entity_identities.sql +77 -0
- package/dist/db/migrations/20260418100000_add_auth_runs.sql +83 -0
- package/dist/db/migrations/20260418110000_add_runs_created_by_user.sql +18 -0
- package/dist/db/migrations/20260419120000_add_event_identity_indexes.sql +56 -0
- package/dist/db/migrations/20260420120000_extend_reserved_org_slugs.sql +56 -0
- package/dist/db/migrations/20260424030000_add_watcher_run_correlation.sql +52 -0
- package/dist/db/migrations/20260424130000_relax_events_client_id_fk.sql +47 -0
- package/dist/db/migrations/20260425100000_normalize_watcher_feedback.sql +91 -0
- package/dist/db/migrations/20260425120000_add_run_diagnostics.sql +20 -0
- package/dist/db/migrations/20260425130000_add_repair_agent_plumbing.sql +46 -0
- package/dist/db/migrations/20260426120000_entities_entity_type_fk.sql +101 -0
- package/dist/db/migrations/20260426130000_db_integrity_cleanup.sql +104 -0
- package/dist/db/migrations/20260426130001_db_integrity_cleanup_concurrent.sql +187 -0
- package/dist/db/migrations/20260427133000_events_created_by_nullable.sql +74 -0
- package/dist/db/migrations/20260427140000_identity_engine_indexes.sql +140 -0
- package/dist/db/migrations/20260427150000_drop_events_source_id.sql +177 -0
- package/dist/db/migrations/20260427160000_drop_dead_schema.sql +76 -0
- package/dist/db/migrations/20260427170000_market_founder_to_member.sql +364 -0
- package/dist/db/migrations/20260428040000_cascade_events_watchers_org_fk.sql +66 -0
- package/dist/db/migrations/20260428050000_add_runs_approved_input.sql +9 -0
- package/dist/db/migrations/20260429010000_auth_profile_tenant_scoped_fk.sql +79 -0
- package/dist/db/migrations/20260429060000_extend_runs_for_lobu_queue.sql +108 -0
- package/dist/db/migrations/20260429120000_agent_changed_notify.sql +97 -0
- package/dist/db/migrations/20260429120100_user_auth_profiles_and_model_prefs.sql +36 -0
- package/dist/db/migrations/20260429120200_fix_notify_old_keys.sql +130 -0
- package/dist/db/migrations/20260429130000_oauth_states_cli_sessions_rate_limits.sql +83 -0
- package/dist/db/migrations/20260429140000_phase8_grants_chat_connections_mcp_sessions.sql +84 -0
- package/dist/db/migrations/20260429140100_runs_priority_expires_at_retry_delay.sql +44 -0
- package/dist/db/migrations/20260429180000_drop_invalidatable_cache_triggers.sql +25 -0
- package/dist/db/migrations/20260430005614_agents_apply_fields.sql +21 -0
- package/dist/db/migrations/20260430022231_fix_connection_config_encryption.sql +69 -0
- package/dist/db/migrations/20260430151215_add_task_run_type.sql +77 -0
- package/dist/db/migrations/20260501000000_drop_cli_sessions.sql +27 -0
- package/dist/db/migrations/20260501133000_lobu_memory_mcp_id.sql +117 -0
- package/dist/db/migrations/20260502000000_drop_chat_connections.sql +60 -0
- package/dist/db/migrations/20260503000000_agent_secrets_org_scope.sql +56 -0
- package/dist/db/migrations/20260504000000_flatten_agents_drop_sandbox_model.sql +48 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +147 -23
- package/dist/index.js.map +1 -1
- package/dist/internal/api-client.d.ts +4 -8
- package/dist/internal/api-client.d.ts.map +1 -1
- package/dist/internal/api-client.js +1 -1
- package/dist/internal/api-client.js.map +1 -1
- package/dist/internal/context.js +2 -2
- package/dist/internal/context.js.map +1 -1
- package/dist/internal/credentials.d.ts.map +1 -1
- package/dist/internal/credentials.js +6 -1
- package/dist/internal/credentials.js.map +1 -1
- package/dist/internal/index.d.ts +2 -3
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +2 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/oauth.d.ts +7 -6
- package/dist/internal/oauth.d.ts.map +1 -1
- package/dist/internal/oauth.js +3 -3
- package/dist/internal/project-link.d.ts +10 -0
- package/dist/internal/project-link.d.ts.map +1 -0
- package/dist/internal/project-link.js +48 -0
- package/dist/internal/project-link.js.map +1 -0
- package/dist/providers.json +2 -2
- package/dist/server.bundle.mjs +3173 -4404
- package/dist/start-local.bundle.mjs +71481 -0
- package/dist/templates/README.md.tmpl +10 -11
- package/package.json +14 -12
- package/dist/__tests__/chat.integration.test.d.ts +0 -2
- package/dist/__tests__/chat.integration.test.d.ts.map +0 -1
- package/dist/__tests__/chat.integration.test.js +0 -337
- package/dist/__tests__/chat.integration.test.js.map +0 -1
- package/dist/__tests__/dev.test.d.ts +0 -2
- package/dist/__tests__/dev.test.d.ts.map +0 -1
- package/dist/__tests__/dev.test.js +0 -25
- package/dist/__tests__/dev.test.js.map +0 -1
- package/dist/__tests__/init-memory.test.d.ts +0 -2
- package/dist/__tests__/init-memory.test.d.ts.map +0 -1
- package/dist/__tests__/init-memory.test.js +0 -45
- package/dist/__tests__/init-memory.test.js.map +0 -1
- package/dist/__tests__/token.test.d.ts +0 -2
- package/dist/__tests__/token.test.d.ts.map +0 -1
- package/dist/__tests__/token.test.js +0 -52
- package/dist/__tests__/token.test.js.map +0 -1
- package/dist/commands/_lib/apply/__tests__/client.test.d.ts +0 -2
- package/dist/commands/_lib/apply/__tests__/client.test.d.ts.map +0 -1
- package/dist/commands/_lib/apply/__tests__/client.test.js +0 -23
- package/dist/commands/_lib/apply/__tests__/client.test.js.map +0 -1
- package/dist/commands/_lib/apply/__tests__/desired-state.test.d.ts +0 -2
- package/dist/commands/_lib/apply/__tests__/desired-state.test.d.ts.map +0 -1
- package/dist/commands/_lib/apply/__tests__/desired-state.test.js +0 -140
- package/dist/commands/_lib/apply/__tests__/desired-state.test.js.map +0 -1
- package/dist/commands/_lib/apply/__tests__/diff.test.d.ts +0 -2
- package/dist/commands/_lib/apply/__tests__/diff.test.d.ts.map +0 -1
- package/dist/commands/_lib/apply/__tests__/diff.test.js +0 -378
- package/dist/commands/_lib/apply/__tests__/diff.test.js.map +0 -1
- package/dist/commands/apply.d.ts +0 -3
- package/dist/commands/apply.d.ts.map +0 -1
- package/dist/commands/apply.js +0 -5
- package/dist/commands/apply.js.map +0 -1
- package/dist/commands/memory/_lib/openclaw-auth.test.d.ts +0 -2
- package/dist/commands/memory/_lib/openclaw-auth.test.d.ts.map +0 -1
- package/dist/commands/memory/_lib/openclaw-auth.test.js +0 -9
- package/dist/commands/memory/_lib/openclaw-auth.test.js.map +0 -1
- package/dist/internal/__tests__/api-client.test.d.ts +0 -2
- package/dist/internal/__tests__/api-client.test.d.ts.map +0 -1
- package/dist/internal/__tests__/api-client.test.js +0 -95
- package/dist/internal/__tests__/api-client.test.js.map +0 -1
- package/dist/internal/__tests__/context.test.d.ts +0 -2
- package/dist/internal/__tests__/context.test.d.ts.map +0 -1
- package/dist/internal/__tests__/context.test.js +0 -77
- package/dist/internal/__tests__/context.test.js.map +0 -1
|
@@ -0,0 +1,4867 @@
|
|
|
1
|
+
-- migrate:up
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
SET statement_timeout = 0;
|
|
6
|
+
SET lock_timeout = 0;
|
|
7
|
+
SET idle_in_transaction_session_timeout = 0;
|
|
8
|
+
SET client_encoding = 'UTF8';
|
|
9
|
+
SET standard_conforming_strings = on;
|
|
10
|
+
-- pg_dump emits this with `false` (session-wide) to make every CREATE
|
|
11
|
+
-- statement below schema-unambiguous via fully-qualified names. dbmate
|
|
12
|
+
-- reuses one connection across migrations, so a session-wide blank
|
|
13
|
+
-- `search_path` persists into the NEXT migration — which uses bare
|
|
14
|
+
-- table names (e.g. `INSERT INTO connector_definitions ...`) and fails
|
|
15
|
+
-- with `relation does not exist` on a fresh DB. Setting `true` scopes
|
|
16
|
+
-- the change to this migration's transaction; subsequent migrations get
|
|
17
|
+
-- the default `"$user", public` again.
|
|
18
|
+
SELECT pg_catalog.set_config('search_path', '', true);
|
|
19
|
+
SET check_function_bodies = false;
|
|
20
|
+
SET xmloption = content;
|
|
21
|
+
SET client_min_messages = warning;
|
|
22
|
+
SET row_security = off;
|
|
23
|
+
|
|
24
|
+
--
|
|
25
|
+
-- Name: public; Type: SCHEMA; Schema: -; Owner: -
|
|
26
|
+
--
|
|
27
|
+
|
|
28
|
+
-- *not* creating schema, since initdb creates it
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
--
|
|
32
|
+
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: -
|
|
33
|
+
--
|
|
34
|
+
|
|
35
|
+
COMMENT ON SCHEMA public IS '';
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
--
|
|
39
|
+
-- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: -
|
|
40
|
+
--
|
|
41
|
+
|
|
42
|
+
CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public;
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
--
|
|
46
|
+
-- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner: -
|
|
47
|
+
--
|
|
48
|
+
|
|
49
|
+
COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams';
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
--
|
|
53
|
+
-- Name: vector; Type: EXTENSION; Schema: -; Owner: -
|
|
54
|
+
--
|
|
55
|
+
|
|
56
|
+
CREATE EXTENSION IF NOT EXISTS vector WITH SCHEMA public;
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
--
|
|
60
|
+
-- Name: EXTENSION vector; Type: COMMENT; Schema: -; Owner: -
|
|
61
|
+
--
|
|
62
|
+
|
|
63
|
+
COMMENT ON EXTENSION vector IS 'vector data type and ivfflat and hnsw access methods';
|
|
64
|
+
|
|
65
|
+
--
|
|
66
|
+
-- Name: prevent_entity_cycles(); Type: FUNCTION; Schema: public; Owner: -
|
|
67
|
+
--
|
|
68
|
+
|
|
69
|
+
CREATE FUNCTION public.prevent_entity_cycles() RETURNS trigger
|
|
70
|
+
LANGUAGE plpgsql
|
|
71
|
+
AS $$
|
|
72
|
+
BEGIN
|
|
73
|
+
-- Skip if no parent (top-level entity)
|
|
74
|
+
IF NEW.parent_id IS NULL THEN
|
|
75
|
+
RETURN NEW;
|
|
76
|
+
END IF;
|
|
77
|
+
|
|
78
|
+
-- Check for circular reference using recursive CTE (single query)
|
|
79
|
+
IF EXISTS (
|
|
80
|
+
WITH RECURSIVE ancestors AS (
|
|
81
|
+
-- Start with the new parent
|
|
82
|
+
SELECT parent_id, 1 as depth
|
|
83
|
+
FROM entities
|
|
84
|
+
WHERE id = NEW.parent_id
|
|
85
|
+
|
|
86
|
+
UNION ALL
|
|
87
|
+
|
|
88
|
+
-- Recursively walk up the tree
|
|
89
|
+
SELECT e.parent_id, a.depth + 1
|
|
90
|
+
FROM entities e
|
|
91
|
+
INNER JOIN ancestors a ON e.id = a.parent_id
|
|
92
|
+
WHERE a.depth < 10 -- Prevent infinite loops
|
|
93
|
+
)
|
|
94
|
+
SELECT 1
|
|
95
|
+
FROM ancestors
|
|
96
|
+
WHERE parent_id = NEW.id -- Would create a cycle
|
|
97
|
+
OR depth >= 10 -- Too deep
|
|
98
|
+
) THEN
|
|
99
|
+
RAISE EXCEPTION 'Circular reference detected or hierarchy too deep (max 10 levels)';
|
|
100
|
+
END IF;
|
|
101
|
+
|
|
102
|
+
RETURN NEW;
|
|
103
|
+
END;
|
|
104
|
+
$$;
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
SET default_tablespace = '';
|
|
108
|
+
|
|
109
|
+
SET default_table_access_method = heap;
|
|
110
|
+
|
|
111
|
+
--
|
|
112
|
+
-- Name: account; Type: TABLE; Schema: public; Owner: -
|
|
113
|
+
--
|
|
114
|
+
|
|
115
|
+
CREATE TABLE public.account (
|
|
116
|
+
id text NOT NULL,
|
|
117
|
+
"accountId" text NOT NULL,
|
|
118
|
+
"providerId" text NOT NULL,
|
|
119
|
+
"userId" text NOT NULL,
|
|
120
|
+
"accessToken" text,
|
|
121
|
+
"refreshToken" text,
|
|
122
|
+
"idToken" text,
|
|
123
|
+
"accessTokenExpiresAt" timestamp with time zone,
|
|
124
|
+
"refreshTokenExpiresAt" timestamp with time zone,
|
|
125
|
+
scope text,
|
|
126
|
+
password text,
|
|
127
|
+
"createdAt" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
128
|
+
"updatedAt" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
--
|
|
133
|
+
-- Name: agent_channel_bindings; Type: TABLE; Schema: public; Owner: -
|
|
134
|
+
--
|
|
135
|
+
|
|
136
|
+
CREATE TABLE public.agent_channel_bindings (
|
|
137
|
+
agent_id text NOT NULL,
|
|
138
|
+
platform text NOT NULL,
|
|
139
|
+
channel_id text NOT NULL,
|
|
140
|
+
team_id text,
|
|
141
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
--
|
|
146
|
+
-- Name: agent_connections; Type: TABLE; Schema: public; Owner: -
|
|
147
|
+
--
|
|
148
|
+
|
|
149
|
+
CREATE TABLE public.agent_connections (
|
|
150
|
+
id text NOT NULL,
|
|
151
|
+
agent_id text NOT NULL,
|
|
152
|
+
platform text NOT NULL,
|
|
153
|
+
config jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
154
|
+
settings jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
155
|
+
metadata jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
156
|
+
status text DEFAULT 'active'::text NOT NULL,
|
|
157
|
+
error_message text,
|
|
158
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
159
|
+
updated_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
160
|
+
CONSTRAINT agent_connections_status_check CHECK ((status = ANY (ARRAY['active'::text, 'stopped'::text, 'error'::text])))
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
--
|
|
165
|
+
-- Name: agent_grants; Type: TABLE; Schema: public; Owner: -
|
|
166
|
+
--
|
|
167
|
+
|
|
168
|
+
CREATE TABLE public.agent_grants (
|
|
169
|
+
id bigint NOT NULL,
|
|
170
|
+
agent_id text NOT NULL,
|
|
171
|
+
pattern text NOT NULL,
|
|
172
|
+
expires_at timestamp with time zone,
|
|
173
|
+
granted_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
174
|
+
denied boolean DEFAULT false
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
--
|
|
179
|
+
-- Name: agent_grants_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
180
|
+
--
|
|
181
|
+
|
|
182
|
+
ALTER TABLE public.agent_grants ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
|
|
183
|
+
SEQUENCE NAME public.agent_grants_id_seq
|
|
184
|
+
START WITH 1
|
|
185
|
+
INCREMENT BY 1
|
|
186
|
+
NO MINVALUE
|
|
187
|
+
NO MAXVALUE
|
|
188
|
+
CACHE 1
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
--
|
|
193
|
+
-- Name: agent_users; Type: TABLE; Schema: public; Owner: -
|
|
194
|
+
--
|
|
195
|
+
|
|
196
|
+
CREATE TABLE public.agent_users (
|
|
197
|
+
agent_id text NOT NULL,
|
|
198
|
+
platform text NOT NULL,
|
|
199
|
+
user_id text NOT NULL,
|
|
200
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
--
|
|
205
|
+
-- Name: agents; Type: TABLE; Schema: public; Owner: -
|
|
206
|
+
--
|
|
207
|
+
|
|
208
|
+
CREATE TABLE public.agents (
|
|
209
|
+
id text NOT NULL,
|
|
210
|
+
organization_id text NOT NULL,
|
|
211
|
+
name text DEFAULT 'Agent'::text NOT NULL,
|
|
212
|
+
description text,
|
|
213
|
+
owner_platform text,
|
|
214
|
+
owner_user_id text,
|
|
215
|
+
template_agent_id text,
|
|
216
|
+
parent_connection_id text,
|
|
217
|
+
is_workspace_agent boolean DEFAULT false,
|
|
218
|
+
workspace_id text,
|
|
219
|
+
model text,
|
|
220
|
+
model_selection jsonb DEFAULT '{}'::jsonb,
|
|
221
|
+
provider_model_preferences jsonb DEFAULT '{}'::jsonb,
|
|
222
|
+
network_config jsonb DEFAULT '{}'::jsonb,
|
|
223
|
+
nix_config jsonb DEFAULT '{}'::jsonb,
|
|
224
|
+
mcp_servers jsonb DEFAULT '{}'::jsonb,
|
|
225
|
+
mcp_install_notified jsonb DEFAULT '{}'::jsonb,
|
|
226
|
+
agent_integrations jsonb DEFAULT '{}'::jsonb,
|
|
227
|
+
soul_md text DEFAULT ''::text,
|
|
228
|
+
user_md text DEFAULT ''::text,
|
|
229
|
+
identity_md text DEFAULT ''::text,
|
|
230
|
+
skills_config jsonb DEFAULT '{"skills": []}'::jsonb,
|
|
231
|
+
skill_auto_granted_domains jsonb DEFAULT '[]'::jsonb,
|
|
232
|
+
tools_config jsonb DEFAULT '{}'::jsonb,
|
|
233
|
+
plugins_config jsonb DEFAULT '{}'::jsonb,
|
|
234
|
+
auth_profiles jsonb DEFAULT '[]'::jsonb,
|
|
235
|
+
installed_providers jsonb DEFAULT '[]'::jsonb,
|
|
236
|
+
skill_registries jsonb DEFAULT '[]'::jsonb,
|
|
237
|
+
verbose_logging boolean DEFAULT false,
|
|
238
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
239
|
+
updated_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
240
|
+
last_used_at timestamp with time zone
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
--
|
|
245
|
+
-- Name: auth_profiles; Type: TABLE; Schema: public; Owner: -
|
|
246
|
+
--
|
|
247
|
+
|
|
248
|
+
CREATE TABLE public.auth_profiles (
|
|
249
|
+
id bigint NOT NULL,
|
|
250
|
+
organization_id text NOT NULL,
|
|
251
|
+
slug text NOT NULL,
|
|
252
|
+
display_name text NOT NULL,
|
|
253
|
+
connector_key text NOT NULL,
|
|
254
|
+
profile_kind text NOT NULL,
|
|
255
|
+
status text DEFAULT 'active'::text NOT NULL,
|
|
256
|
+
auth_data jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
257
|
+
account_id text,
|
|
258
|
+
provider text,
|
|
259
|
+
created_by text,
|
|
260
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
261
|
+
updated_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
262
|
+
CONSTRAINT auth_profiles_profile_kind_check CHECK ((profile_kind = ANY (ARRAY['env'::text, 'oauth_app'::text, 'oauth_account'::text, 'browser_session'::text]))),
|
|
263
|
+
CONSTRAINT auth_profiles_status_check CHECK ((status = ANY (ARRAY['active'::text, 'pending_auth'::text, 'error'::text, 'revoked'::text])))
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
--
|
|
268
|
+
-- Name: auth_profiles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
269
|
+
--
|
|
270
|
+
|
|
271
|
+
ALTER TABLE public.auth_profiles ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
|
|
272
|
+
SEQUENCE NAME public.auth_profiles_id_seq
|
|
273
|
+
START WITH 1
|
|
274
|
+
INCREMENT BY 1
|
|
275
|
+
NO MINVALUE
|
|
276
|
+
NO MAXVALUE
|
|
277
|
+
CACHE 1
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
--
|
|
282
|
+
-- Name: connect_tokens; Type: TABLE; Schema: public; Owner: -
|
|
283
|
+
--
|
|
284
|
+
|
|
285
|
+
CREATE TABLE public.connect_tokens (
|
|
286
|
+
id bigint NOT NULL,
|
|
287
|
+
token text NOT NULL,
|
|
288
|
+
connection_id bigint,
|
|
289
|
+
organization_id text NOT NULL,
|
|
290
|
+
connector_key text NOT NULL,
|
|
291
|
+
auth_type text NOT NULL,
|
|
292
|
+
auth_config jsonb,
|
|
293
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
294
|
+
created_by text,
|
|
295
|
+
expires_at timestamp with time zone DEFAULT (now() + '01:00:00'::interval) NOT NULL,
|
|
296
|
+
completed_at timestamp with time zone,
|
|
297
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
298
|
+
auth_profile_id bigint,
|
|
299
|
+
CONSTRAINT connect_tokens_auth_type_check CHECK ((auth_type = ANY (ARRAY['oauth'::text, 'env_keys'::text]))),
|
|
300
|
+
CONSTRAINT connect_tokens_status_check CHECK ((status = ANY (ARRAY['pending'::text, 'completed'::text, 'expired'::text])))
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
--
|
|
305
|
+
-- Name: connect_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
306
|
+
--
|
|
307
|
+
|
|
308
|
+
CREATE SEQUENCE public.connect_tokens_id_seq
|
|
309
|
+
START WITH 1
|
|
310
|
+
INCREMENT BY 1
|
|
311
|
+
NO MINVALUE
|
|
312
|
+
NO MAXVALUE
|
|
313
|
+
CACHE 1;
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
--
|
|
317
|
+
-- Name: connect_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
318
|
+
--
|
|
319
|
+
|
|
320
|
+
ALTER SEQUENCE public.connect_tokens_id_seq OWNED BY public.connect_tokens.id;
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
--
|
|
324
|
+
-- Name: connections; Type: TABLE; Schema: public; Owner: -
|
|
325
|
+
--
|
|
326
|
+
|
|
327
|
+
CREATE TABLE public.connections (
|
|
328
|
+
id bigint NOT NULL,
|
|
329
|
+
organization_id text NOT NULL,
|
|
330
|
+
connector_key text NOT NULL,
|
|
331
|
+
display_name text,
|
|
332
|
+
status text DEFAULT 'active'::text NOT NULL,
|
|
333
|
+
account_id text,
|
|
334
|
+
credentials jsonb,
|
|
335
|
+
entity_ids bigint[],
|
|
336
|
+
config jsonb,
|
|
337
|
+
error_message text,
|
|
338
|
+
created_by text,
|
|
339
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
340
|
+
updated_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
341
|
+
auth_profile_id bigint,
|
|
342
|
+
app_auth_profile_id bigint,
|
|
343
|
+
visibility text DEFAULT 'org'::text NOT NULL,
|
|
344
|
+
deleted_at timestamp with time zone,
|
|
345
|
+
agent_id text,
|
|
346
|
+
CONSTRAINT connections_status_check CHECK ((status = ANY (ARRAY['active'::text, 'paused'::text, 'error'::text, 'revoked'::text, 'pending_auth'::text])))
|
|
347
|
+
);
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
--
|
|
351
|
+
-- Name: connections_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
352
|
+
--
|
|
353
|
+
|
|
354
|
+
CREATE SEQUENCE public.connections_id_seq
|
|
355
|
+
START WITH 1
|
|
356
|
+
INCREMENT BY 1
|
|
357
|
+
NO MINVALUE
|
|
358
|
+
NO MAXVALUE
|
|
359
|
+
CACHE 1;
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
--
|
|
363
|
+
-- Name: connections_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
364
|
+
--
|
|
365
|
+
|
|
366
|
+
ALTER SEQUENCE public.connections_id_seq OWNED BY public.connections.id;
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
--
|
|
370
|
+
-- Name: connector_definitions; Type: TABLE; Schema: public; Owner: -
|
|
371
|
+
--
|
|
372
|
+
|
|
373
|
+
CREATE TABLE public.connector_definitions (
|
|
374
|
+
id integer NOT NULL,
|
|
375
|
+
organization_id text,
|
|
376
|
+
key text NOT NULL,
|
|
377
|
+
name text NOT NULL,
|
|
378
|
+
description text,
|
|
379
|
+
version text DEFAULT '1.0.0'::text NOT NULL,
|
|
380
|
+
auth_schema jsonb,
|
|
381
|
+
feeds_schema jsonb,
|
|
382
|
+
actions_schema jsonb,
|
|
383
|
+
options_schema jsonb,
|
|
384
|
+
status text DEFAULT 'active'::text NOT NULL,
|
|
385
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
386
|
+
updated_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
387
|
+
login_enabled boolean DEFAULT false NOT NULL,
|
|
388
|
+
mcp_config jsonb,
|
|
389
|
+
api_config jsonb,
|
|
390
|
+
api_type text DEFAULT 'api'::text NOT NULL,
|
|
391
|
+
favicon_domain text,
|
|
392
|
+
openapi_config jsonb,
|
|
393
|
+
CONSTRAINT connector_definitions_status_check CHECK ((status = ANY (ARRAY['active'::text, 'archived'::text, 'draft'::text])))
|
|
394
|
+
);
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
--
|
|
398
|
+
-- Name: connector_definitions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
399
|
+
--
|
|
400
|
+
|
|
401
|
+
CREATE SEQUENCE public.connector_definitions_id_seq
|
|
402
|
+
AS integer
|
|
403
|
+
START WITH 1
|
|
404
|
+
INCREMENT BY 1
|
|
405
|
+
NO MINVALUE
|
|
406
|
+
NO MAXVALUE
|
|
407
|
+
CACHE 1;
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
--
|
|
411
|
+
-- Name: connector_definitions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
412
|
+
--
|
|
413
|
+
|
|
414
|
+
ALTER SEQUENCE public.connector_definitions_id_seq OWNED BY public.connector_definitions.id;
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
--
|
|
418
|
+
-- Name: connector_versions; Type: TABLE; Schema: public; Owner: -
|
|
419
|
+
--
|
|
420
|
+
|
|
421
|
+
CREATE TABLE public.connector_versions (
|
|
422
|
+
id integer NOT NULL,
|
|
423
|
+
connector_key text NOT NULL,
|
|
424
|
+
version text NOT NULL,
|
|
425
|
+
compiled_code text NOT NULL,
|
|
426
|
+
compiled_code_hash text,
|
|
427
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
428
|
+
source_code text,
|
|
429
|
+
source_repository text,
|
|
430
|
+
source_ref text,
|
|
431
|
+
source_commit_sha text,
|
|
432
|
+
source_path text
|
|
433
|
+
);
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
--
|
|
437
|
+
-- Name: connector_versions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
438
|
+
--
|
|
439
|
+
|
|
440
|
+
CREATE SEQUENCE public.connector_versions_id_seq
|
|
441
|
+
AS integer
|
|
442
|
+
START WITH 1
|
|
443
|
+
INCREMENT BY 1
|
|
444
|
+
NO MINVALUE
|
|
445
|
+
NO MAXVALUE
|
|
446
|
+
CACHE 1;
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
--
|
|
450
|
+
-- Name: connector_versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
451
|
+
--
|
|
452
|
+
|
|
453
|
+
ALTER SEQUENCE public.connector_versions_id_seq OWNED BY public.connector_versions.id;
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
--
|
|
457
|
+
-- Name: events; Type: TABLE; Schema: public; Owner: -
|
|
458
|
+
--
|
|
459
|
+
|
|
460
|
+
CREATE TABLE public.events (
|
|
461
|
+
id bigint CONSTRAINT event_id_not_null NOT NULL,
|
|
462
|
+
organization_id text NOT NULL,
|
|
463
|
+
entity_ids bigint[],
|
|
464
|
+
source_id integer,
|
|
465
|
+
origin_id text,
|
|
466
|
+
title text,
|
|
467
|
+
payload_type text DEFAULT 'text'::text NOT NULL,
|
|
468
|
+
payload_text text,
|
|
469
|
+
payload_data jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
470
|
+
payload_template jsonb,
|
|
471
|
+
attachments jsonb DEFAULT '[]'::jsonb NOT NULL,
|
|
472
|
+
metadata jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
473
|
+
score numeric(10,2) DEFAULT 0,
|
|
474
|
+
author_name text,
|
|
475
|
+
source_url text,
|
|
476
|
+
occurred_at timestamp with time zone,
|
|
477
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
478
|
+
origin_parent_id text,
|
|
479
|
+
origin_type text,
|
|
480
|
+
connector_key text,
|
|
481
|
+
connection_id bigint,
|
|
482
|
+
feed_key text,
|
|
483
|
+
feed_id bigint,
|
|
484
|
+
run_id bigint,
|
|
485
|
+
semantic_type text DEFAULT 'content'::text NOT NULL,
|
|
486
|
+
client_id text,
|
|
487
|
+
created_by text,
|
|
488
|
+
interaction_type text DEFAULT 'none'::text NOT NULL,
|
|
489
|
+
interaction_status text,
|
|
490
|
+
interaction_input_schema jsonb,
|
|
491
|
+
interaction_input jsonb,
|
|
492
|
+
interaction_output jsonb,
|
|
493
|
+
interaction_error text,
|
|
494
|
+
supersedes_event_id bigint,
|
|
495
|
+
content_length integer GENERATED ALWAYS AS (COALESCE(length(payload_text), 0)) STORED,
|
|
496
|
+
CONSTRAINT events_payload_type_check CHECK ((payload_type = ANY (ARRAY['text'::text, 'markdown'::text, 'json_template'::text, 'media'::text, 'empty'::text]))),
|
|
497
|
+
CONSTRAINT events_interaction_type_check CHECK ((interaction_type = ANY (ARRAY['none'::text, 'approval'::text]))),
|
|
498
|
+
CONSTRAINT events_interaction_status_check CHECK ((interaction_status = ANY (ARRAY['pending'::text, 'approved'::text, 'rejected'::text, 'completed'::text, 'failed'::text]))),
|
|
499
|
+
CONSTRAINT events_semantic_type_not_empty CHECK ((length(btrim(semantic_type)) > 0))
|
|
500
|
+
);
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
--
|
|
504
|
+
-- Name: TABLE events; Type: COMMENT; Schema: public; Owner: -
|
|
505
|
+
--
|
|
506
|
+
|
|
507
|
+
COMMENT ON TABLE public.events IS 'Append-only event log for source ingests, user-authored knowledge, and operation history';
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
--
|
|
511
|
+
-- Name: COLUMN events.id; Type: COMMENT; Schema: public; Owner: -
|
|
512
|
+
--
|
|
513
|
+
|
|
514
|
+
COMMENT ON COLUMN public.events.id IS 'Primary key (BIGSERIAL) - exposed to MCP tools';
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
--
|
|
518
|
+
-- Name: COLUMN events.score; Type: COMMENT; Schema: public; Owner: -
|
|
519
|
+
--
|
|
520
|
+
|
|
521
|
+
COMMENT ON COLUMN public.events.score IS 'Normalized 0-100 score for ranking';
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
--
|
|
525
|
+
-- Name: COLUMN events.run_id; Type: COMMENT; Schema: public; Owner: -
|
|
526
|
+
--
|
|
527
|
+
|
|
528
|
+
COMMENT ON COLUMN public.events.run_id IS 'Links the event to the run that produced or acted on it';
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
--
|
|
532
|
+
-- Name: COLUMN events.origin_type; Type: COMMENT; Schema: public; Owner: -
|
|
533
|
+
--
|
|
534
|
+
|
|
535
|
+
COMMENT ON COLUMN public.events.origin_type IS 'Source-native item type (post, comment, review, issue, etc.)';
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
--
|
|
539
|
+
-- Name: event_embeddings; Type: TABLE; Schema: public; Owner: -
|
|
540
|
+
--
|
|
541
|
+
|
|
542
|
+
CREATE TABLE public.event_embeddings (
|
|
543
|
+
event_id bigint NOT NULL,
|
|
544
|
+
embedding public.vector(768) NOT NULL,
|
|
545
|
+
model_key text,
|
|
546
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL
|
|
547
|
+
);
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
--
|
|
551
|
+
-- Name: content_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
552
|
+
--
|
|
553
|
+
|
|
554
|
+
CREATE SEQUENCE public.content_id_seq
|
|
555
|
+
START WITH 1
|
|
556
|
+
INCREMENT BY 1
|
|
557
|
+
NO MINVALUE
|
|
558
|
+
NO MAXVALUE
|
|
559
|
+
CACHE 1;
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
--
|
|
563
|
+
-- Name: content_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
564
|
+
--
|
|
565
|
+
|
|
566
|
+
ALTER SEQUENCE public.content_id_seq OWNED BY public.events.id;
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
--
|
|
570
|
+
-- Name: entities; Type: TABLE; Schema: public; Owner: -
|
|
571
|
+
--
|
|
572
|
+
|
|
573
|
+
CREATE TABLE public.entities (
|
|
574
|
+
id bigint NOT NULL,
|
|
575
|
+
entity_type text NOT NULL,
|
|
576
|
+
parent_id bigint,
|
|
577
|
+
name text NOT NULL,
|
|
578
|
+
metadata jsonb DEFAULT '{}'::jsonb,
|
|
579
|
+
enabled_classifiers text[],
|
|
580
|
+
created_at timestamp with time zone DEFAULT now(),
|
|
581
|
+
updated_at timestamp with time zone DEFAULT now(),
|
|
582
|
+
organization_id text NOT NULL,
|
|
583
|
+
created_by text NOT NULL,
|
|
584
|
+
slug text NOT NULL,
|
|
585
|
+
current_view_template_version_id integer,
|
|
586
|
+
content text,
|
|
587
|
+
embedding public.vector(768),
|
|
588
|
+
content_tsv tsvector GENERATED ALWAYS AS (to_tsvector('english'::regconfig, ((COALESCE(name, ''::text) || ' '::text) || COALESCE(content, ''::text)))) STORED,
|
|
589
|
+
content_hash text,
|
|
590
|
+
deleted_at timestamp with time zone
|
|
591
|
+
);
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
--
|
|
595
|
+
-- Name: TABLE entities; Type: COMMENT; Schema: public; Owner: -
|
|
596
|
+
--
|
|
597
|
+
|
|
598
|
+
COMMENT ON TABLE public.entities IS 'Unified entity table (brands, products, and future entity types)';
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
--
|
|
602
|
+
-- Name: COLUMN entities.entity_type; Type: COMMENT; Schema: public; Owner: -
|
|
603
|
+
--
|
|
604
|
+
|
|
605
|
+
COMMENT ON COLUMN public.entities.entity_type IS 'Type of entity: brand, product (future: location, feature, team)';
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
--
|
|
609
|
+
-- Name: COLUMN entities.parent_id; Type: COMMENT; Schema: public; Owner: -
|
|
610
|
+
--
|
|
611
|
+
|
|
612
|
+
COMMENT ON COLUMN public.entities.parent_id IS 'Hierarchical parent (products → brands, brands → parent brands)';
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
--
|
|
616
|
+
-- Name: COLUMN entities.enabled_classifiers; Type: COMMENT; Schema: public; Owner: -
|
|
617
|
+
--
|
|
618
|
+
|
|
619
|
+
COMMENT ON COLUMN public.entities.enabled_classifiers IS 'Classifiers enabled for this entity (inherited from parent if NULL)';
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
--
|
|
623
|
+
-- Name: entities_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
624
|
+
--
|
|
625
|
+
|
|
626
|
+
CREATE SEQUENCE public.entities_id_seq
|
|
627
|
+
START WITH 1
|
|
628
|
+
INCREMENT BY 1
|
|
629
|
+
NO MINVALUE
|
|
630
|
+
NO MAXVALUE
|
|
631
|
+
CACHE 1;
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
--
|
|
635
|
+
-- Name: entities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
636
|
+
--
|
|
637
|
+
|
|
638
|
+
ALTER SEQUENCE public.entities_id_seq OWNED BY public.entities.id;
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
--
|
|
642
|
+
-- Name: entity_relationship_type_rules; Type: TABLE; Schema: public; Owner: -
|
|
643
|
+
--
|
|
644
|
+
|
|
645
|
+
CREATE TABLE public.entity_relationship_type_rules (
|
|
646
|
+
id integer NOT NULL,
|
|
647
|
+
relationship_type_id integer NOT NULL,
|
|
648
|
+
source_entity_type_slug text NOT NULL,
|
|
649
|
+
target_entity_type_slug text NOT NULL,
|
|
650
|
+
deleted_at timestamp with time zone,
|
|
651
|
+
created_at timestamp with time zone DEFAULT now(),
|
|
652
|
+
updated_at timestamp with time zone DEFAULT now()
|
|
653
|
+
);
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
--
|
|
657
|
+
-- Name: entity_relationship_type_rules_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
658
|
+
--
|
|
659
|
+
|
|
660
|
+
CREATE SEQUENCE public.entity_relationship_type_rules_id_seq
|
|
661
|
+
AS integer
|
|
662
|
+
START WITH 1
|
|
663
|
+
INCREMENT BY 1
|
|
664
|
+
NO MINVALUE
|
|
665
|
+
NO MAXVALUE
|
|
666
|
+
CACHE 1;
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
--
|
|
670
|
+
-- Name: entity_relationship_type_rules_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
671
|
+
--
|
|
672
|
+
|
|
673
|
+
ALTER SEQUENCE public.entity_relationship_type_rules_id_seq OWNED BY public.entity_relationship_type_rules.id;
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
--
|
|
677
|
+
-- Name: entity_relationship_types; Type: TABLE; Schema: public; Owner: -
|
|
678
|
+
--
|
|
679
|
+
|
|
680
|
+
CREATE TABLE public.entity_relationship_types (
|
|
681
|
+
id integer NOT NULL,
|
|
682
|
+
slug text NOT NULL,
|
|
683
|
+
name text NOT NULL,
|
|
684
|
+
description text,
|
|
685
|
+
organization_id text NOT NULL,
|
|
686
|
+
created_by text,
|
|
687
|
+
metadata_schema jsonb,
|
|
688
|
+
is_symmetric boolean DEFAULT false NOT NULL,
|
|
689
|
+
inverse_type_id integer,
|
|
690
|
+
status text DEFAULT 'active'::text NOT NULL,
|
|
691
|
+
deleted_at timestamp with time zone,
|
|
692
|
+
created_at timestamp with time zone DEFAULT now(),
|
|
693
|
+
updated_at timestamp with time zone DEFAULT now(),
|
|
694
|
+
CONSTRAINT entity_relationship_types_status_check CHECK ((status = ANY (ARRAY['active'::text, 'archived'::text])))
|
|
695
|
+
);
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
--
|
|
699
|
+
-- Name: entity_relationship_types_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
700
|
+
--
|
|
701
|
+
|
|
702
|
+
CREATE SEQUENCE public.entity_relationship_types_id_seq
|
|
703
|
+
AS integer
|
|
704
|
+
START WITH 1
|
|
705
|
+
INCREMENT BY 1
|
|
706
|
+
NO MINVALUE
|
|
707
|
+
NO MAXVALUE
|
|
708
|
+
CACHE 1;
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
--
|
|
712
|
+
-- Name: entity_relationship_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
713
|
+
--
|
|
714
|
+
|
|
715
|
+
ALTER SEQUENCE public.entity_relationship_types_id_seq OWNED BY public.entity_relationship_types.id;
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
--
|
|
719
|
+
-- Name: entity_relationships; Type: TABLE; Schema: public; Owner: -
|
|
720
|
+
--
|
|
721
|
+
|
|
722
|
+
CREATE TABLE public.entity_relationships (
|
|
723
|
+
id integer NOT NULL,
|
|
724
|
+
organization_id text NOT NULL,
|
|
725
|
+
from_entity_id bigint NOT NULL,
|
|
726
|
+
to_entity_id bigint NOT NULL,
|
|
727
|
+
relationship_type_id integer NOT NULL,
|
|
728
|
+
metadata jsonb,
|
|
729
|
+
confidence real,
|
|
730
|
+
source text,
|
|
731
|
+
created_by text,
|
|
732
|
+
updated_by text,
|
|
733
|
+
deleted_at timestamp with time zone,
|
|
734
|
+
created_at timestamp with time zone DEFAULT now(),
|
|
735
|
+
updated_at timestamp with time zone DEFAULT now()
|
|
736
|
+
);
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
--
|
|
740
|
+
-- Name: entity_relationships_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
741
|
+
--
|
|
742
|
+
|
|
743
|
+
CREATE SEQUENCE public.entity_relationships_id_seq
|
|
744
|
+
AS integer
|
|
745
|
+
START WITH 1
|
|
746
|
+
INCREMENT BY 1
|
|
747
|
+
NO MINVALUE
|
|
748
|
+
NO MAXVALUE
|
|
749
|
+
CACHE 1;
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
--
|
|
753
|
+
-- Name: entity_relationships_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
754
|
+
--
|
|
755
|
+
|
|
756
|
+
ALTER SEQUENCE public.entity_relationships_id_seq OWNED BY public.entity_relationships.id;
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
--
|
|
760
|
+
-- Name: entity_type_audit; Type: TABLE; Schema: public; Owner: -
|
|
761
|
+
--
|
|
762
|
+
|
|
763
|
+
CREATE TABLE public.entity_type_audit (
|
|
764
|
+
id integer NOT NULL,
|
|
765
|
+
entity_type_id integer NOT NULL,
|
|
766
|
+
action text NOT NULL,
|
|
767
|
+
actor text,
|
|
768
|
+
before_payload jsonb,
|
|
769
|
+
after_payload jsonb,
|
|
770
|
+
created_at timestamp with time zone DEFAULT now(),
|
|
771
|
+
CONSTRAINT entity_type_audit_action_check CHECK ((action = ANY (ARRAY['create'::text, 'update'::text, 'delete'::text])))
|
|
772
|
+
);
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
--
|
|
776
|
+
-- Name: entity_type_audit_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
777
|
+
--
|
|
778
|
+
|
|
779
|
+
CREATE SEQUENCE public.entity_type_audit_id_seq
|
|
780
|
+
AS integer
|
|
781
|
+
START WITH 1
|
|
782
|
+
INCREMENT BY 1
|
|
783
|
+
NO MINVALUE
|
|
784
|
+
NO MAXVALUE
|
|
785
|
+
CACHE 1;
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
--
|
|
789
|
+
-- Name: entity_type_audit_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
790
|
+
--
|
|
791
|
+
|
|
792
|
+
ALTER SEQUENCE public.entity_type_audit_id_seq OWNED BY public.entity_type_audit.id;
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
--
|
|
796
|
+
-- Name: entity_types; Type: TABLE; Schema: public; Owner: -
|
|
797
|
+
--
|
|
798
|
+
|
|
799
|
+
CREATE TABLE public.entity_types (
|
|
800
|
+
id integer NOT NULL,
|
|
801
|
+
slug text NOT NULL,
|
|
802
|
+
name text NOT NULL,
|
|
803
|
+
description text,
|
|
804
|
+
icon text,
|
|
805
|
+
color text,
|
|
806
|
+
metadata_schema jsonb,
|
|
807
|
+
organization_id text NOT NULL,
|
|
808
|
+
created_by text,
|
|
809
|
+
updated_by text,
|
|
810
|
+
deleted_at timestamp with time zone,
|
|
811
|
+
created_at timestamp with time zone DEFAULT now(),
|
|
812
|
+
updated_at timestamp with time zone DEFAULT now(),
|
|
813
|
+
current_view_template_version_id integer,
|
|
814
|
+
event_kinds jsonb
|
|
815
|
+
);
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
--
|
|
819
|
+
-- Name: entity_types_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
820
|
+
--
|
|
821
|
+
|
|
822
|
+
CREATE SEQUENCE public.entity_types_id_seq
|
|
823
|
+
AS integer
|
|
824
|
+
START WITH 1
|
|
825
|
+
INCREMENT BY 1
|
|
826
|
+
NO MINVALUE
|
|
827
|
+
NO MAXVALUE
|
|
828
|
+
CACHE 1;
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
--
|
|
832
|
+
-- Name: entity_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
833
|
+
--
|
|
834
|
+
|
|
835
|
+
ALTER SEQUENCE public.entity_types_id_seq OWNED BY public.entity_types.id;
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
--
|
|
839
|
+
-- Name: event_classifications; Type: TABLE; Schema: public; Owner: -
|
|
840
|
+
--
|
|
841
|
+
|
|
842
|
+
CREATE TABLE public.event_classifications (
|
|
843
|
+
id bigint NOT NULL,
|
|
844
|
+
event_id bigint NOT NULL,
|
|
845
|
+
classifier_version_id bigint NOT NULL,
|
|
846
|
+
watcher_id bigint,
|
|
847
|
+
window_id bigint,
|
|
848
|
+
"values" text[] NOT NULL,
|
|
849
|
+
confidences jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
850
|
+
source character varying(20) NOT NULL,
|
|
851
|
+
is_manual boolean DEFAULT false NOT NULL,
|
|
852
|
+
reasoning text,
|
|
853
|
+
met_threshold boolean,
|
|
854
|
+
threshold numeric(5,4),
|
|
855
|
+
best_match_attribute text,
|
|
856
|
+
embedding_confidence numeric(6,4),
|
|
857
|
+
created_at timestamp with time zone DEFAULT now(),
|
|
858
|
+
excerpts jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
859
|
+
CONSTRAINT event_classifications_source_check CHECK (((source)::text = ANY (ARRAY[('embedding'::character varying)::text, ('llm'::character varying)::text, ('user'::character varying)::text]))),
|
|
860
|
+
CONSTRAINT event_classifications_values_not_empty CHECK ((cardinality("values") > 0))
|
|
861
|
+
);
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
--
|
|
865
|
+
-- Name: event_classifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
866
|
+
--
|
|
867
|
+
|
|
868
|
+
CREATE SEQUENCE public.event_classifications_id_seq
|
|
869
|
+
START WITH 1
|
|
870
|
+
INCREMENT BY 1
|
|
871
|
+
NO MINVALUE
|
|
872
|
+
NO MAXVALUE
|
|
873
|
+
CACHE 1;
|
|
874
|
+
|
|
875
|
+
|
|
876
|
+
--
|
|
877
|
+
-- Name: event_classifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
878
|
+
--
|
|
879
|
+
|
|
880
|
+
ALTER SEQUENCE public.event_classifications_id_seq OWNED BY public.event_classifications.id;
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
--
|
|
884
|
+
-- Name: event_classifier_versions; Type: TABLE; Schema: public; Owner: -
|
|
885
|
+
--
|
|
886
|
+
|
|
887
|
+
CREATE TABLE public.event_classifier_versions (
|
|
888
|
+
id integer NOT NULL,
|
|
889
|
+
classifier_id integer NOT NULL,
|
|
890
|
+
version integer NOT NULL,
|
|
891
|
+
is_current boolean DEFAULT false,
|
|
892
|
+
attribute_values jsonb NOT NULL,
|
|
893
|
+
min_similarity numeric(5,4) DEFAULT 0.7,
|
|
894
|
+
fallback_value text,
|
|
895
|
+
change_notes text,
|
|
896
|
+
created_by text NOT NULL,
|
|
897
|
+
created_at timestamp with time zone DEFAULT now(),
|
|
898
|
+
preferred_model text DEFAULT '@cf/meta/llama-3.1-8b-instruct'::text,
|
|
899
|
+
extraction_config jsonb
|
|
900
|
+
);
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
--
|
|
904
|
+
-- Name: COLUMN event_classifier_versions.preferred_model; Type: COMMENT; Schema: public; Owner: -
|
|
905
|
+
--
|
|
906
|
+
|
|
907
|
+
COMMENT ON COLUMN public.event_classifier_versions.preferred_model IS 'AI model to use for LLM fallback. Use 8B for simple classifiers (cheap), 70B for complex reasoning (expensive). Default: 8B';
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
--
|
|
911
|
+
-- Name: event_classifier_versions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
912
|
+
--
|
|
913
|
+
|
|
914
|
+
CREATE SEQUENCE public.event_classifier_versions_id_seq
|
|
915
|
+
START WITH 1
|
|
916
|
+
INCREMENT BY 1
|
|
917
|
+
NO MINVALUE
|
|
918
|
+
NO MAXVALUE
|
|
919
|
+
CACHE 1;
|
|
920
|
+
|
|
921
|
+
|
|
922
|
+
--
|
|
923
|
+
-- Name: event_classifier_versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
924
|
+
--
|
|
925
|
+
|
|
926
|
+
ALTER SEQUENCE public.event_classifier_versions_id_seq OWNED BY public.event_classifier_versions.id;
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
--
|
|
930
|
+
-- Name: event_classifiers; Type: TABLE; Schema: public; Owner: -
|
|
931
|
+
--
|
|
932
|
+
|
|
933
|
+
CREATE TABLE public.event_classifiers (
|
|
934
|
+
id integer NOT NULL,
|
|
935
|
+
slug text NOT NULL,
|
|
936
|
+
name text NOT NULL,
|
|
937
|
+
description text,
|
|
938
|
+
attribute_key text NOT NULL,
|
|
939
|
+
status text DEFAULT 'active'::text,
|
|
940
|
+
created_at timestamp with time zone DEFAULT now(),
|
|
941
|
+
updated_at timestamp with time zone DEFAULT now(),
|
|
942
|
+
created_by text NOT NULL,
|
|
943
|
+
entity_id bigint,
|
|
944
|
+
watcher_id bigint,
|
|
945
|
+
organization_id text,
|
|
946
|
+
entity_ids bigint[],
|
|
947
|
+
CONSTRAINT event_classifiers_status_check CHECK ((status = ANY (ARRAY['active'::text, 'deprecated'::text])))
|
|
948
|
+
);
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
--
|
|
952
|
+
-- Name: event_classifiers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
953
|
+
--
|
|
954
|
+
|
|
955
|
+
CREATE SEQUENCE public.event_classifiers_id_seq
|
|
956
|
+
START WITH 1
|
|
957
|
+
INCREMENT BY 1
|
|
958
|
+
NO MINVALUE
|
|
959
|
+
NO MAXVALUE
|
|
960
|
+
CACHE 1;
|
|
961
|
+
|
|
962
|
+
|
|
963
|
+
--
|
|
964
|
+
-- Name: event_classifiers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
965
|
+
--
|
|
966
|
+
|
|
967
|
+
ALTER SEQUENCE public.event_classifiers_id_seq OWNED BY public.event_classifiers.id;
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
CREATE VIEW public.current_event_records AS
|
|
971
|
+
SELECT e.id,
|
|
972
|
+
e.organization_id,
|
|
973
|
+
e.entity_ids,
|
|
974
|
+
e.source_id,
|
|
975
|
+
e.origin_id,
|
|
976
|
+
e.title,
|
|
977
|
+
e.payload_type,
|
|
978
|
+
e.payload_text,
|
|
979
|
+
e.payload_data,
|
|
980
|
+
e.payload_template,
|
|
981
|
+
e.attachments,
|
|
982
|
+
e.metadata,
|
|
983
|
+
e.score,
|
|
984
|
+
emb.embedding,
|
|
985
|
+
e.author_name,
|
|
986
|
+
e.source_url,
|
|
987
|
+
e.occurred_at,
|
|
988
|
+
e.created_at,
|
|
989
|
+
e.origin_parent_id,
|
|
990
|
+
COALESCE(length(e.payload_text), 0) AS content_length,
|
|
991
|
+
e.origin_type,
|
|
992
|
+
e.connector_key,
|
|
993
|
+
e.connection_id,
|
|
994
|
+
e.feed_key,
|
|
995
|
+
e.feed_id,
|
|
996
|
+
e.run_id,
|
|
997
|
+
e.semantic_type,
|
|
998
|
+
e.client_id,
|
|
999
|
+
e.created_by,
|
|
1000
|
+
e.interaction_type,
|
|
1001
|
+
e.interaction_status,
|
|
1002
|
+
e.interaction_input_schema,
|
|
1003
|
+
e.interaction_input,
|
|
1004
|
+
e.interaction_output,
|
|
1005
|
+
e.interaction_error,
|
|
1006
|
+
e.supersedes_event_id
|
|
1007
|
+
FROM (public.events e
|
|
1008
|
+
LEFT JOIN public.event_embeddings emb ON ((emb.event_id = e.id)))
|
|
1009
|
+
WHERE (NOT (EXISTS ( SELECT 1
|
|
1010
|
+
FROM public.events newer
|
|
1011
|
+
WHERE (newer.supersedes_event_id = e.id))));
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
--
|
|
1015
|
+
-- Name: event_thread_tree; Type: VIEW; Schema: public; Owner: -
|
|
1016
|
+
--
|
|
1017
|
+
|
|
1018
|
+
CREATE VIEW public.event_thread_tree AS
|
|
1019
|
+
SELECT e.id,
|
|
1020
|
+
e.origin_id,
|
|
1021
|
+
e.origin_parent_id,
|
|
1022
|
+
e.occurred_at,
|
|
1023
|
+
COALESCE(parent.origin_id, e.origin_id) AS root_origin_id,
|
|
1024
|
+
COALESCE(parent.occurred_at, e.occurred_at) AS root_occurred_at,
|
|
1025
|
+
COALESCE(parent.score, e.score) AS root_score,
|
|
1026
|
+
CASE
|
|
1027
|
+
WHEN (e.origin_parent_id IS NULL) THEN 0
|
|
1028
|
+
ELSE 1
|
|
1029
|
+
END AS depth,
|
|
1030
|
+
ARRAY[(COALESCE(parent.occurred_at, e.occurred_at))::text, (e.id)::text] AS sort_path
|
|
1031
|
+
FROM (public.current_event_records e
|
|
1032
|
+
LEFT JOIN public.current_event_records parent ON (((e.origin_parent_id = parent.origin_id) AND (e.entity_ids && parent.entity_ids))));
|
|
1033
|
+
|
|
1034
|
+
|
|
1035
|
+
--
|
|
1036
|
+
-- Name: feeds; Type: TABLE; Schema: public; Owner: -
|
|
1037
|
+
--
|
|
1038
|
+
|
|
1039
|
+
CREATE TABLE public.feeds (
|
|
1040
|
+
id bigint NOT NULL,
|
|
1041
|
+
organization_id text NOT NULL,
|
|
1042
|
+
connection_id bigint NOT NULL,
|
|
1043
|
+
feed_key text NOT NULL,
|
|
1044
|
+
display_name text,
|
|
1045
|
+
status text DEFAULT 'active'::text NOT NULL,
|
|
1046
|
+
entity_ids bigint[],
|
|
1047
|
+
config jsonb,
|
|
1048
|
+
checkpoint jsonb,
|
|
1049
|
+
last_sync_at timestamp with time zone,
|
|
1050
|
+
last_sync_status text,
|
|
1051
|
+
last_error text,
|
|
1052
|
+
consecutive_failures integer DEFAULT 0 NOT NULL,
|
|
1053
|
+
items_collected bigint DEFAULT 0 NOT NULL,
|
|
1054
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
1055
|
+
updated_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
1056
|
+
pinned_version text,
|
|
1057
|
+
deleted_at timestamp with time zone,
|
|
1058
|
+
schedule text,
|
|
1059
|
+
next_run_at timestamp with time zone,
|
|
1060
|
+
CONSTRAINT feeds_status_check CHECK ((status = ANY (ARRAY['active'::text, 'paused'::text, 'error'::text])))
|
|
1061
|
+
);
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
--
|
|
1065
|
+
-- Name: feeds_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
1066
|
+
--
|
|
1067
|
+
|
|
1068
|
+
CREATE SEQUENCE public.feeds_id_seq
|
|
1069
|
+
START WITH 1
|
|
1070
|
+
INCREMENT BY 1
|
|
1071
|
+
NO MINVALUE
|
|
1072
|
+
NO MAXVALUE
|
|
1073
|
+
CACHE 1;
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
--
|
|
1077
|
+
-- Name: feeds_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
1078
|
+
--
|
|
1079
|
+
|
|
1080
|
+
ALTER SEQUENCE public.feeds_id_seq OWNED BY public.feeds.id;
|
|
1081
|
+
|
|
1082
|
+
|
|
1083
|
+
--
|
|
1084
|
+
-- Name: invitation; Type: TABLE; Schema: public; Owner: -
|
|
1085
|
+
--
|
|
1086
|
+
|
|
1087
|
+
CREATE TABLE public.invitation (
|
|
1088
|
+
id text NOT NULL,
|
|
1089
|
+
"organizationId" text NOT NULL,
|
|
1090
|
+
email text NOT NULL,
|
|
1091
|
+
role text DEFAULT 'member'::text,
|
|
1092
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
1093
|
+
"expiresAt" timestamp with time zone NOT NULL,
|
|
1094
|
+
"createdAt" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1095
|
+
"inviterId" text
|
|
1096
|
+
);
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
--
|
|
1100
|
+
-- Name: latest_event_classifications; Type: TABLE; Schema: public; Owner: -
|
|
1101
|
+
--
|
|
1102
|
+
|
|
1103
|
+
CREATE TABLE public.latest_event_classifications (
|
|
1104
|
+
event_id bigint NOT NULL,
|
|
1105
|
+
classifier_id bigint NOT NULL,
|
|
1106
|
+
id bigint NOT NULL,
|
|
1107
|
+
classifier_version_id bigint NOT NULL,
|
|
1108
|
+
watcher_id bigint,
|
|
1109
|
+
window_id bigint,
|
|
1110
|
+
"values" text[] NOT NULL,
|
|
1111
|
+
confidences jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
1112
|
+
source character varying(20) NOT NULL,
|
|
1113
|
+
is_manual boolean DEFAULT false NOT NULL,
|
|
1114
|
+
reasoning text,
|
|
1115
|
+
created_at timestamp with time zone NOT NULL
|
|
1116
|
+
);
|
|
1117
|
+
|
|
1118
|
+
|
|
1119
|
+
--
|
|
1120
|
+
-- Name: member; Type: TABLE; Schema: public; Owner: -
|
|
1121
|
+
--
|
|
1122
|
+
|
|
1123
|
+
CREATE TABLE public.member (
|
|
1124
|
+
id text NOT NULL,
|
|
1125
|
+
"organizationId" text NOT NULL,
|
|
1126
|
+
"userId" text NOT NULL,
|
|
1127
|
+
role text DEFAULT 'member'::text NOT NULL,
|
|
1128
|
+
"createdAt" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1129
|
+
"teamId" text
|
|
1130
|
+
);
|
|
1131
|
+
|
|
1132
|
+
|
|
1133
|
+
--
|
|
1134
|
+
-- Name: migration_20260315300000_entity_type_org_backfill; Type: TABLE; Schema: public; Owner: -
|
|
1135
|
+
--
|
|
1136
|
+
|
|
1137
|
+
CREATE TABLE public.migration_20260315300000_entity_type_org_backfill (
|
|
1138
|
+
entity_type_id integer CONSTRAINT migration_20260315300000_entity_type_or_entity_type_id_not_null NOT NULL
|
|
1139
|
+
);
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
--
|
|
1143
|
+
-- Name: migration_20260316100000_created_entity_types; Type: TABLE; Schema: public; Owner: -
|
|
1144
|
+
--
|
|
1145
|
+
|
|
1146
|
+
CREATE TABLE public.migration_20260316100000_created_entity_types (
|
|
1147
|
+
entity_type_id integer CONSTRAINT migration_20260316100000_created_entity_entity_type_id_not_null NOT NULL
|
|
1148
|
+
);
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
--
|
|
1152
|
+
-- Name: migration_20260316100000_deleted_default_entity_types; Type: TABLE; Schema: public; Owner: -
|
|
1153
|
+
--
|
|
1154
|
+
|
|
1155
|
+
CREATE TABLE public.migration_20260316100000_deleted_default_entity_types (
|
|
1156
|
+
id integer CONSTRAINT migration_20260316100000_deleted_default_entity_typ_id_not_null NOT NULL,
|
|
1157
|
+
slug text CONSTRAINT migration_20260316100000_deleted_default_entity_t_slug_not_null NOT NULL,
|
|
1158
|
+
name text CONSTRAINT migration_20260316100000_deleted_default_entity_t_name_not_null NOT NULL,
|
|
1159
|
+
description text,
|
|
1160
|
+
icon text,
|
|
1161
|
+
color text,
|
|
1162
|
+
metadata_schema jsonb,
|
|
1163
|
+
organization_id text CONSTRAINT migration_20260316100000_deleted_defau_organization_id_not_null NOT NULL,
|
|
1164
|
+
created_by text,
|
|
1165
|
+
updated_by text,
|
|
1166
|
+
deleted_at timestamp with time zone,
|
|
1167
|
+
created_at timestamp with time zone,
|
|
1168
|
+
updated_at timestamp with time zone,
|
|
1169
|
+
current_view_template_version_id integer
|
|
1170
|
+
);
|
|
1171
|
+
|
|
1172
|
+
|
|
1173
|
+
--
|
|
1174
|
+
-- Name: migration_20260316100000_events_kind_backup; Type: TABLE; Schema: public; Owner: -
|
|
1175
|
+
--
|
|
1176
|
+
|
|
1177
|
+
CREATE TABLE public.migration_20260316100000_events_kind_backup (
|
|
1178
|
+
event_id bigint NOT NULL,
|
|
1179
|
+
old_kind text
|
|
1180
|
+
);
|
|
1181
|
+
|
|
1182
|
+
|
|
1183
|
+
--
|
|
1184
|
+
-- Name: namespace; Type: TABLE; Schema: public; Owner: -
|
|
1185
|
+
--
|
|
1186
|
+
|
|
1187
|
+
CREATE TABLE public.namespace (
|
|
1188
|
+
slug text NOT NULL,
|
|
1189
|
+
type text NOT NULL,
|
|
1190
|
+
ref_id text NOT NULL,
|
|
1191
|
+
created_at timestamp with time zone DEFAULT now(),
|
|
1192
|
+
CONSTRAINT namespace_type_check CHECK ((type = ANY (ARRAY['user'::text, 'organization'::text])))
|
|
1193
|
+
);
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+
--
|
|
1197
|
+
-- Name: notifications; Type: TABLE; Schema: public; Owner: -
|
|
1198
|
+
--
|
|
1199
|
+
|
|
1200
|
+
CREATE TABLE public.notifications (
|
|
1201
|
+
id bigint NOT NULL,
|
|
1202
|
+
organization_id text NOT NULL,
|
|
1203
|
+
user_id text NOT NULL,
|
|
1204
|
+
type text NOT NULL,
|
|
1205
|
+
title text NOT NULL,
|
|
1206
|
+
body text,
|
|
1207
|
+
resource_type text,
|
|
1208
|
+
resource_id text,
|
|
1209
|
+
resource_url text,
|
|
1210
|
+
is_read boolean DEFAULT false NOT NULL,
|
|
1211
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
1212
|
+
CONSTRAINT notifications_type_check CHECK ((type = ANY (ARRAY['action_approval_needed'::text, 'connection_permission_request'::text, 'invitation_received'::text, 'generic'::text, 'agent_message'::text])))
|
|
1213
|
+
);
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
--
|
|
1217
|
+
-- Name: notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
1218
|
+
--
|
|
1219
|
+
|
|
1220
|
+
CREATE SEQUENCE public.notifications_id_seq
|
|
1221
|
+
START WITH 1
|
|
1222
|
+
INCREMENT BY 1
|
|
1223
|
+
NO MINVALUE
|
|
1224
|
+
NO MAXVALUE
|
|
1225
|
+
CACHE 1;
|
|
1226
|
+
|
|
1227
|
+
|
|
1228
|
+
--
|
|
1229
|
+
-- Name: notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
1230
|
+
--
|
|
1231
|
+
|
|
1232
|
+
ALTER SEQUENCE public.notifications_id_seq OWNED BY public.notifications.id;
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
--
|
|
1236
|
+
-- Name: oauth_authorization_codes; Type: TABLE; Schema: public; Owner: -
|
|
1237
|
+
--
|
|
1238
|
+
|
|
1239
|
+
CREATE TABLE public.oauth_authorization_codes (
|
|
1240
|
+
code text NOT NULL,
|
|
1241
|
+
client_id text NOT NULL,
|
|
1242
|
+
user_id text NOT NULL,
|
|
1243
|
+
organization_id text,
|
|
1244
|
+
code_challenge text NOT NULL,
|
|
1245
|
+
code_challenge_method text DEFAULT 'S256'::text NOT NULL,
|
|
1246
|
+
redirect_uri text NOT NULL,
|
|
1247
|
+
scope text,
|
|
1248
|
+
state text,
|
|
1249
|
+
resource text,
|
|
1250
|
+
expires_at timestamp with time zone NOT NULL,
|
|
1251
|
+
used_at timestamp with time zone,
|
|
1252
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL
|
|
1253
|
+
);
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
--
|
|
1257
|
+
-- Name: TABLE oauth_authorization_codes; Type: COMMENT; Schema: public; Owner: -
|
|
1258
|
+
--
|
|
1259
|
+
|
|
1260
|
+
COMMENT ON TABLE public.oauth_authorization_codes IS 'Short-lived authorization codes for PKCE flow';
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
--
|
|
1264
|
+
-- Name: oauth_clients; Type: TABLE; Schema: public; Owner: -
|
|
1265
|
+
--
|
|
1266
|
+
|
|
1267
|
+
CREATE TABLE public.oauth_clients (
|
|
1268
|
+
id text NOT NULL,
|
|
1269
|
+
client_secret text,
|
|
1270
|
+
client_secret_expires_at timestamp with time zone,
|
|
1271
|
+
client_id_issued_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
1272
|
+
redirect_uris text[] NOT NULL,
|
|
1273
|
+
token_endpoint_auth_method text DEFAULT 'none'::text,
|
|
1274
|
+
grant_types text[] DEFAULT ARRAY['authorization_code'::text, 'refresh_token'::text],
|
|
1275
|
+
response_types text[] DEFAULT ARRAY['code'::text],
|
|
1276
|
+
client_name text,
|
|
1277
|
+
client_uri text,
|
|
1278
|
+
logo_uri text,
|
|
1279
|
+
scope text,
|
|
1280
|
+
contacts text[],
|
|
1281
|
+
tos_uri text,
|
|
1282
|
+
policy_uri text,
|
|
1283
|
+
software_id text,
|
|
1284
|
+
software_version text,
|
|
1285
|
+
user_id text,
|
|
1286
|
+
organization_id text,
|
|
1287
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
1288
|
+
updated_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
1289
|
+
metadata jsonb DEFAULT '{}'::jsonb NOT NULL
|
|
1290
|
+
);
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
--
|
|
1294
|
+
-- Name: TABLE oauth_clients; Type: COMMENT; Schema: public; Owner: -
|
|
1295
|
+
--
|
|
1296
|
+
|
|
1297
|
+
COMMENT ON TABLE public.oauth_clients IS 'OAuth 2.1 dynamic client registration for MCP clients';
|
|
1298
|
+
|
|
1299
|
+
|
|
1300
|
+
--
|
|
1301
|
+
-- Name: oauth_device_codes; Type: TABLE; Schema: public; Owner: -
|
|
1302
|
+
--
|
|
1303
|
+
|
|
1304
|
+
CREATE TABLE public.oauth_device_codes (
|
|
1305
|
+
device_code text NOT NULL,
|
|
1306
|
+
user_code text NOT NULL,
|
|
1307
|
+
client_id text NOT NULL,
|
|
1308
|
+
scope text,
|
|
1309
|
+
resource text,
|
|
1310
|
+
user_id text,
|
|
1311
|
+
organization_id text,
|
|
1312
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
1313
|
+
poll_interval integer DEFAULT 5 NOT NULL,
|
|
1314
|
+
expires_at timestamp with time zone NOT NULL,
|
|
1315
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
1316
|
+
CONSTRAINT oauth_device_codes_status_check CHECK ((status = ANY (ARRAY['pending'::text, 'approved'::text, 'denied'::text, 'expired'::text])))
|
|
1317
|
+
);
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
--
|
|
1321
|
+
-- Name: TABLE oauth_device_codes; Type: COMMENT; Schema: public; Owner: -
|
|
1322
|
+
--
|
|
1323
|
+
|
|
1324
|
+
COMMENT ON TABLE public.oauth_device_codes IS 'Device codes for OAuth Device Authorization Grant (RFC 8628)';
|
|
1325
|
+
|
|
1326
|
+
|
|
1327
|
+
--
|
|
1328
|
+
-- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
|
|
1329
|
+
--
|
|
1330
|
+
|
|
1331
|
+
CREATE TABLE public.oauth_tokens (
|
|
1332
|
+
id text NOT NULL,
|
|
1333
|
+
token_type text NOT NULL,
|
|
1334
|
+
token_hash text NOT NULL,
|
|
1335
|
+
client_id text NOT NULL,
|
|
1336
|
+
user_id text NOT NULL,
|
|
1337
|
+
organization_id text,
|
|
1338
|
+
scope text,
|
|
1339
|
+
resource text,
|
|
1340
|
+
parent_token_id text,
|
|
1341
|
+
expires_at timestamp with time zone NOT NULL,
|
|
1342
|
+
revoked_at timestamp with time zone,
|
|
1343
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
1344
|
+
CONSTRAINT oauth_tokens_token_type_check CHECK ((token_type = ANY (ARRAY['access'::text, 'refresh'::text])))
|
|
1345
|
+
);
|
|
1346
|
+
|
|
1347
|
+
|
|
1348
|
+
--
|
|
1349
|
+
-- Name: TABLE oauth_tokens; Type: COMMENT; Schema: public; Owner: -
|
|
1350
|
+
--
|
|
1351
|
+
|
|
1352
|
+
COMMENT ON TABLE public.oauth_tokens IS 'Access and refresh tokens issued by OAuth server';
|
|
1353
|
+
|
|
1354
|
+
|
|
1355
|
+
--
|
|
1356
|
+
-- Name: organization; Type: TABLE; Schema: public; Owner: -
|
|
1357
|
+
--
|
|
1358
|
+
|
|
1359
|
+
CREATE TABLE public.organization (
|
|
1360
|
+
id text NOT NULL,
|
|
1361
|
+
name text NOT NULL,
|
|
1362
|
+
slug text NOT NULL,
|
|
1363
|
+
logo text,
|
|
1364
|
+
"createdAt" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1365
|
+
metadata text,
|
|
1366
|
+
description text,
|
|
1367
|
+
visibility text DEFAULT 'private'::text NOT NULL,
|
|
1368
|
+
CONSTRAINT org_slug_not_reserved CHECK ((slug <> ALL (ARRAY['settings'::text, 'auth'::text, 'api'::text, 'templates'::text, 'help'::text, 'account'::text, 'admin'::text, 'health'::text, 'login'::text, 'logout'::text, 'signup'::text, 'register'::text])))
|
|
1369
|
+
);
|
|
1370
|
+
|
|
1371
|
+
|
|
1372
|
+
--
|
|
1373
|
+
-- Name: organization_lobu_links; Type: TABLE; Schema: public; Owner: -
|
|
1374
|
+
--
|
|
1375
|
+
|
|
1376
|
+
CREATE TABLE public.organization_lobu_links (
|
|
1377
|
+
organization_id text NOT NULL,
|
|
1378
|
+
lobu_url text NOT NULL,
|
|
1379
|
+
created_by text,
|
|
1380
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
1381
|
+
updated_at timestamp with time zone DEFAULT now() NOT NULL
|
|
1382
|
+
);
|
|
1383
|
+
|
|
1384
|
+
|
|
1385
|
+
--
|
|
1386
|
+
-- Name: personal_access_tokens; Type: TABLE; Schema: public; Owner: -
|
|
1387
|
+
--
|
|
1388
|
+
|
|
1389
|
+
CREATE TABLE public.personal_access_tokens (
|
|
1390
|
+
id bigint NOT NULL,
|
|
1391
|
+
token_hash text NOT NULL,
|
|
1392
|
+
token_prefix character varying(16) NOT NULL,
|
|
1393
|
+
user_id text NOT NULL,
|
|
1394
|
+
organization_id text,
|
|
1395
|
+
name text NOT NULL,
|
|
1396
|
+
description text,
|
|
1397
|
+
scope text,
|
|
1398
|
+
expires_at timestamp with time zone,
|
|
1399
|
+
last_used_at timestamp with time zone,
|
|
1400
|
+
revoked_at timestamp with time zone,
|
|
1401
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
1402
|
+
updated_at timestamp with time zone DEFAULT now() NOT NULL
|
|
1403
|
+
);
|
|
1404
|
+
|
|
1405
|
+
|
|
1406
|
+
--
|
|
1407
|
+
-- Name: TABLE personal_access_tokens; Type: COMMENT; Schema: public; Owner: -
|
|
1408
|
+
--
|
|
1409
|
+
|
|
1410
|
+
COMMENT ON TABLE public.personal_access_tokens IS 'Personal Access Tokens for workers, CLI tools, and MCP clients';
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
--
|
|
1414
|
+
-- Name: personal_access_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
1415
|
+
--
|
|
1416
|
+
|
|
1417
|
+
CREATE SEQUENCE public.personal_access_tokens_id_seq
|
|
1418
|
+
START WITH 1
|
|
1419
|
+
INCREMENT BY 1
|
|
1420
|
+
NO MINVALUE
|
|
1421
|
+
NO MAXVALUE
|
|
1422
|
+
CACHE 1;
|
|
1423
|
+
|
|
1424
|
+
|
|
1425
|
+
--
|
|
1426
|
+
-- Name: personal_access_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
1427
|
+
--
|
|
1428
|
+
|
|
1429
|
+
ALTER SEQUENCE public.personal_access_tokens_id_seq OWNED BY public.personal_access_tokens.id;
|
|
1430
|
+
|
|
1431
|
+
|
|
1432
|
+
--
|
|
1433
|
+
-- Name: rate_limits; Type: TABLE; Schema: public; Owner: -
|
|
1434
|
+
--
|
|
1435
|
+
|
|
1436
|
+
CREATE TABLE public.rate_limits (
|
|
1437
|
+
key text NOT NULL,
|
|
1438
|
+
updated_at timestamp with time zone DEFAULT now(),
|
|
1439
|
+
prev_count integer DEFAULT 0,
|
|
1440
|
+
curr_count integer DEFAULT 0,
|
|
1441
|
+
window_start bigint DEFAULT 0
|
|
1442
|
+
);
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
--
|
|
1446
|
+
-- Name: runs; Type: TABLE; Schema: public; Owner: -
|
|
1447
|
+
--
|
|
1448
|
+
|
|
1449
|
+
CREATE TABLE public.runs (
|
|
1450
|
+
id bigint NOT NULL,
|
|
1451
|
+
organization_id text NOT NULL,
|
|
1452
|
+
run_type text NOT NULL,
|
|
1453
|
+
feed_id bigint,
|
|
1454
|
+
connection_id bigint,
|
|
1455
|
+
action_key text,
|
|
1456
|
+
action_input jsonb,
|
|
1457
|
+
action_output jsonb,
|
|
1458
|
+
approval_status text DEFAULT 'auto'::text,
|
|
1459
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
1460
|
+
claimed_by text,
|
|
1461
|
+
claimed_at timestamp with time zone,
|
|
1462
|
+
last_heartbeat_at timestamp with time zone,
|
|
1463
|
+
completed_at timestamp with time zone,
|
|
1464
|
+
connector_key text,
|
|
1465
|
+
connector_version text,
|
|
1466
|
+
checkpoint jsonb,
|
|
1467
|
+
items_collected integer DEFAULT 0,
|
|
1468
|
+
error_message text,
|
|
1469
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
1470
|
+
watcher_id integer,
|
|
1471
|
+
window_id bigint,
|
|
1472
|
+
CONSTRAINT runs_approval_status_check CHECK ((approval_status = ANY (ARRAY['pending'::text, 'approved'::text, 'rejected'::text, 'auto'::text]))),
|
|
1473
|
+
CONSTRAINT runs_run_type_check CHECK ((run_type = ANY (ARRAY['sync'::text, 'action'::text, 'code'::text, 'insight'::text, 'watcher'::text, 'embed_backfill'::text]))),
|
|
1474
|
+
CONSTRAINT runs_status_check CHECK ((status = ANY (ARRAY['pending'::text, 'claimed'::text, 'running'::text, 'completed'::text, 'failed'::text, 'cancelled'::text, 'timeout'::text])))
|
|
1475
|
+
);
|
|
1476
|
+
|
|
1477
|
+
|
|
1478
|
+
--
|
|
1479
|
+
-- Name: runs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
1480
|
+
--
|
|
1481
|
+
|
|
1482
|
+
CREATE SEQUENCE public.runs_id_seq
|
|
1483
|
+
START WITH 1
|
|
1484
|
+
INCREMENT BY 1
|
|
1485
|
+
NO MINVALUE
|
|
1486
|
+
NO MAXVALUE
|
|
1487
|
+
CACHE 1;
|
|
1488
|
+
|
|
1489
|
+
|
|
1490
|
+
--
|
|
1491
|
+
-- Name: runs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
1492
|
+
--
|
|
1493
|
+
|
|
1494
|
+
ALTER SEQUENCE public.runs_id_seq OWNED BY public.runs.id;
|
|
1495
|
+
|
|
1496
|
+
|
|
1497
|
+
--
|
|
1498
|
+
--
|
|
1499
|
+
-- Name: session; Type: TABLE; Schema: public; Owner: -
|
|
1500
|
+
--
|
|
1501
|
+
|
|
1502
|
+
CREATE TABLE public.session (
|
|
1503
|
+
id text NOT NULL,
|
|
1504
|
+
"expiresAt" timestamp with time zone NOT NULL,
|
|
1505
|
+
token text NOT NULL,
|
|
1506
|
+
"createdAt" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1507
|
+
"updatedAt" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1508
|
+
"ipAddress" text,
|
|
1509
|
+
"userAgent" text,
|
|
1510
|
+
"userId" text NOT NULL,
|
|
1511
|
+
"activeOrganizationId" text
|
|
1512
|
+
);
|
|
1513
|
+
|
|
1514
|
+
|
|
1515
|
+
--
|
|
1516
|
+
-- Name: source_type_auth_defaults; Type: TABLE; Schema: public; Owner: -
|
|
1517
|
+
--
|
|
1518
|
+
|
|
1519
|
+
CREATE TABLE public.source_type_auth_defaults (
|
|
1520
|
+
id bigint NOT NULL,
|
|
1521
|
+
organization_id text NOT NULL,
|
|
1522
|
+
crawler_type text NOT NULL,
|
|
1523
|
+
auth_values jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
1524
|
+
created_by text NOT NULL,
|
|
1525
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
1526
|
+
updated_at timestamp with time zone DEFAULT now() NOT NULL
|
|
1527
|
+
);
|
|
1528
|
+
|
|
1529
|
+
|
|
1530
|
+
--
|
|
1531
|
+
-- Name: source_type_auth_defaults_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
1532
|
+
--
|
|
1533
|
+
|
|
1534
|
+
CREATE SEQUENCE public.source_type_auth_defaults_id_seq
|
|
1535
|
+
START WITH 1
|
|
1536
|
+
INCREMENT BY 1
|
|
1537
|
+
NO MINVALUE
|
|
1538
|
+
NO MAXVALUE
|
|
1539
|
+
CACHE 1;
|
|
1540
|
+
|
|
1541
|
+
|
|
1542
|
+
--
|
|
1543
|
+
-- Name: source_type_auth_defaults_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
1544
|
+
--
|
|
1545
|
+
|
|
1546
|
+
ALTER SEQUENCE public.source_type_auth_defaults_id_seq OWNED BY public.source_type_auth_defaults.id;
|
|
1547
|
+
|
|
1548
|
+
|
|
1549
|
+
--
|
|
1550
|
+
-- Name: team; Type: TABLE; Schema: public; Owner: -
|
|
1551
|
+
--
|
|
1552
|
+
|
|
1553
|
+
CREATE TABLE public.team (
|
|
1554
|
+
id text NOT NULL,
|
|
1555
|
+
"organizationId" text NOT NULL,
|
|
1556
|
+
name text NOT NULL,
|
|
1557
|
+
"createdAt" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1558
|
+
"updatedAt" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1559
|
+
);
|
|
1560
|
+
|
|
1561
|
+
|
|
1562
|
+
--
|
|
1563
|
+
-- Name: user; Type: TABLE; Schema: public; Owner: -
|
|
1564
|
+
--
|
|
1565
|
+
|
|
1566
|
+
CREATE TABLE public."user" (
|
|
1567
|
+
id text NOT NULL,
|
|
1568
|
+
name text NOT NULL,
|
|
1569
|
+
email text NOT NULL,
|
|
1570
|
+
"emailVerified" boolean DEFAULT false NOT NULL,
|
|
1571
|
+
image text,
|
|
1572
|
+
"createdAt" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1573
|
+
"updatedAt" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1574
|
+
"phoneNumber" text,
|
|
1575
|
+
"phoneNumberVerified" boolean DEFAULT false,
|
|
1576
|
+
username text,
|
|
1577
|
+
CONSTRAINT username_not_reserved CHECK ((username <> ALL (ARRAY['settings'::text, 'auth'::text, 'api'::text, 'templates'::text, 'help'::text, 'account'::text, 'admin'::text, 'health'::text, 'login'::text, 'logout'::text, 'signup'::text, 'register'::text])))
|
|
1578
|
+
);
|
|
1579
|
+
|
|
1580
|
+
|
|
1581
|
+
--
|
|
1582
|
+
-- Name: verification; Type: TABLE; Schema: public; Owner: -
|
|
1583
|
+
--
|
|
1584
|
+
|
|
1585
|
+
CREATE TABLE public.verification (
|
|
1586
|
+
id text NOT NULL,
|
|
1587
|
+
identifier text NOT NULL,
|
|
1588
|
+
value text NOT NULL,
|
|
1589
|
+
"expiresAt" timestamp with time zone NOT NULL,
|
|
1590
|
+
"createdAt" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1591
|
+
"updatedAt" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1592
|
+
);
|
|
1593
|
+
|
|
1594
|
+
|
|
1595
|
+
--
|
|
1596
|
+
-- Name: view_template_active_tabs; Type: TABLE; Schema: public; Owner: -
|
|
1597
|
+
--
|
|
1598
|
+
|
|
1599
|
+
CREATE TABLE public.view_template_active_tabs (
|
|
1600
|
+
id integer NOT NULL,
|
|
1601
|
+
resource_type text NOT NULL,
|
|
1602
|
+
resource_id text NOT NULL,
|
|
1603
|
+
organization_id text NOT NULL,
|
|
1604
|
+
tab_name text NOT NULL,
|
|
1605
|
+
tab_order integer DEFAULT 0,
|
|
1606
|
+
current_version_id integer NOT NULL,
|
|
1607
|
+
CONSTRAINT view_template_active_tabs_resource_type_check CHECK ((resource_type = ANY (ARRAY['entity_type'::text, 'entity'::text])))
|
|
1608
|
+
);
|
|
1609
|
+
|
|
1610
|
+
|
|
1611
|
+
--
|
|
1612
|
+
-- Name: view_template_active_tabs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
1613
|
+
--
|
|
1614
|
+
|
|
1615
|
+
CREATE SEQUENCE public.view_template_active_tabs_id_seq
|
|
1616
|
+
AS integer
|
|
1617
|
+
START WITH 1
|
|
1618
|
+
INCREMENT BY 1
|
|
1619
|
+
NO MINVALUE
|
|
1620
|
+
NO MAXVALUE
|
|
1621
|
+
CACHE 1;
|
|
1622
|
+
|
|
1623
|
+
|
|
1624
|
+
--
|
|
1625
|
+
-- Name: view_template_active_tabs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
1626
|
+
--
|
|
1627
|
+
|
|
1628
|
+
ALTER SEQUENCE public.view_template_active_tabs_id_seq OWNED BY public.view_template_active_tabs.id;
|
|
1629
|
+
|
|
1630
|
+
|
|
1631
|
+
--
|
|
1632
|
+
-- Name: view_template_versions; Type: TABLE; Schema: public; Owner: -
|
|
1633
|
+
--
|
|
1634
|
+
|
|
1635
|
+
CREATE TABLE public.view_template_versions (
|
|
1636
|
+
id integer NOT NULL,
|
|
1637
|
+
resource_type text NOT NULL,
|
|
1638
|
+
resource_id text NOT NULL,
|
|
1639
|
+
organization_id text NOT NULL,
|
|
1640
|
+
version integer NOT NULL,
|
|
1641
|
+
tab_name text,
|
|
1642
|
+
tab_order integer DEFAULT 0,
|
|
1643
|
+
json_template jsonb NOT NULL,
|
|
1644
|
+
change_notes text,
|
|
1645
|
+
created_by text NOT NULL,
|
|
1646
|
+
created_at timestamp with time zone DEFAULT now(),
|
|
1647
|
+
CONSTRAINT view_template_versions_resource_type_check CHECK ((resource_type = ANY (ARRAY['entity_type'::text, 'entity'::text])))
|
|
1648
|
+
);
|
|
1649
|
+
|
|
1650
|
+
|
|
1651
|
+
--
|
|
1652
|
+
-- Name: view_template_versions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
1653
|
+
--
|
|
1654
|
+
|
|
1655
|
+
CREATE SEQUENCE public.view_template_versions_id_seq
|
|
1656
|
+
AS integer
|
|
1657
|
+
START WITH 1
|
|
1658
|
+
INCREMENT BY 1
|
|
1659
|
+
NO MINVALUE
|
|
1660
|
+
NO MAXVALUE
|
|
1661
|
+
CACHE 1;
|
|
1662
|
+
|
|
1663
|
+
|
|
1664
|
+
--
|
|
1665
|
+
-- Name: view_template_versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
1666
|
+
--
|
|
1667
|
+
|
|
1668
|
+
ALTER SEQUENCE public.view_template_versions_id_seq OWNED BY public.view_template_versions.id;
|
|
1669
|
+
|
|
1670
|
+
|
|
1671
|
+
--
|
|
1672
|
+
-- Name: watcher_reactions; Type: TABLE; Schema: public; Owner: -
|
|
1673
|
+
--
|
|
1674
|
+
|
|
1675
|
+
CREATE TABLE public.watcher_reactions (
|
|
1676
|
+
id bigint NOT NULL,
|
|
1677
|
+
organization_id text NOT NULL,
|
|
1678
|
+
watcher_id integer NOT NULL,
|
|
1679
|
+
window_id bigint NOT NULL,
|
|
1680
|
+
reaction_type text NOT NULL,
|
|
1681
|
+
tool_name text NOT NULL,
|
|
1682
|
+
tool_args jsonb,
|
|
1683
|
+
tool_result jsonb,
|
|
1684
|
+
run_id bigint,
|
|
1685
|
+
entity_id bigint,
|
|
1686
|
+
created_at timestamp with time zone DEFAULT now()
|
|
1687
|
+
);
|
|
1688
|
+
|
|
1689
|
+
|
|
1690
|
+
--
|
|
1691
|
+
-- Name: watcher_reactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
1692
|
+
--
|
|
1693
|
+
|
|
1694
|
+
CREATE SEQUENCE public.watcher_reactions_id_seq
|
|
1695
|
+
START WITH 1
|
|
1696
|
+
INCREMENT BY 1
|
|
1697
|
+
NO MINVALUE
|
|
1698
|
+
NO MAXVALUE
|
|
1699
|
+
CACHE 1;
|
|
1700
|
+
|
|
1701
|
+
|
|
1702
|
+
--
|
|
1703
|
+
-- Name: watcher_reactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
1704
|
+
--
|
|
1705
|
+
|
|
1706
|
+
ALTER SEQUENCE public.watcher_reactions_id_seq OWNED BY public.watcher_reactions.id;
|
|
1707
|
+
|
|
1708
|
+
|
|
1709
|
+
--
|
|
1710
|
+
-- Name: watcher_versions; Type: TABLE; Schema: public; Owner: -
|
|
1711
|
+
--
|
|
1712
|
+
|
|
1713
|
+
CREATE TABLE public.watcher_versions (
|
|
1714
|
+
id integer CONSTRAINT insight_template_versions_id_not_null NOT NULL,
|
|
1715
|
+
version integer CONSTRAINT insight_template_versions_version_not_null NOT NULL,
|
|
1716
|
+
name text CONSTRAINT insight_template_versions_name_not_null NOT NULL,
|
|
1717
|
+
description text,
|
|
1718
|
+
change_notes text,
|
|
1719
|
+
created_by text CONSTRAINT insight_template_versions_created_by_not_null NOT NULL,
|
|
1720
|
+
created_at timestamp with time zone DEFAULT now(),
|
|
1721
|
+
sources_schema jsonb,
|
|
1722
|
+
keying_config jsonb,
|
|
1723
|
+
json_template jsonb,
|
|
1724
|
+
prompt text CONSTRAINT insight_template_versions_prompt_not_null NOT NULL,
|
|
1725
|
+
extraction_schema jsonb CONSTRAINT insight_template_versions_extraction_schema_not_null NOT NULL,
|
|
1726
|
+
classifiers jsonb,
|
|
1727
|
+
required_source_types text[] DEFAULT '{}'::text[] CONSTRAINT insight_template_versions_required_source_types_not_null NOT NULL,
|
|
1728
|
+
recommended_source_types text[] DEFAULT '{}'::text[] CONSTRAINT insight_template_versions_recommended_source_types_not_null NOT NULL,
|
|
1729
|
+
source_repository text,
|
|
1730
|
+
source_ref text,
|
|
1731
|
+
source_commit_sha text,
|
|
1732
|
+
source_path text,
|
|
1733
|
+
reactions_guidance text,
|
|
1734
|
+
condensation_prompt text,
|
|
1735
|
+
condensation_window_count integer DEFAULT 4,
|
|
1736
|
+
watcher_id integer,
|
|
1737
|
+
version_sources jsonb
|
|
1738
|
+
);
|
|
1739
|
+
|
|
1740
|
+
|
|
1741
|
+
--
|
|
1742
|
+
-- Name: COLUMN watcher_versions.sources_schema; Type: COMMENT; Schema: public; Owner: -
|
|
1743
|
+
--
|
|
1744
|
+
|
|
1745
|
+
COMMENT ON COLUMN public.watcher_versions.sources_schema IS 'JSON Schema defining expected sources. Example: {required: ["content"], properties: {content: {description: "Main content source"}}}. Validates insight sources match template expectations.';
|
|
1746
|
+
|
|
1747
|
+
|
|
1748
|
+
--
|
|
1749
|
+
-- Name: COLUMN watcher_versions.json_template; Type: COMMENT; Schema: public; Owner: -
|
|
1750
|
+
--
|
|
1751
|
+
|
|
1752
|
+
COMMENT ON COLUMN public.watcher_versions.json_template IS 'JSON-based template definition for React rendering. Replaces Svelte-based renderer_component.';
|
|
1753
|
+
|
|
1754
|
+
|
|
1755
|
+
--
|
|
1756
|
+
-- Name: COLUMN watcher_versions.prompt; Type: COMMENT; Schema: public; Owner: -
|
|
1757
|
+
--
|
|
1758
|
+
|
|
1759
|
+
COMMENT ON COLUMN public.watcher_versions.prompt IS 'Handlebars prompt template used for insight extraction.';
|
|
1760
|
+
|
|
1761
|
+
|
|
1762
|
+
--
|
|
1763
|
+
-- Name: COLUMN watcher_versions.extraction_schema; Type: COMMENT; Schema: public; Owner: -
|
|
1764
|
+
--
|
|
1765
|
+
|
|
1766
|
+
COMMENT ON COLUMN public.watcher_versions.extraction_schema IS 'JSON Schema defining LLM output structure for this template version.';
|
|
1767
|
+
|
|
1768
|
+
|
|
1769
|
+
--
|
|
1770
|
+
-- Name: COLUMN watcher_versions.classifiers; Type: COMMENT; Schema: public; Owner: -
|
|
1771
|
+
--
|
|
1772
|
+
|
|
1773
|
+
COMMENT ON COLUMN public.watcher_versions.classifiers IS 'Optional classifier definitions attached to this template version.';
|
|
1774
|
+
|
|
1775
|
+
|
|
1776
|
+
--
|
|
1777
|
+
-- Name: COLUMN watcher_versions.required_source_types; Type: COMMENT; Schema: public; Owner: -
|
|
1778
|
+
--
|
|
1779
|
+
|
|
1780
|
+
COMMENT ON COLUMN public.watcher_versions.required_source_types IS 'Source type slugs that must exist for selected source entities before insight creation.';
|
|
1781
|
+
|
|
1782
|
+
|
|
1783
|
+
--
|
|
1784
|
+
-- Name: COLUMN watcher_versions.recommended_source_types; Type: COMMENT; Schema: public; Owner: -
|
|
1785
|
+
--
|
|
1786
|
+
|
|
1787
|
+
COMMENT ON COLUMN public.watcher_versions.recommended_source_types IS 'Source type slugs recommended for better insight quality.';
|
|
1788
|
+
|
|
1789
|
+
|
|
1790
|
+
--
|
|
1791
|
+
-- Name: COLUMN watcher_versions.reactions_guidance; Type: COMMENT; Schema: public; Owner: -
|
|
1792
|
+
--
|
|
1793
|
+
|
|
1794
|
+
COMMENT ON COLUMN public.watcher_versions.reactions_guidance IS 'Optional guidance text for LLM agents on what reactions to take after analyzing a watcher window.';
|
|
1795
|
+
|
|
1796
|
+
|
|
1797
|
+
--
|
|
1798
|
+
-- Name: COLUMN watcher_versions.condensation_prompt; Type: COMMENT; Schema: public; Owner: -
|
|
1799
|
+
--
|
|
1800
|
+
|
|
1801
|
+
COMMENT ON COLUMN public.watcher_versions.condensation_prompt IS 'Handlebars prompt for condensing completed windows into a rollup. Receives {{windows}} array.';
|
|
1802
|
+
|
|
1803
|
+
|
|
1804
|
+
--
|
|
1805
|
+
-- Name: COLUMN watcher_versions.condensation_window_count; Type: COMMENT; Schema: public; Owner: -
|
|
1806
|
+
--
|
|
1807
|
+
|
|
1808
|
+
COMMENT ON COLUMN public.watcher_versions.condensation_window_count IS 'How many leaf windows to condense into one rollup. Default 4.';
|
|
1809
|
+
|
|
1810
|
+
|
|
1811
|
+
--
|
|
1812
|
+
-- Name: watcher_template_versions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
1813
|
+
--
|
|
1814
|
+
|
|
1815
|
+
CREATE SEQUENCE public.watcher_template_versions_id_seq
|
|
1816
|
+
START WITH 1
|
|
1817
|
+
INCREMENT BY 1
|
|
1818
|
+
NO MINVALUE
|
|
1819
|
+
NO MAXVALUE
|
|
1820
|
+
CACHE 1;
|
|
1821
|
+
|
|
1822
|
+
|
|
1823
|
+
--
|
|
1824
|
+
-- Name: watcher_template_versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
1825
|
+
--
|
|
1826
|
+
|
|
1827
|
+
ALTER SEQUENCE public.watcher_template_versions_id_seq OWNED BY public.watcher_versions.id;
|
|
1828
|
+
|
|
1829
|
+
|
|
1830
|
+
--
|
|
1831
|
+
-- Name: watcher_window_events; Type: TABLE; Schema: public; Owner: -
|
|
1832
|
+
--
|
|
1833
|
+
|
|
1834
|
+
CREATE TABLE public.watcher_window_events (
|
|
1835
|
+
id bigint CONSTRAINT insight_window_content_id_not_null NOT NULL,
|
|
1836
|
+
window_id bigint CONSTRAINT insight_window_content_window_id_not_null NOT NULL,
|
|
1837
|
+
event_id bigint CONSTRAINT insight_window_content_content_id_not_null NOT NULL,
|
|
1838
|
+
created_at timestamp with time zone DEFAULT now()
|
|
1839
|
+
);
|
|
1840
|
+
|
|
1841
|
+
|
|
1842
|
+
--
|
|
1843
|
+
-- Name: watcher_window_content_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
1844
|
+
--
|
|
1845
|
+
|
|
1846
|
+
CREATE SEQUENCE public.watcher_window_content_id_seq
|
|
1847
|
+
START WITH 1
|
|
1848
|
+
INCREMENT BY 1
|
|
1849
|
+
NO MINVALUE
|
|
1850
|
+
NO MAXVALUE
|
|
1851
|
+
CACHE 1;
|
|
1852
|
+
|
|
1853
|
+
|
|
1854
|
+
--
|
|
1855
|
+
-- Name: watcher_window_content_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
1856
|
+
--
|
|
1857
|
+
|
|
1858
|
+
ALTER SEQUENCE public.watcher_window_content_id_seq OWNED BY public.watcher_window_events.id;
|
|
1859
|
+
|
|
1860
|
+
|
|
1861
|
+
--
|
|
1862
|
+
-- Name: watcher_windows; Type: TABLE; Schema: public; Owner: -
|
|
1863
|
+
--
|
|
1864
|
+
|
|
1865
|
+
CREATE TABLE public.watcher_windows (
|
|
1866
|
+
id integer CONSTRAINT insight_windows_id_not_null NOT NULL,
|
|
1867
|
+
watcher_id integer CONSTRAINT insight_windows_insight_id_not_null NOT NULL,
|
|
1868
|
+
parent_window_id integer,
|
|
1869
|
+
granularity text CONSTRAINT insight_windows_granularity_not_null NOT NULL,
|
|
1870
|
+
window_start timestamp with time zone CONSTRAINT insight_windows_window_start_not_null NOT NULL,
|
|
1871
|
+
window_end timestamp with time zone CONSTRAINT insight_windows_window_end_not_null NOT NULL,
|
|
1872
|
+
content_analyzed integer CONSTRAINT insight_windows_content_analyzed_not_null NOT NULL,
|
|
1873
|
+
extracted_data jsonb CONSTRAINT insight_windows_extracted_data_not_null NOT NULL,
|
|
1874
|
+
model_used text,
|
|
1875
|
+
execution_time_ms integer,
|
|
1876
|
+
is_rollup boolean DEFAULT false,
|
|
1877
|
+
source_window_ids integer[],
|
|
1878
|
+
created_at timestamp with time zone DEFAULT now(),
|
|
1879
|
+
version_id integer,
|
|
1880
|
+
depth integer DEFAULT 0,
|
|
1881
|
+
client_id text,
|
|
1882
|
+
run_metadata jsonb DEFAULT '{}'::jsonb NOT NULL
|
|
1883
|
+
);
|
|
1884
|
+
|
|
1885
|
+
|
|
1886
|
+
--
|
|
1887
|
+
-- Name: TABLE watcher_windows; Type: COMMENT; Schema: public; Owner: -
|
|
1888
|
+
--
|
|
1889
|
+
|
|
1890
|
+
COMMENT ON TABLE public.watcher_windows IS 'Time-series watcher results with hierarchical rollups';
|
|
1891
|
+
|
|
1892
|
+
|
|
1893
|
+
--
|
|
1894
|
+
-- Name: COLUMN watcher_windows.parent_window_id; Type: COMMENT; Schema: public; Owner: -
|
|
1895
|
+
--
|
|
1896
|
+
|
|
1897
|
+
COMMENT ON COLUMN public.watcher_windows.parent_window_id IS 'Rollup hierarchy (daily->weekly->monthly->quarterly)';
|
|
1898
|
+
|
|
1899
|
+
|
|
1900
|
+
--
|
|
1901
|
+
-- Name: COLUMN watcher_windows.depth; Type: COMMENT; Schema: public; Owner: -
|
|
1902
|
+
--
|
|
1903
|
+
|
|
1904
|
+
COMMENT ON COLUMN public.watcher_windows.depth IS 'Condensation depth: 0=leaf, 1+=rollup tiers';
|
|
1905
|
+
|
|
1906
|
+
|
|
1907
|
+
--
|
|
1908
|
+
-- Name: watcher_windows_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
1909
|
+
--
|
|
1910
|
+
|
|
1911
|
+
CREATE SEQUENCE public.watcher_windows_id_seq
|
|
1912
|
+
START WITH 1
|
|
1913
|
+
INCREMENT BY 1
|
|
1914
|
+
NO MINVALUE
|
|
1915
|
+
NO MAXVALUE
|
|
1916
|
+
CACHE 1;
|
|
1917
|
+
|
|
1918
|
+
|
|
1919
|
+
--
|
|
1920
|
+
-- Name: watcher_windows_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
1921
|
+
--
|
|
1922
|
+
|
|
1923
|
+
ALTER SEQUENCE public.watcher_windows_id_seq OWNED BY public.watcher_windows.id;
|
|
1924
|
+
|
|
1925
|
+
|
|
1926
|
+
--
|
|
1927
|
+
-- Name: watchers; Type: TABLE; Schema: public; Owner: -
|
|
1928
|
+
--
|
|
1929
|
+
|
|
1930
|
+
CREATE TABLE public.watchers (
|
|
1931
|
+
id integer CONSTRAINT insights_id_not_null NOT NULL,
|
|
1932
|
+
model_config jsonb DEFAULT '{}'::jsonb,
|
|
1933
|
+
status text DEFAULT 'active'::text,
|
|
1934
|
+
created_at timestamp with time zone DEFAULT now(),
|
|
1935
|
+
updated_at timestamp with time zone DEFAULT now(),
|
|
1936
|
+
sources jsonb DEFAULT '[]'::jsonb,
|
|
1937
|
+
created_by text CONSTRAINT insights_created_by_not_null NOT NULL,
|
|
1938
|
+
entity_ids bigint[],
|
|
1939
|
+
reaction_script text,
|
|
1940
|
+
reaction_script_compiled text,
|
|
1941
|
+
organization_id text,
|
|
1942
|
+
name text,
|
|
1943
|
+
slug text,
|
|
1944
|
+
description text,
|
|
1945
|
+
version integer DEFAULT 1,
|
|
1946
|
+
tags text[] DEFAULT '{}'::text[],
|
|
1947
|
+
registry_type text,
|
|
1948
|
+
registry_repo text,
|
|
1949
|
+
registry_ref text,
|
|
1950
|
+
current_version_id integer,
|
|
1951
|
+
schedule text,
|
|
1952
|
+
next_run_at timestamp with time zone,
|
|
1953
|
+
agent_id text,
|
|
1954
|
+
connection_id text,
|
|
1955
|
+
scheduler_client_id text,
|
|
1956
|
+
CONSTRAINT insights_status_check CHECK ((status = ANY (ARRAY['active'::text, 'archived'::text])))
|
|
1957
|
+
);
|
|
1958
|
+
|
|
1959
|
+
|
|
1960
|
+
--
|
|
1961
|
+
-- Name: COLUMN watchers.status; Type: COMMENT; Schema: public; Owner: -
|
|
1962
|
+
--
|
|
1963
|
+
|
|
1964
|
+
COMMENT ON COLUMN public.watchers.status IS 'Status of insight: active (recurring), paused (recurring), failed (recurring), completed (one-off)';
|
|
1965
|
+
|
|
1966
|
+
|
|
1967
|
+
--
|
|
1968
|
+
-- Name: COLUMN watchers.sources; Type: COMMENT; Schema: public; Owner: -
|
|
1969
|
+
--
|
|
1970
|
+
|
|
1971
|
+
COMMENT ON COLUMN public.watchers.sources IS 'Array of data sources: [{name: string, entity_id: number, filters: {min_score?, platforms?, search_query?}}]. Each source defines an entity and its filters for content fetching.';
|
|
1972
|
+
|
|
1973
|
+
|
|
1974
|
+
--
|
|
1975
|
+
-- Name: COLUMN watchers.reaction_script; Type: COMMENT; Schema: public; Owner: -
|
|
1976
|
+
--
|
|
1977
|
+
|
|
1978
|
+
COMMENT ON COLUMN public.watchers.reaction_script IS 'TypeScript source for automated reaction script.';
|
|
1979
|
+
|
|
1980
|
+
|
|
1981
|
+
--
|
|
1982
|
+
-- Name: COLUMN watchers.reaction_script_compiled; Type: COMMENT; Schema: public; Owner: -
|
|
1983
|
+
--
|
|
1984
|
+
|
|
1985
|
+
COMMENT ON COLUMN public.watchers.reaction_script_compiled IS 'Compiled JavaScript from reaction_script.';
|
|
1986
|
+
|
|
1987
|
+
|
|
1988
|
+
--
|
|
1989
|
+
-- Name: watchers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
1990
|
+
--
|
|
1991
|
+
|
|
1992
|
+
CREATE SEQUENCE public.watchers_id_seq
|
|
1993
|
+
START WITH 1
|
|
1994
|
+
INCREMENT BY 1
|
|
1995
|
+
NO MINVALUE
|
|
1996
|
+
NO MAXVALUE
|
|
1997
|
+
CACHE 1;
|
|
1998
|
+
|
|
1999
|
+
|
|
2000
|
+
--
|
|
2001
|
+
-- Name: watchers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
2002
|
+
--
|
|
2003
|
+
|
|
2004
|
+
ALTER SEQUENCE public.watchers_id_seq OWNED BY public.watchers.id;
|
|
2005
|
+
|
|
2006
|
+
|
|
2007
|
+
--
|
|
2008
|
+
-- Name: workers; Type: TABLE; Schema: public; Owner: -
|
|
2009
|
+
--
|
|
2010
|
+
|
|
2011
|
+
CREATE TABLE public.workers (
|
|
2012
|
+
worker_id text NOT NULL,
|
|
2013
|
+
status text DEFAULT 'idle'::text NOT NULL,
|
|
2014
|
+
last_heartbeat_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
2015
|
+
registered_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
2016
|
+
capabilities jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
2017
|
+
region text,
|
|
2018
|
+
version text,
|
|
2019
|
+
active_jobs integer DEFAULT 0 NOT NULL,
|
|
2020
|
+
total_jobs_claimed integer DEFAULT 0 NOT NULL,
|
|
2021
|
+
total_jobs_completed integer DEFAULT 0 NOT NULL,
|
|
2022
|
+
total_jobs_failed integer DEFAULT 0 NOT NULL,
|
|
2023
|
+
created_at timestamp with time zone DEFAULT now(),
|
|
2024
|
+
updated_at timestamp with time zone DEFAULT now(),
|
|
2025
|
+
user_id text,
|
|
2026
|
+
browser_type text DEFAULT 'playwright'::text,
|
|
2027
|
+
device_name text,
|
|
2028
|
+
CONSTRAINT workers_browser_type_check CHECK ((browser_type = ANY (ARRAY['playwright'::text, 'extension'::text]))),
|
|
2029
|
+
CONSTRAINT workers_status_check CHECK ((status = ANY (ARRAY['active'::text, 'idle'::text, 'offline'::text])))
|
|
2030
|
+
);
|
|
2031
|
+
|
|
2032
|
+
|
|
2033
|
+
--
|
|
2034
|
+
-- Name: TABLE workers; Type: COMMENT; Schema: public; Owner: -
|
|
2035
|
+
--
|
|
2036
|
+
|
|
2037
|
+
COMMENT ON TABLE public.workers IS 'Real-time registry of all workers (local, Lambda, external) with heartbeat tracking';
|
|
2038
|
+
|
|
2039
|
+
|
|
2040
|
+
--
|
|
2041
|
+
-- Name: COLUMN workers.worker_id; Type: COMMENT; Schema: public; Owner: -
|
|
2042
|
+
--
|
|
2043
|
+
|
|
2044
|
+
COMMENT ON COLUMN public.workers.worker_id IS 'Unique worker identifier (e.g., "local-worker-1", "lambda-us-east-1-abc")';
|
|
2045
|
+
|
|
2046
|
+
|
|
2047
|
+
--
|
|
2048
|
+
-- Name: COLUMN workers.status; Type: COMMENT; Schema: public; Owner: -
|
|
2049
|
+
--
|
|
2050
|
+
|
|
2051
|
+
COMMENT ON COLUMN public.workers.status IS 'Current status: active (has jobs), idle (online but no jobs), offline (stale heartbeat)';
|
|
2052
|
+
|
|
2053
|
+
|
|
2054
|
+
--
|
|
2055
|
+
-- Name: COLUMN workers.capabilities; Type: COMMENT; Schema: public; Owner: -
|
|
2056
|
+
--
|
|
2057
|
+
|
|
2058
|
+
COMMENT ON COLUMN public.workers.capabilities IS 'Worker capabilities: {"browser": true, "browser_type": "playwright", "max_execution_time_ms": 600000}';
|
|
2059
|
+
|
|
2060
|
+
|
|
2061
|
+
--
|
|
2062
|
+
-- Name: COLUMN workers.active_jobs; Type: COMMENT; Schema: public; Owner: -
|
|
2063
|
+
--
|
|
2064
|
+
|
|
2065
|
+
COMMENT ON COLUMN public.workers.active_jobs IS 'Current number of jobs being processed by this worker';
|
|
2066
|
+
|
|
2067
|
+
|
|
2068
|
+
--
|
|
2069
|
+
-- Name: COLUMN workers.user_id; Type: COMMENT; Schema: public; Owner: -
|
|
2070
|
+
--
|
|
2071
|
+
|
|
2072
|
+
COMMENT ON COLUMN public.workers.user_id IS 'User ID for extension workers (NULL for server workers)';
|
|
2073
|
+
|
|
2074
|
+
|
|
2075
|
+
--
|
|
2076
|
+
-- Name: COLUMN workers.browser_type; Type: COMMENT; Schema: public; Owner: -
|
|
2077
|
+
--
|
|
2078
|
+
|
|
2079
|
+
COMMENT ON COLUMN public.workers.browser_type IS 'Browser type: playwright (server) or extension (user browser)';
|
|
2080
|
+
|
|
2081
|
+
|
|
2082
|
+
--
|
|
2083
|
+
-- Name: COLUMN workers.device_name; Type: COMMENT; Schema: public; Owner: -
|
|
2084
|
+
--
|
|
2085
|
+
|
|
2086
|
+
COMMENT ON COLUMN public.workers.device_name IS 'User-friendly device name for extension workers';
|
|
2087
|
+
|
|
2088
|
+
|
|
2089
|
+
--
|
|
2090
|
+
-- Name: workspace_settings; Type: TABLE; Schema: public; Owner: -
|
|
2091
|
+
--
|
|
2092
|
+
|
|
2093
|
+
CREATE TABLE public.workspace_settings (
|
|
2094
|
+
organization_id text NOT NULL,
|
|
2095
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
|
2096
|
+
updated_at timestamp with time zone DEFAULT now() NOT NULL
|
|
2097
|
+
);
|
|
2098
|
+
|
|
2099
|
+
|
|
2100
|
+
--
|
|
2101
|
+
-- Name: connect_tokens id; Type: DEFAULT; Schema: public; Owner: -
|
|
2102
|
+
--
|
|
2103
|
+
|
|
2104
|
+
ALTER TABLE ONLY public.connect_tokens ALTER COLUMN id SET DEFAULT nextval('public.connect_tokens_id_seq'::regclass);
|
|
2105
|
+
|
|
2106
|
+
|
|
2107
|
+
--
|
|
2108
|
+
-- Name: connections id; Type: DEFAULT; Schema: public; Owner: -
|
|
2109
|
+
--
|
|
2110
|
+
|
|
2111
|
+
ALTER TABLE ONLY public.connections ALTER COLUMN id SET DEFAULT nextval('public.connections_id_seq'::regclass);
|
|
2112
|
+
|
|
2113
|
+
|
|
2114
|
+
--
|
|
2115
|
+
-- Name: connector_definitions id; Type: DEFAULT; Schema: public; Owner: -
|
|
2116
|
+
--
|
|
2117
|
+
|
|
2118
|
+
ALTER TABLE ONLY public.connector_definitions ALTER COLUMN id SET DEFAULT nextval('public.connector_definitions_id_seq'::regclass);
|
|
2119
|
+
|
|
2120
|
+
|
|
2121
|
+
--
|
|
2122
|
+
-- Name: connector_versions id; Type: DEFAULT; Schema: public; Owner: -
|
|
2123
|
+
--
|
|
2124
|
+
|
|
2125
|
+
ALTER TABLE ONLY public.connector_versions ALTER COLUMN id SET DEFAULT nextval('public.connector_versions_id_seq'::regclass);
|
|
2126
|
+
|
|
2127
|
+
|
|
2128
|
+
--
|
|
2129
|
+
-- Name: entities id; Type: DEFAULT; Schema: public; Owner: -
|
|
2130
|
+
--
|
|
2131
|
+
|
|
2132
|
+
ALTER TABLE ONLY public.entities ALTER COLUMN id SET DEFAULT nextval('public.entities_id_seq'::regclass);
|
|
2133
|
+
|
|
2134
|
+
|
|
2135
|
+
--
|
|
2136
|
+
-- Name: entity_relationship_type_rules id; Type: DEFAULT; Schema: public; Owner: -
|
|
2137
|
+
--
|
|
2138
|
+
|
|
2139
|
+
ALTER TABLE ONLY public.entity_relationship_type_rules ALTER COLUMN id SET DEFAULT nextval('public.entity_relationship_type_rules_id_seq'::regclass);
|
|
2140
|
+
|
|
2141
|
+
|
|
2142
|
+
--
|
|
2143
|
+
-- Name: entity_relationship_types id; Type: DEFAULT; Schema: public; Owner: -
|
|
2144
|
+
--
|
|
2145
|
+
|
|
2146
|
+
ALTER TABLE ONLY public.entity_relationship_types ALTER COLUMN id SET DEFAULT nextval('public.entity_relationship_types_id_seq'::regclass);
|
|
2147
|
+
|
|
2148
|
+
|
|
2149
|
+
--
|
|
2150
|
+
-- Name: entity_relationships id; Type: DEFAULT; Schema: public; Owner: -
|
|
2151
|
+
--
|
|
2152
|
+
|
|
2153
|
+
ALTER TABLE ONLY public.entity_relationships ALTER COLUMN id SET DEFAULT nextval('public.entity_relationships_id_seq'::regclass);
|
|
2154
|
+
|
|
2155
|
+
|
|
2156
|
+
--
|
|
2157
|
+
-- Name: entity_type_audit id; Type: DEFAULT; Schema: public; Owner: -
|
|
2158
|
+
--
|
|
2159
|
+
|
|
2160
|
+
ALTER TABLE ONLY public.entity_type_audit ALTER COLUMN id SET DEFAULT nextval('public.entity_type_audit_id_seq'::regclass);
|
|
2161
|
+
|
|
2162
|
+
|
|
2163
|
+
--
|
|
2164
|
+
-- Name: entity_types id; Type: DEFAULT; Schema: public; Owner: -
|
|
2165
|
+
--
|
|
2166
|
+
|
|
2167
|
+
ALTER TABLE ONLY public.entity_types ALTER COLUMN id SET DEFAULT nextval('public.entity_types_id_seq'::regclass);
|
|
2168
|
+
|
|
2169
|
+
|
|
2170
|
+
--
|
|
2171
|
+
-- Name: event_classifications id; Type: DEFAULT; Schema: public; Owner: -
|
|
2172
|
+
--
|
|
2173
|
+
|
|
2174
|
+
ALTER TABLE ONLY public.event_classifications ALTER COLUMN id SET DEFAULT nextval('public.event_classifications_id_seq'::regclass);
|
|
2175
|
+
|
|
2176
|
+
|
|
2177
|
+
--
|
|
2178
|
+
-- Name: event_classifier_versions id; Type: DEFAULT; Schema: public; Owner: -
|
|
2179
|
+
--
|
|
2180
|
+
|
|
2181
|
+
ALTER TABLE ONLY public.event_classifier_versions ALTER COLUMN id SET DEFAULT nextval('public.event_classifier_versions_id_seq'::regclass);
|
|
2182
|
+
|
|
2183
|
+
|
|
2184
|
+
--
|
|
2185
|
+
-- Name: event_classifiers id; Type: DEFAULT; Schema: public; Owner: -
|
|
2186
|
+
--
|
|
2187
|
+
|
|
2188
|
+
ALTER TABLE ONLY public.event_classifiers ALTER COLUMN id SET DEFAULT nextval('public.event_classifiers_id_seq'::regclass);
|
|
2189
|
+
|
|
2190
|
+
|
|
2191
|
+
--
|
|
2192
|
+
-- Name: events id; Type: DEFAULT; Schema: public; Owner: -
|
|
2193
|
+
--
|
|
2194
|
+
|
|
2195
|
+
ALTER TABLE ONLY public.events ALTER COLUMN id SET DEFAULT nextval('public.content_id_seq'::regclass);
|
|
2196
|
+
|
|
2197
|
+
|
|
2198
|
+
--
|
|
2199
|
+
-- Name: feeds id; Type: DEFAULT; Schema: public; Owner: -
|
|
2200
|
+
--
|
|
2201
|
+
|
|
2202
|
+
ALTER TABLE ONLY public.feeds ALTER COLUMN id SET DEFAULT nextval('public.feeds_id_seq'::regclass);
|
|
2203
|
+
|
|
2204
|
+
|
|
2205
|
+
--
|
|
2206
|
+
-- Name: notifications id; Type: DEFAULT; Schema: public; Owner: -
|
|
2207
|
+
--
|
|
2208
|
+
|
|
2209
|
+
ALTER TABLE ONLY public.notifications ALTER COLUMN id SET DEFAULT nextval('public.notifications_id_seq'::regclass);
|
|
2210
|
+
|
|
2211
|
+
|
|
2212
|
+
--
|
|
2213
|
+
-- Name: personal_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
|
|
2214
|
+
--
|
|
2215
|
+
|
|
2216
|
+
ALTER TABLE ONLY public.personal_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.personal_access_tokens_id_seq'::regclass);
|
|
2217
|
+
|
|
2218
|
+
|
|
2219
|
+
--
|
|
2220
|
+
-- Name: runs id; Type: DEFAULT; Schema: public; Owner: -
|
|
2221
|
+
--
|
|
2222
|
+
|
|
2223
|
+
ALTER TABLE ONLY public.runs ALTER COLUMN id SET DEFAULT nextval('public.runs_id_seq'::regclass);
|
|
2224
|
+
|
|
2225
|
+
|
|
2226
|
+
--
|
|
2227
|
+
-- Name: source_type_auth_defaults id; Type: DEFAULT; Schema: public; Owner: -
|
|
2228
|
+
--
|
|
2229
|
+
|
|
2230
|
+
ALTER TABLE ONLY public.source_type_auth_defaults ALTER COLUMN id SET DEFAULT nextval('public.source_type_auth_defaults_id_seq'::regclass);
|
|
2231
|
+
|
|
2232
|
+
|
|
2233
|
+
--
|
|
2234
|
+
-- Name: view_template_active_tabs id; Type: DEFAULT; Schema: public; Owner: -
|
|
2235
|
+
--
|
|
2236
|
+
|
|
2237
|
+
ALTER TABLE ONLY public.view_template_active_tabs ALTER COLUMN id SET DEFAULT nextval('public.view_template_active_tabs_id_seq'::regclass);
|
|
2238
|
+
|
|
2239
|
+
|
|
2240
|
+
--
|
|
2241
|
+
-- Name: view_template_versions id; Type: DEFAULT; Schema: public; Owner: -
|
|
2242
|
+
--
|
|
2243
|
+
|
|
2244
|
+
ALTER TABLE ONLY public.view_template_versions ALTER COLUMN id SET DEFAULT nextval('public.view_template_versions_id_seq'::regclass);
|
|
2245
|
+
|
|
2246
|
+
|
|
2247
|
+
--
|
|
2248
|
+
-- Name: watcher_reactions id; Type: DEFAULT; Schema: public; Owner: -
|
|
2249
|
+
--
|
|
2250
|
+
|
|
2251
|
+
ALTER TABLE ONLY public.watcher_reactions ALTER COLUMN id SET DEFAULT nextval('public.watcher_reactions_id_seq'::regclass);
|
|
2252
|
+
|
|
2253
|
+
|
|
2254
|
+
--
|
|
2255
|
+
-- Name: watcher_versions id; Type: DEFAULT; Schema: public; Owner: -
|
|
2256
|
+
--
|
|
2257
|
+
|
|
2258
|
+
ALTER TABLE ONLY public.watcher_versions ALTER COLUMN id SET DEFAULT nextval('public.watcher_template_versions_id_seq'::regclass);
|
|
2259
|
+
|
|
2260
|
+
|
|
2261
|
+
--
|
|
2262
|
+
-- Name: watcher_window_events id; Type: DEFAULT; Schema: public; Owner: -
|
|
2263
|
+
--
|
|
2264
|
+
|
|
2265
|
+
ALTER TABLE ONLY public.watcher_window_events ALTER COLUMN id SET DEFAULT nextval('public.watcher_window_content_id_seq'::regclass);
|
|
2266
|
+
|
|
2267
|
+
|
|
2268
|
+
--
|
|
2269
|
+
-- Name: watcher_windows id; Type: DEFAULT; Schema: public; Owner: -
|
|
2270
|
+
--
|
|
2271
|
+
|
|
2272
|
+
ALTER TABLE ONLY public.watcher_windows ALTER COLUMN id SET DEFAULT nextval('public.watcher_windows_id_seq'::regclass);
|
|
2273
|
+
|
|
2274
|
+
|
|
2275
|
+
--
|
|
2276
|
+
-- Name: watchers id; Type: DEFAULT; Schema: public; Owner: -
|
|
2277
|
+
--
|
|
2278
|
+
|
|
2279
|
+
ALTER TABLE ONLY public.watchers ALTER COLUMN id SET DEFAULT nextval('public.watchers_id_seq'::regclass);
|
|
2280
|
+
|
|
2281
|
+
|
|
2282
|
+
--
|
|
2283
|
+
-- Name: account account_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2284
|
+
--
|
|
2285
|
+
|
|
2286
|
+
ALTER TABLE ONLY public.account
|
|
2287
|
+
ADD CONSTRAINT account_pkey PRIMARY KEY (id);
|
|
2288
|
+
|
|
2289
|
+
|
|
2290
|
+
--
|
|
2291
|
+
-- Name: agent_channel_bindings agent_channel_bindings_platform_channel_id_team_id_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2292
|
+
--
|
|
2293
|
+
|
|
2294
|
+
ALTER TABLE ONLY public.agent_channel_bindings
|
|
2295
|
+
ADD CONSTRAINT agent_channel_bindings_platform_channel_id_team_id_key UNIQUE (platform, channel_id, team_id);
|
|
2296
|
+
|
|
2297
|
+
|
|
2298
|
+
--
|
|
2299
|
+
-- Name: agent_connections agent_connections_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2300
|
+
--
|
|
2301
|
+
|
|
2302
|
+
ALTER TABLE ONLY public.agent_connections
|
|
2303
|
+
ADD CONSTRAINT agent_connections_pkey PRIMARY KEY (id);
|
|
2304
|
+
|
|
2305
|
+
|
|
2306
|
+
--
|
|
2307
|
+
-- Name: agent_grants agent_grants_agent_id_pattern_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2308
|
+
--
|
|
2309
|
+
|
|
2310
|
+
ALTER TABLE ONLY public.agent_grants
|
|
2311
|
+
ADD CONSTRAINT agent_grants_agent_id_pattern_key UNIQUE (agent_id, pattern);
|
|
2312
|
+
|
|
2313
|
+
|
|
2314
|
+
--
|
|
2315
|
+
-- Name: agent_grants agent_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2316
|
+
--
|
|
2317
|
+
|
|
2318
|
+
ALTER TABLE ONLY public.agent_grants
|
|
2319
|
+
ADD CONSTRAINT agent_grants_pkey PRIMARY KEY (id);
|
|
2320
|
+
|
|
2321
|
+
|
|
2322
|
+
--
|
|
2323
|
+
-- Name: agent_users agent_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2324
|
+
--
|
|
2325
|
+
|
|
2326
|
+
ALTER TABLE ONLY public.agent_users
|
|
2327
|
+
ADD CONSTRAINT agent_users_pkey PRIMARY KEY (agent_id, platform, user_id);
|
|
2328
|
+
|
|
2329
|
+
|
|
2330
|
+
--
|
|
2331
|
+
-- Name: agents agents_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2332
|
+
--
|
|
2333
|
+
|
|
2334
|
+
ALTER TABLE ONLY public.agents
|
|
2335
|
+
ADD CONSTRAINT agents_pkey PRIMARY KEY (id);
|
|
2336
|
+
|
|
2337
|
+
|
|
2338
|
+
--
|
|
2339
|
+
-- Name: auth_profiles auth_profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2340
|
+
--
|
|
2341
|
+
|
|
2342
|
+
ALTER TABLE ONLY public.auth_profiles
|
|
2343
|
+
ADD CONSTRAINT auth_profiles_pkey PRIMARY KEY (id);
|
|
2344
|
+
|
|
2345
|
+
|
|
2346
|
+
--
|
|
2347
|
+
-- Name: connect_tokens connect_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2348
|
+
--
|
|
2349
|
+
|
|
2350
|
+
ALTER TABLE ONLY public.connect_tokens
|
|
2351
|
+
ADD CONSTRAINT connect_tokens_pkey PRIMARY KEY (id);
|
|
2352
|
+
|
|
2353
|
+
|
|
2354
|
+
--
|
|
2355
|
+
-- Name: connect_tokens connect_tokens_token_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2356
|
+
--
|
|
2357
|
+
|
|
2358
|
+
ALTER TABLE ONLY public.connect_tokens
|
|
2359
|
+
ADD CONSTRAINT connect_tokens_token_key UNIQUE (token);
|
|
2360
|
+
|
|
2361
|
+
|
|
2362
|
+
--
|
|
2363
|
+
-- Name: connections connections_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2364
|
+
--
|
|
2365
|
+
|
|
2366
|
+
ALTER TABLE ONLY public.connections
|
|
2367
|
+
ADD CONSTRAINT connections_pkey PRIMARY KEY (id);
|
|
2368
|
+
|
|
2369
|
+
|
|
2370
|
+
--
|
|
2371
|
+
-- Name: connector_definitions connector_definitions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2372
|
+
--
|
|
2373
|
+
|
|
2374
|
+
ALTER TABLE ONLY public.connector_definitions
|
|
2375
|
+
ADD CONSTRAINT connector_definitions_pkey PRIMARY KEY (id);
|
|
2376
|
+
|
|
2377
|
+
|
|
2378
|
+
--
|
|
2379
|
+
-- Name: connector_versions connector_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2380
|
+
--
|
|
2381
|
+
|
|
2382
|
+
ALTER TABLE ONLY public.connector_versions
|
|
2383
|
+
ADD CONSTRAINT connector_versions_pkey PRIMARY KEY (id);
|
|
2384
|
+
|
|
2385
|
+
|
|
2386
|
+
--
|
|
2387
|
+
-- Name: entities entities_organization_id_entity_type_slug_parent_id_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2388
|
+
--
|
|
2389
|
+
|
|
2390
|
+
ALTER TABLE ONLY public.entities
|
|
2391
|
+
ADD CONSTRAINT entities_organization_id_entity_type_slug_parent_id_key UNIQUE (organization_id, entity_type, slug, parent_id);
|
|
2392
|
+
|
|
2393
|
+
|
|
2394
|
+
--
|
|
2395
|
+
-- Name: entities entities_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2396
|
+
--
|
|
2397
|
+
|
|
2398
|
+
ALTER TABLE ONLY public.entities
|
|
2399
|
+
ADD CONSTRAINT entities_pkey PRIMARY KEY (id);
|
|
2400
|
+
|
|
2401
|
+
|
|
2402
|
+
--
|
|
2403
|
+
-- Name: entity_relationship_type_rules entity_relationship_type_rules_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2404
|
+
--
|
|
2405
|
+
|
|
2406
|
+
ALTER TABLE ONLY public.entity_relationship_type_rules
|
|
2407
|
+
ADD CONSTRAINT entity_relationship_type_rules_pkey PRIMARY KEY (id);
|
|
2408
|
+
|
|
2409
|
+
|
|
2410
|
+
--
|
|
2411
|
+
-- Name: entity_relationship_types entity_relationship_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2412
|
+
--
|
|
2413
|
+
|
|
2414
|
+
ALTER TABLE ONLY public.entity_relationship_types
|
|
2415
|
+
ADD CONSTRAINT entity_relationship_types_pkey PRIMARY KEY (id);
|
|
2416
|
+
|
|
2417
|
+
|
|
2418
|
+
--
|
|
2419
|
+
-- Name: entity_relationships entity_relationships_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2420
|
+
--
|
|
2421
|
+
|
|
2422
|
+
ALTER TABLE ONLY public.entity_relationships
|
|
2423
|
+
ADD CONSTRAINT entity_relationships_pkey PRIMARY KEY (id);
|
|
2424
|
+
|
|
2425
|
+
|
|
2426
|
+
--
|
|
2427
|
+
-- Name: entity_type_audit entity_type_audit_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2428
|
+
--
|
|
2429
|
+
|
|
2430
|
+
ALTER TABLE ONLY public.entity_type_audit
|
|
2431
|
+
ADD CONSTRAINT entity_type_audit_pkey PRIMARY KEY (id);
|
|
2432
|
+
|
|
2433
|
+
|
|
2434
|
+
--
|
|
2435
|
+
-- Name: entity_types entity_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2436
|
+
--
|
|
2437
|
+
|
|
2438
|
+
ALTER TABLE ONLY public.entity_types
|
|
2439
|
+
ADD CONSTRAINT entity_types_pkey PRIMARY KEY (id);
|
|
2440
|
+
|
|
2441
|
+
|
|
2442
|
+
--
|
|
2443
|
+
-- Name: event_classifications event_classifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2444
|
+
--
|
|
2445
|
+
|
|
2446
|
+
ALTER TABLE ONLY public.event_classifications
|
|
2447
|
+
ADD CONSTRAINT event_classifications_pkey PRIMARY KEY (id);
|
|
2448
|
+
|
|
2449
|
+
|
|
2450
|
+
--
|
|
2451
|
+
-- Name: event_classifier_versions event_classifier_versions_classifier_id_version_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2452
|
+
--
|
|
2453
|
+
|
|
2454
|
+
ALTER TABLE ONLY public.event_classifier_versions
|
|
2455
|
+
ADD CONSTRAINT event_classifier_versions_classifier_id_version_key UNIQUE (classifier_id, version);
|
|
2456
|
+
|
|
2457
|
+
|
|
2458
|
+
--
|
|
2459
|
+
-- Name: event_classifier_versions event_classifier_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2460
|
+
--
|
|
2461
|
+
|
|
2462
|
+
ALTER TABLE ONLY public.event_classifier_versions
|
|
2463
|
+
ADD CONSTRAINT event_classifier_versions_pkey PRIMARY KEY (id);
|
|
2464
|
+
|
|
2465
|
+
|
|
2466
|
+
--
|
|
2467
|
+
-- Name: event_classifiers event_classifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2468
|
+
--
|
|
2469
|
+
|
|
2470
|
+
ALTER TABLE ONLY public.event_classifiers
|
|
2471
|
+
ADD CONSTRAINT event_classifiers_pkey PRIMARY KEY (id);
|
|
2472
|
+
|
|
2473
|
+
|
|
2474
|
+
--
|
|
2475
|
+
-- Name: event_classifiers event_classifiers_unique_per_insight; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2476
|
+
--
|
|
2477
|
+
|
|
2478
|
+
ALTER TABLE ONLY public.event_classifiers
|
|
2479
|
+
ADD CONSTRAINT event_classifiers_unique_per_insight UNIQUE (entity_id, watcher_id, slug);
|
|
2480
|
+
|
|
2481
|
+
|
|
2482
|
+
--
|
|
2483
|
+
-- Name: events event_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2484
|
+
--
|
|
2485
|
+
|
|
2486
|
+
ALTER TABLE ONLY public.events
|
|
2487
|
+
ADD CONSTRAINT event_pkey PRIMARY KEY (id);
|
|
2488
|
+
|
|
2489
|
+
|
|
2490
|
+
--
|
|
2491
|
+
-- Name: event_embeddings event_embeddings_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2492
|
+
--
|
|
2493
|
+
|
|
2494
|
+
ALTER TABLE ONLY public.event_embeddings
|
|
2495
|
+
ADD CONSTRAINT event_embeddings_pkey PRIMARY KEY (event_id);
|
|
2496
|
+
|
|
2497
|
+
|
|
2498
|
+
--
|
|
2499
|
+
-- Name: feeds feeds_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2500
|
+
--
|
|
2501
|
+
|
|
2502
|
+
ALTER TABLE ONLY public.feeds
|
|
2503
|
+
ADD CONSTRAINT feeds_pkey PRIMARY KEY (id);
|
|
2504
|
+
|
|
2505
|
+
|
|
2506
|
+
--
|
|
2507
|
+
-- Name: watcher_versions insight_template_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2508
|
+
--
|
|
2509
|
+
|
|
2510
|
+
ALTER TABLE ONLY public.watcher_versions
|
|
2511
|
+
ADD CONSTRAINT insight_template_versions_pkey PRIMARY KEY (id);
|
|
2512
|
+
|
|
2513
|
+
|
|
2514
|
+
--
|
|
2515
|
+
-- Name: watcher_window_events insight_window_content_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2516
|
+
--
|
|
2517
|
+
|
|
2518
|
+
ALTER TABLE ONLY public.watcher_window_events
|
|
2519
|
+
ADD CONSTRAINT insight_window_content_pkey PRIMARY KEY (id);
|
|
2520
|
+
|
|
2521
|
+
|
|
2522
|
+
--
|
|
2523
|
+
-- Name: watcher_window_events insight_window_content_window_id_content_id_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2524
|
+
--
|
|
2525
|
+
|
|
2526
|
+
ALTER TABLE ONLY public.watcher_window_events
|
|
2527
|
+
ADD CONSTRAINT insight_window_content_window_id_content_id_key UNIQUE (window_id, event_id);
|
|
2528
|
+
|
|
2529
|
+
|
|
2530
|
+
--
|
|
2531
|
+
-- Name: watcher_windows insight_windows_insight_id_granularity_window_start_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2532
|
+
--
|
|
2533
|
+
|
|
2534
|
+
ALTER TABLE ONLY public.watcher_windows
|
|
2535
|
+
ADD CONSTRAINT insight_windows_insight_id_granularity_window_start_key UNIQUE (watcher_id, granularity, window_start);
|
|
2536
|
+
|
|
2537
|
+
|
|
2538
|
+
--
|
|
2539
|
+
-- Name: watcher_windows insight_windows_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2540
|
+
--
|
|
2541
|
+
|
|
2542
|
+
ALTER TABLE ONLY public.watcher_windows
|
|
2543
|
+
ADD CONSTRAINT insight_windows_pkey PRIMARY KEY (id);
|
|
2544
|
+
|
|
2545
|
+
|
|
2546
|
+
--
|
|
2547
|
+
-- Name: watchers insights_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2548
|
+
--
|
|
2549
|
+
|
|
2550
|
+
ALTER TABLE ONLY public.watchers
|
|
2551
|
+
ADD CONSTRAINT insights_pkey PRIMARY KEY (id);
|
|
2552
|
+
|
|
2553
|
+
|
|
2554
|
+
--
|
|
2555
|
+
-- Name: invitation invitation_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2556
|
+
--
|
|
2557
|
+
|
|
2558
|
+
ALTER TABLE ONLY public.invitation
|
|
2559
|
+
ADD CONSTRAINT invitation_pkey PRIMARY KEY (id);
|
|
2560
|
+
|
|
2561
|
+
|
|
2562
|
+
--
|
|
2563
|
+
-- Name: latest_event_classifications latest_event_classifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2564
|
+
--
|
|
2565
|
+
|
|
2566
|
+
ALTER TABLE ONLY public.latest_event_classifications
|
|
2567
|
+
ADD CONSTRAINT latest_event_classifications_pkey PRIMARY KEY (event_id, classifier_id);
|
|
2568
|
+
|
|
2569
|
+
|
|
2570
|
+
--
|
|
2571
|
+
-- Name: member member_organizationId_userId_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2572
|
+
--
|
|
2573
|
+
|
|
2574
|
+
ALTER TABLE ONLY public.member
|
|
2575
|
+
ADD CONSTRAINT "member_organizationId_userId_key" UNIQUE ("organizationId", "userId");
|
|
2576
|
+
|
|
2577
|
+
|
|
2578
|
+
--
|
|
2579
|
+
-- Name: member member_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2580
|
+
--
|
|
2581
|
+
|
|
2582
|
+
ALTER TABLE ONLY public.member
|
|
2583
|
+
ADD CONSTRAINT member_pkey PRIMARY KEY (id);
|
|
2584
|
+
|
|
2585
|
+
|
|
2586
|
+
--
|
|
2587
|
+
-- Name: migration_20260315300000_entity_type_org_backfill migration_20260315300000_entity_type_org_backfill_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2588
|
+
--
|
|
2589
|
+
|
|
2590
|
+
ALTER TABLE ONLY public.migration_20260315300000_entity_type_org_backfill
|
|
2591
|
+
ADD CONSTRAINT migration_20260315300000_entity_type_org_backfill_pkey PRIMARY KEY (entity_type_id);
|
|
2592
|
+
|
|
2593
|
+
|
|
2594
|
+
--
|
|
2595
|
+
-- Name: migration_20260316100000_created_entity_types migration_20260316100000_created_entity_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2596
|
+
--
|
|
2597
|
+
|
|
2598
|
+
ALTER TABLE ONLY public.migration_20260316100000_created_entity_types
|
|
2599
|
+
ADD CONSTRAINT migration_20260316100000_created_entity_types_pkey PRIMARY KEY (entity_type_id);
|
|
2600
|
+
|
|
2601
|
+
|
|
2602
|
+
--
|
|
2603
|
+
-- Name: migration_20260316100000_deleted_default_entity_types migration_20260316100000_deleted_default_entity_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2604
|
+
--
|
|
2605
|
+
|
|
2606
|
+
ALTER TABLE ONLY public.migration_20260316100000_deleted_default_entity_types
|
|
2607
|
+
ADD CONSTRAINT migration_20260316100000_deleted_default_entity_types_pkey PRIMARY KEY (id);
|
|
2608
|
+
|
|
2609
|
+
|
|
2610
|
+
--
|
|
2611
|
+
-- Name: migration_20260316100000_events_kind_backup migration_20260316100000_events_kind_backup_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2612
|
+
--
|
|
2613
|
+
|
|
2614
|
+
ALTER TABLE ONLY public.migration_20260316100000_events_kind_backup
|
|
2615
|
+
ADD CONSTRAINT migration_20260316100000_events_kind_backup_pkey PRIMARY KEY (event_id);
|
|
2616
|
+
|
|
2617
|
+
|
|
2618
|
+
--
|
|
2619
|
+
-- Name: namespace namespace_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2620
|
+
--
|
|
2621
|
+
|
|
2622
|
+
ALTER TABLE ONLY public.namespace
|
|
2623
|
+
ADD CONSTRAINT namespace_pkey PRIMARY KEY (slug);
|
|
2624
|
+
|
|
2625
|
+
|
|
2626
|
+
--
|
|
2627
|
+
-- Name: notifications notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2628
|
+
--
|
|
2629
|
+
|
|
2630
|
+
ALTER TABLE ONLY public.notifications
|
|
2631
|
+
ADD CONSTRAINT notifications_pkey PRIMARY KEY (id);
|
|
2632
|
+
|
|
2633
|
+
|
|
2634
|
+
--
|
|
2635
|
+
-- Name: oauth_authorization_codes oauth_authorization_codes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2636
|
+
--
|
|
2637
|
+
|
|
2638
|
+
ALTER TABLE ONLY public.oauth_authorization_codes
|
|
2639
|
+
ADD CONSTRAINT oauth_authorization_codes_pkey PRIMARY KEY (code);
|
|
2640
|
+
|
|
2641
|
+
|
|
2642
|
+
--
|
|
2643
|
+
-- Name: oauth_clients oauth_clients_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2644
|
+
--
|
|
2645
|
+
|
|
2646
|
+
ALTER TABLE ONLY public.oauth_clients
|
|
2647
|
+
ADD CONSTRAINT oauth_clients_pkey PRIMARY KEY (id);
|
|
2648
|
+
|
|
2649
|
+
|
|
2650
|
+
--
|
|
2651
|
+
-- Name: oauth_device_codes oauth_device_codes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2652
|
+
--
|
|
2653
|
+
|
|
2654
|
+
ALTER TABLE ONLY public.oauth_device_codes
|
|
2655
|
+
ADD CONSTRAINT oauth_device_codes_pkey PRIMARY KEY (device_code);
|
|
2656
|
+
|
|
2657
|
+
|
|
2658
|
+
--
|
|
2659
|
+
-- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2660
|
+
--
|
|
2661
|
+
|
|
2662
|
+
ALTER TABLE ONLY public.oauth_tokens
|
|
2663
|
+
ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
|
|
2664
|
+
|
|
2665
|
+
|
|
2666
|
+
--
|
|
2667
|
+
-- Name: oauth_tokens oauth_tokens_token_hash_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2668
|
+
--
|
|
2669
|
+
|
|
2670
|
+
ALTER TABLE ONLY public.oauth_tokens
|
|
2671
|
+
ADD CONSTRAINT oauth_tokens_token_hash_key UNIQUE (token_hash);
|
|
2672
|
+
|
|
2673
|
+
|
|
2674
|
+
--
|
|
2675
|
+
-- Name: organization_lobu_links organization_lobu_links_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2676
|
+
--
|
|
2677
|
+
|
|
2678
|
+
ALTER TABLE ONLY public.organization_lobu_links
|
|
2679
|
+
ADD CONSTRAINT organization_lobu_links_pkey PRIMARY KEY (organization_id);
|
|
2680
|
+
|
|
2681
|
+
|
|
2682
|
+
--
|
|
2683
|
+
-- Name: organization organization_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2684
|
+
--
|
|
2685
|
+
|
|
2686
|
+
ALTER TABLE ONLY public.organization
|
|
2687
|
+
ADD CONSTRAINT organization_pkey PRIMARY KEY (id);
|
|
2688
|
+
|
|
2689
|
+
|
|
2690
|
+
--
|
|
2691
|
+
-- Name: organization organization_slug_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2692
|
+
--
|
|
2693
|
+
|
|
2694
|
+
ALTER TABLE ONLY public.organization
|
|
2695
|
+
ADD CONSTRAINT organization_slug_key UNIQUE (slug);
|
|
2696
|
+
|
|
2697
|
+
|
|
2698
|
+
--
|
|
2699
|
+
-- Name: personal_access_tokens personal_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2700
|
+
--
|
|
2701
|
+
|
|
2702
|
+
ALTER TABLE ONLY public.personal_access_tokens
|
|
2703
|
+
ADD CONSTRAINT personal_access_tokens_pkey PRIMARY KEY (id);
|
|
2704
|
+
|
|
2705
|
+
|
|
2706
|
+
--
|
|
2707
|
+
-- Name: personal_access_tokens personal_access_tokens_token_hash_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2708
|
+
--
|
|
2709
|
+
|
|
2710
|
+
ALTER TABLE ONLY public.personal_access_tokens
|
|
2711
|
+
ADD CONSTRAINT personal_access_tokens_token_hash_key UNIQUE (token_hash);
|
|
2712
|
+
|
|
2713
|
+
|
|
2714
|
+
--
|
|
2715
|
+
-- Name: rate_limits rate_limits_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2716
|
+
--
|
|
2717
|
+
|
|
2718
|
+
ALTER TABLE ONLY public.rate_limits
|
|
2719
|
+
ADD CONSTRAINT rate_limits_pkey PRIMARY KEY (key);
|
|
2720
|
+
|
|
2721
|
+
|
|
2722
|
+
--
|
|
2723
|
+
-- Name: runs runs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2724
|
+
--
|
|
2725
|
+
|
|
2726
|
+
ALTER TABLE ONLY public.runs
|
|
2727
|
+
ADD CONSTRAINT runs_pkey PRIMARY KEY (id);
|
|
2728
|
+
|
|
2729
|
+
|
|
2730
|
+
--
|
|
2731
|
+
--
|
|
2732
|
+
-- Name: session session_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2733
|
+
--
|
|
2734
|
+
|
|
2735
|
+
ALTER TABLE ONLY public.session
|
|
2736
|
+
ADD CONSTRAINT session_pkey PRIMARY KEY (id);
|
|
2737
|
+
|
|
2738
|
+
|
|
2739
|
+
--
|
|
2740
|
+
-- Name: session session_token_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2741
|
+
--
|
|
2742
|
+
|
|
2743
|
+
ALTER TABLE ONLY public.session
|
|
2744
|
+
ADD CONSTRAINT session_token_key UNIQUE (token);
|
|
2745
|
+
|
|
2746
|
+
|
|
2747
|
+
--
|
|
2748
|
+
-- Name: source_type_auth_defaults source_type_auth_defaults_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2749
|
+
--
|
|
2750
|
+
|
|
2751
|
+
ALTER TABLE ONLY public.source_type_auth_defaults
|
|
2752
|
+
ADD CONSTRAINT source_type_auth_defaults_pkey PRIMARY KEY (id);
|
|
2753
|
+
|
|
2754
|
+
|
|
2755
|
+
--
|
|
2756
|
+
-- Name: team team_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2757
|
+
--
|
|
2758
|
+
|
|
2759
|
+
ALTER TABLE ONLY public.team
|
|
2760
|
+
ADD CONSTRAINT team_pkey PRIMARY KEY (id);
|
|
2761
|
+
|
|
2762
|
+
|
|
2763
|
+
--
|
|
2764
|
+
-- Name: user user_email_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2765
|
+
--
|
|
2766
|
+
|
|
2767
|
+
ALTER TABLE ONLY public."user"
|
|
2768
|
+
ADD CONSTRAINT user_email_key UNIQUE (email);
|
|
2769
|
+
|
|
2770
|
+
|
|
2771
|
+
--
|
|
2772
|
+
-- Name: user user_phoneNumber_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2773
|
+
--
|
|
2774
|
+
|
|
2775
|
+
ALTER TABLE ONLY public."user"
|
|
2776
|
+
ADD CONSTRAINT "user_phoneNumber_key" UNIQUE ("phoneNumber");
|
|
2777
|
+
|
|
2778
|
+
|
|
2779
|
+
--
|
|
2780
|
+
-- Name: user user_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2781
|
+
--
|
|
2782
|
+
|
|
2783
|
+
ALTER TABLE ONLY public."user"
|
|
2784
|
+
ADD CONSTRAINT user_pkey PRIMARY KEY (id);
|
|
2785
|
+
|
|
2786
|
+
|
|
2787
|
+
--
|
|
2788
|
+
-- Name: verification verification_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2789
|
+
--
|
|
2790
|
+
|
|
2791
|
+
ALTER TABLE ONLY public.verification
|
|
2792
|
+
ADD CONSTRAINT verification_pkey PRIMARY KEY (id);
|
|
2793
|
+
|
|
2794
|
+
|
|
2795
|
+
--
|
|
2796
|
+
-- Name: view_template_active_tabs view_template_active_tabs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2797
|
+
--
|
|
2798
|
+
|
|
2799
|
+
ALTER TABLE ONLY public.view_template_active_tabs
|
|
2800
|
+
ADD CONSTRAINT view_template_active_tabs_pkey PRIMARY KEY (id);
|
|
2801
|
+
|
|
2802
|
+
|
|
2803
|
+
--
|
|
2804
|
+
-- Name: view_template_active_tabs view_template_active_tabs_unique; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2805
|
+
--
|
|
2806
|
+
|
|
2807
|
+
ALTER TABLE ONLY public.view_template_active_tabs
|
|
2808
|
+
ADD CONSTRAINT view_template_active_tabs_unique UNIQUE (resource_type, resource_id, organization_id, tab_name);
|
|
2809
|
+
|
|
2810
|
+
|
|
2811
|
+
--
|
|
2812
|
+
-- Name: view_template_versions view_template_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2813
|
+
--
|
|
2814
|
+
|
|
2815
|
+
ALTER TABLE ONLY public.view_template_versions
|
|
2816
|
+
ADD CONSTRAINT view_template_versions_pkey PRIMARY KEY (id);
|
|
2817
|
+
|
|
2818
|
+
|
|
2819
|
+
--
|
|
2820
|
+
-- Name: view_template_versions view_template_versions_unique; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2821
|
+
--
|
|
2822
|
+
|
|
2823
|
+
ALTER TABLE ONLY public.view_template_versions
|
|
2824
|
+
ADD CONSTRAINT view_template_versions_unique UNIQUE NULLS NOT DISTINCT (resource_type, resource_id, organization_id, tab_name, version);
|
|
2825
|
+
|
|
2826
|
+
|
|
2827
|
+
--
|
|
2828
|
+
-- Name: watcher_reactions watcher_reactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2829
|
+
--
|
|
2830
|
+
|
|
2831
|
+
ALTER TABLE ONLY public.watcher_reactions
|
|
2832
|
+
ADD CONSTRAINT watcher_reactions_pkey PRIMARY KEY (id);
|
|
2833
|
+
|
|
2834
|
+
|
|
2835
|
+
--
|
|
2836
|
+
-- Name: workers workers_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2837
|
+
--
|
|
2838
|
+
|
|
2839
|
+
ALTER TABLE ONLY public.workers
|
|
2840
|
+
ADD CONSTRAINT workers_pkey PRIMARY KEY (worker_id);
|
|
2841
|
+
|
|
2842
|
+
|
|
2843
|
+
--
|
|
2844
|
+
-- Name: workspace_settings workspace_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
2845
|
+
--
|
|
2846
|
+
|
|
2847
|
+
ALTER TABLE ONLY public.workspace_settings
|
|
2848
|
+
ADD CONSTRAINT workspace_settings_pkey PRIMARY KEY (organization_id);
|
|
2849
|
+
|
|
2850
|
+
|
|
2851
|
+
--
|
|
2852
|
+
-- Name: account_providerId_accountId_uidx; Type: INDEX; Schema: public; Owner: -
|
|
2853
|
+
--
|
|
2854
|
+
|
|
2855
|
+
CREATE UNIQUE INDEX "account_providerId_accountId_uidx" ON public.account USING btree ("providerId", "accountId");
|
|
2856
|
+
|
|
2857
|
+
|
|
2858
|
+
--
|
|
2859
|
+
-- Name: account_providerId_idx; Type: INDEX; Schema: public; Owner: -
|
|
2860
|
+
--
|
|
2861
|
+
|
|
2862
|
+
CREATE INDEX "account_providerId_idx" ON public.account USING btree ("providerId");
|
|
2863
|
+
|
|
2864
|
+
|
|
2865
|
+
--
|
|
2866
|
+
-- Name: account_userId_idx; Type: INDEX; Schema: public; Owner: -
|
|
2867
|
+
--
|
|
2868
|
+
|
|
2869
|
+
CREATE INDEX "account_userId_idx" ON public.account USING btree ("userId");
|
|
2870
|
+
|
|
2871
|
+
|
|
2872
|
+
--
|
|
2873
|
+
-- Name: agent_channel_bindings_agent_id_idx; Type: INDEX; Schema: public; Owner: -
|
|
2874
|
+
--
|
|
2875
|
+
|
|
2876
|
+
CREATE INDEX agent_channel_bindings_agent_id_idx ON public.agent_channel_bindings USING btree (agent_id);
|
|
2877
|
+
|
|
2878
|
+
|
|
2879
|
+
--
|
|
2880
|
+
-- Name: agent_connections_agent_id_idx; Type: INDEX; Schema: public; Owner: -
|
|
2881
|
+
--
|
|
2882
|
+
|
|
2883
|
+
CREATE INDEX agent_connections_agent_id_idx ON public.agent_connections USING btree (agent_id);
|
|
2884
|
+
|
|
2885
|
+
|
|
2886
|
+
--
|
|
2887
|
+
-- Name: agent_connections_platform_idx; Type: INDEX; Schema: public; Owner: -
|
|
2888
|
+
--
|
|
2889
|
+
|
|
2890
|
+
CREATE INDEX agent_connections_platform_idx ON public.agent_connections USING btree (platform);
|
|
2891
|
+
|
|
2892
|
+
|
|
2893
|
+
--
|
|
2894
|
+
-- Name: agent_grants_agent_id_idx; Type: INDEX; Schema: public; Owner: -
|
|
2895
|
+
--
|
|
2896
|
+
|
|
2897
|
+
CREATE INDEX agent_grants_agent_id_idx ON public.agent_grants USING btree (agent_id);
|
|
2898
|
+
|
|
2899
|
+
|
|
2900
|
+
--
|
|
2901
|
+
-- Name: agents_organization_id_idx; Type: INDEX; Schema: public; Owner: -
|
|
2902
|
+
--
|
|
2903
|
+
|
|
2904
|
+
CREATE INDEX agents_organization_id_idx ON public.agents USING btree (organization_id);
|
|
2905
|
+
|
|
2906
|
+
|
|
2907
|
+
--
|
|
2908
|
+
-- Name: agents_parent_connection_id_idx; Type: INDEX; Schema: public; Owner: -
|
|
2909
|
+
--
|
|
2910
|
+
|
|
2911
|
+
CREATE INDEX agents_parent_connection_id_idx ON public.agents USING btree (parent_connection_id);
|
|
2912
|
+
|
|
2913
|
+
|
|
2914
|
+
--
|
|
2915
|
+
-- Name: agents_template_agent_id_idx; Type: INDEX; Schema: public; Owner: -
|
|
2916
|
+
--
|
|
2917
|
+
|
|
2918
|
+
CREATE INDEX agents_template_agent_id_idx ON public.agents USING btree (template_agent_id);
|
|
2919
|
+
|
|
2920
|
+
|
|
2921
|
+
--
|
|
2922
|
+
-- Name: auth_profiles_connector_kind_idx; Type: INDEX; Schema: public; Owner: -
|
|
2923
|
+
--
|
|
2924
|
+
|
|
2925
|
+
CREATE INDEX auth_profiles_connector_kind_idx ON public.auth_profiles USING btree (organization_id, connector_key, profile_kind, status);
|
|
2926
|
+
|
|
2927
|
+
|
|
2928
|
+
--
|
|
2929
|
+
-- Name: auth_profiles_org_slug_unique; Type: INDEX; Schema: public; Owner: -
|
|
2930
|
+
--
|
|
2931
|
+
|
|
2932
|
+
CREATE UNIQUE INDEX auth_profiles_org_slug_unique ON public.auth_profiles USING btree (organization_id, slug);
|
|
2933
|
+
|
|
2934
|
+
|
|
2935
|
+
--
|
|
2936
|
+
-- Name: auth_profiles_pending_unique; Type: INDEX; Schema: public; Owner: -
|
|
2937
|
+
--
|
|
2938
|
+
|
|
2939
|
+
CREATE UNIQUE INDEX auth_profiles_pending_unique ON public.auth_profiles USING btree (organization_id, connector_key, profile_kind, provider) WHERE (status = 'pending_auth'::text);
|
|
2940
|
+
|
|
2941
|
+
|
|
2942
|
+
--
|
|
2943
|
+
-- Name: entities_slug_idx; Type: INDEX; Schema: public; Owner: -
|
|
2944
|
+
--
|
|
2945
|
+
|
|
2946
|
+
CREATE INDEX entities_slug_idx ON public.entities USING btree (slug);
|
|
2947
|
+
|
|
2948
|
+
|
|
2949
|
+
--
|
|
2950
|
+
-- Name: entities_slug_parent_unique; Type: INDEX; Schema: public; Owner: -
|
|
2951
|
+
--
|
|
2952
|
+
|
|
2953
|
+
CREATE UNIQUE INDEX entities_slug_parent_unique ON public.entities USING btree (organization_id, COALESCE(parent_id, (0)::bigint), slug);
|
|
2954
|
+
|
|
2955
|
+
|
|
2956
|
+
--
|
|
2957
|
+
-- Name: idx_cc_classifier_version_id; Type: INDEX; Schema: public; Owner: -
|
|
2958
|
+
--
|
|
2959
|
+
|
|
2960
|
+
CREATE INDEX idx_cc_classifier_version_id ON public.event_classifications USING btree (classifier_version_id);
|
|
2961
|
+
|
|
2962
|
+
|
|
2963
|
+
--
|
|
2964
|
+
-- Name: idx_cc_content_id; Type: INDEX; Schema: public; Owner: -
|
|
2965
|
+
--
|
|
2966
|
+
|
|
2967
|
+
CREATE INDEX idx_cc_content_id ON public.event_classifications USING btree (event_id);
|
|
2968
|
+
|
|
2969
|
+
|
|
2970
|
+
--
|
|
2971
|
+
-- Name: idx_cc_source; Type: INDEX; Schema: public; Owner: -
|
|
2972
|
+
--
|
|
2973
|
+
|
|
2974
|
+
CREATE INDEX idx_cc_source ON public.event_classifications USING btree (source);
|
|
2975
|
+
|
|
2976
|
+
|
|
2977
|
+
--
|
|
2978
|
+
-- Name: idx_cc_unique_per_source; Type: INDEX; Schema: public; Owner: -
|
|
2979
|
+
--
|
|
2980
|
+
|
|
2981
|
+
CREATE UNIQUE INDEX idx_cc_unique_per_source ON public.event_classifications USING btree (event_id, classifier_version_id, source, COALESCE(watcher_id, (0)::bigint));
|
|
2982
|
+
|
|
2983
|
+
|
|
2984
|
+
--
|
|
2985
|
+
-- Name: idx_cc_values_gin; Type: INDEX; Schema: public; Owner: -
|
|
2986
|
+
--
|
|
2987
|
+
|
|
2988
|
+
CREATE INDEX idx_cc_values_gin ON public.event_classifications USING gin ("values");
|
|
2989
|
+
|
|
2990
|
+
|
|
2991
|
+
--
|
|
2992
|
+
-- Name: idx_cc_watcher_id; Type: INDEX; Schema: public; Owner: -
|
|
2993
|
+
--
|
|
2994
|
+
|
|
2995
|
+
CREATE INDEX idx_cc_watcher_id ON public.event_classifications USING btree (watcher_id) WHERE (watcher_id IS NOT NULL);
|
|
2996
|
+
|
|
2997
|
+
|
|
2998
|
+
--
|
|
2999
|
+
-- Name: idx_cc_window_id; Type: INDEX; Schema: public; Owner: -
|
|
3000
|
+
--
|
|
3001
|
+
|
|
3002
|
+
CREATE INDEX idx_cc_window_id ON public.event_classifications USING btree (window_id) WHERE (window_id IS NOT NULL);
|
|
3003
|
+
|
|
3004
|
+
|
|
3005
|
+
--
|
|
3006
|
+
-- Name: idx_connect_tokens_connection_id; Type: INDEX; Schema: public; Owner: -
|
|
3007
|
+
--
|
|
3008
|
+
|
|
3009
|
+
CREATE INDEX idx_connect_tokens_connection_id ON public.connect_tokens USING btree (connection_id);
|
|
3010
|
+
|
|
3011
|
+
|
|
3012
|
+
--
|
|
3013
|
+
-- Name: idx_connect_tokens_status_expires; Type: INDEX; Schema: public; Owner: -
|
|
3014
|
+
--
|
|
3015
|
+
|
|
3016
|
+
CREATE INDEX idx_connect_tokens_status_expires ON public.connect_tokens USING btree (status, expires_at) WHERE (status = 'pending'::text);
|
|
3017
|
+
|
|
3018
|
+
|
|
3019
|
+
--
|
|
3020
|
+
-- Name: idx_connect_tokens_token; Type: INDEX; Schema: public; Owner: -
|
|
3021
|
+
--
|
|
3022
|
+
|
|
3023
|
+
CREATE INDEX idx_connect_tokens_token ON public.connect_tokens USING btree (token);
|
|
3024
|
+
|
|
3025
|
+
|
|
3026
|
+
--
|
|
3027
|
+
-- Name: idx_connections_account; Type: INDEX; Schema: public; Owner: -
|
|
3028
|
+
--
|
|
3029
|
+
|
|
3030
|
+
CREATE INDEX idx_connections_account ON public.connections USING btree (account_id);
|
|
3031
|
+
|
|
3032
|
+
|
|
3033
|
+
--
|
|
3034
|
+
-- Name: idx_connections_agent_id; Type: INDEX; Schema: public; Owner: -
|
|
3035
|
+
--
|
|
3036
|
+
|
|
3037
|
+
CREATE INDEX idx_connections_agent_id ON public.connections USING btree (agent_id) WHERE (agent_id IS NOT NULL);
|
|
3038
|
+
|
|
3039
|
+
|
|
3040
|
+
--
|
|
3041
|
+
-- Name: idx_connections_connector_key; Type: INDEX; Schema: public; Owner: -
|
|
3042
|
+
--
|
|
3043
|
+
|
|
3044
|
+
CREATE INDEX idx_connections_connector_key ON public.connections USING btree (connector_key);
|
|
3045
|
+
|
|
3046
|
+
|
|
3047
|
+
--
|
|
3048
|
+
-- Name: idx_connections_deleted_at; Type: INDEX; Schema: public; Owner: -
|
|
3049
|
+
--
|
|
3050
|
+
|
|
3051
|
+
CREATE INDEX idx_connections_deleted_at ON public.connections USING btree (deleted_at) WHERE (deleted_at IS NULL);
|
|
3052
|
+
|
|
3053
|
+
|
|
3054
|
+
--
|
|
3055
|
+
-- Name: idx_connections_entity_ids; Type: INDEX; Schema: public; Owner: -
|
|
3056
|
+
--
|
|
3057
|
+
|
|
3058
|
+
CREATE INDEX idx_connections_entity_ids ON public.connections USING gin (entity_ids);
|
|
3059
|
+
|
|
3060
|
+
|
|
3061
|
+
--
|
|
3062
|
+
-- Name: idx_connections_org; Type: INDEX; Schema: public; Owner: -
|
|
3063
|
+
--
|
|
3064
|
+
|
|
3065
|
+
CREATE INDEX idx_connections_org ON public.connections USING btree (organization_id);
|
|
3066
|
+
|
|
3067
|
+
|
|
3068
|
+
--
|
|
3069
|
+
-- Name: idx_connections_status; Type: INDEX; Schema: public; Owner: -
|
|
3070
|
+
--
|
|
3071
|
+
|
|
3072
|
+
CREATE INDEX idx_connections_status ON public.connections USING btree (status);
|
|
3073
|
+
|
|
3074
|
+
|
|
3075
|
+
--
|
|
3076
|
+
-- Name: idx_connections_visibility; Type: INDEX; Schema: public; Owner: -
|
|
3077
|
+
--
|
|
3078
|
+
|
|
3079
|
+
CREATE INDEX idx_connections_visibility ON public.connections USING btree (organization_id, visibility);
|
|
3080
|
+
|
|
3081
|
+
|
|
3082
|
+
--
|
|
3083
|
+
-- Name: idx_connector_defs_org_key; Type: INDEX; Schema: public; Owner: -
|
|
3084
|
+
--
|
|
3085
|
+
|
|
3086
|
+
CREATE UNIQUE INDEX idx_connector_defs_org_key ON public.connector_definitions USING btree (organization_id, key) WHERE ((organization_id IS NOT NULL) AND (status = 'active'::text));
|
|
3087
|
+
|
|
3088
|
+
|
|
3089
|
+
--
|
|
3090
|
+
-- Name: idx_connector_defs_status; Type: INDEX; Schema: public; Owner: -
|
|
3091
|
+
--
|
|
3092
|
+
|
|
3093
|
+
CREATE INDEX idx_connector_defs_status ON public.connector_definitions USING btree (status);
|
|
3094
|
+
|
|
3095
|
+
|
|
3096
|
+
--
|
|
3097
|
+
-- Name: idx_connector_defs_system_key; Type: INDEX; Schema: public; Owner: -
|
|
3098
|
+
--
|
|
3099
|
+
|
|
3100
|
+
CREATE UNIQUE INDEX idx_connector_defs_system_key ON public.connector_definitions USING btree (key) WHERE ((organization_id IS NULL) AND (status = 'active'::text));
|
|
3101
|
+
|
|
3102
|
+
|
|
3103
|
+
--
|
|
3104
|
+
-- Name: idx_connector_versions_key_version; Type: INDEX; Schema: public; Owner: -
|
|
3105
|
+
--
|
|
3106
|
+
|
|
3107
|
+
CREATE UNIQUE INDEX idx_connector_versions_key_version ON public.connector_versions USING btree (connector_key, version);
|
|
3108
|
+
|
|
3109
|
+
|
|
3110
|
+
--
|
|
3111
|
+
-- Name: idx_ec_has_excerpts; Type: INDEX; Schema: public; Owner: -
|
|
3112
|
+
--
|
|
3113
|
+
|
|
3114
|
+
CREATE INDEX idx_ec_has_excerpts ON public.event_classifications USING btree (((excerpts <> '{}'::jsonb))) WHERE (excerpts <> '{}'::jsonb);
|
|
3115
|
+
|
|
3116
|
+
|
|
3117
|
+
--
|
|
3118
|
+
-- Name: idx_entities_by_parent; Type: INDEX; Schema: public; Owner: -
|
|
3119
|
+
--
|
|
3120
|
+
|
|
3121
|
+
CREATE INDEX idx_entities_by_parent ON public.entities USING btree (parent_id, id) WHERE (parent_id IS NOT NULL);
|
|
3122
|
+
|
|
3123
|
+
|
|
3124
|
+
--
|
|
3125
|
+
-- Name: idx_entities_classifiers; Type: INDEX; Schema: public; Owner: -
|
|
3126
|
+
--
|
|
3127
|
+
|
|
3128
|
+
CREATE INDEX idx_entities_classifiers ON public.entities USING gin (enabled_classifiers) WHERE (enabled_classifiers IS NOT NULL);
|
|
3129
|
+
|
|
3130
|
+
|
|
3131
|
+
--
|
|
3132
|
+
-- Name: idx_entities_content_hash; Type: INDEX; Schema: public; Owner: -
|
|
3133
|
+
--
|
|
3134
|
+
|
|
3135
|
+
CREATE INDEX idx_entities_content_hash ON public.entities USING btree (organization_id, content_hash) WHERE ((content_hash IS NOT NULL) AND (deleted_at IS NULL));
|
|
3136
|
+
|
|
3137
|
+
|
|
3138
|
+
--
|
|
3139
|
+
-- Name: idx_entities_content_tsv; Type: INDEX; Schema: public; Owner: -
|
|
3140
|
+
--
|
|
3141
|
+
|
|
3142
|
+
CREATE INDEX idx_entities_content_tsv ON public.entities USING gin (content_tsv) WHERE (deleted_at IS NULL);
|
|
3143
|
+
|
|
3144
|
+
|
|
3145
|
+
--
|
|
3146
|
+
-- Name: idx_entities_created_by; Type: INDEX; Schema: public; Owner: -
|
|
3147
|
+
--
|
|
3148
|
+
|
|
3149
|
+
CREATE INDEX idx_entities_created_by ON public.entities USING btree (created_by);
|
|
3150
|
+
|
|
3151
|
+
|
|
3152
|
+
--
|
|
3153
|
+
-- Name: idx_entities_embedding; Type: INDEX; Schema: public; Owner: -
|
|
3154
|
+
--
|
|
3155
|
+
|
|
3156
|
+
CREATE INDEX idx_entities_embedding ON public.entities USING ivfflat (embedding public.vector_cosine_ops) WITH (lists='100') WHERE ((embedding IS NOT NULL) AND (deleted_at IS NULL));
|
|
3157
|
+
|
|
3158
|
+
|
|
3159
|
+
--
|
|
3160
|
+
-- Name: idx_entities_metadata_domain; Type: INDEX; Schema: public; Owner: -
|
|
3161
|
+
--
|
|
3162
|
+
|
|
3163
|
+
CREATE UNIQUE INDEX idx_entities_metadata_domain ON public.entities USING btree (((metadata ->> 'domain'::text)), organization_id) WHERE ((metadata ->> 'domain'::text) IS NOT NULL);
|
|
3164
|
+
|
|
3165
|
+
|
|
3166
|
+
--
|
|
3167
|
+
-- Name: idx_entities_name; Type: INDEX; Schema: public; Owner: -
|
|
3168
|
+
--
|
|
3169
|
+
|
|
3170
|
+
CREATE INDEX idx_entities_name ON public.entities USING btree (lower(name));
|
|
3171
|
+
|
|
3172
|
+
|
|
3173
|
+
--
|
|
3174
|
+
-- Name: idx_entities_organization_id; Type: INDEX; Schema: public; Owner: -
|
|
3175
|
+
--
|
|
3176
|
+
|
|
3177
|
+
CREATE INDEX idx_entities_organization_id ON public.entities USING btree (organization_id);
|
|
3178
|
+
|
|
3179
|
+
|
|
3180
|
+
--
|
|
3181
|
+
-- Name: idx_entity_rel_type_rules_type; Type: INDEX; Schema: public; Owner: -
|
|
3182
|
+
--
|
|
3183
|
+
|
|
3184
|
+
CREATE INDEX idx_entity_rel_type_rules_type ON public.entity_relationship_type_rules USING btree (relationship_type_id);
|
|
3185
|
+
|
|
3186
|
+
|
|
3187
|
+
--
|
|
3188
|
+
-- Name: idx_entity_rel_types_org_slug; Type: INDEX; Schema: public; Owner: -
|
|
3189
|
+
--
|
|
3190
|
+
|
|
3191
|
+
CREATE UNIQUE INDEX idx_entity_rel_types_org_slug ON public.entity_relationship_types USING btree (organization_id, slug) WHERE (status = 'active'::text);
|
|
3192
|
+
|
|
3193
|
+
|
|
3194
|
+
--
|
|
3195
|
+
-- Name: idx_entity_relationships_from; Type: INDEX; Schema: public; Owner: -
|
|
3196
|
+
--
|
|
3197
|
+
|
|
3198
|
+
CREATE INDEX idx_entity_relationships_from ON public.entity_relationships USING btree (from_entity_id);
|
|
3199
|
+
|
|
3200
|
+
|
|
3201
|
+
--
|
|
3202
|
+
-- Name: idx_entity_relationships_org; Type: INDEX; Schema: public; Owner: -
|
|
3203
|
+
--
|
|
3204
|
+
|
|
3205
|
+
CREATE INDEX idx_entity_relationships_org ON public.entity_relationships USING btree (organization_id);
|
|
3206
|
+
|
|
3207
|
+
|
|
3208
|
+
--
|
|
3209
|
+
-- Name: idx_entity_relationships_to; Type: INDEX; Schema: public; Owner: -
|
|
3210
|
+
--
|
|
3211
|
+
|
|
3212
|
+
CREATE INDEX idx_entity_relationships_to ON public.entity_relationships USING btree (to_entity_id);
|
|
3213
|
+
|
|
3214
|
+
|
|
3215
|
+
--
|
|
3216
|
+
-- Name: idx_entity_relationships_type; Type: INDEX; Schema: public; Owner: -
|
|
3217
|
+
--
|
|
3218
|
+
|
|
3219
|
+
CREATE INDEX idx_entity_relationships_type ON public.entity_relationships USING btree (relationship_type_id);
|
|
3220
|
+
|
|
3221
|
+
|
|
3222
|
+
--
|
|
3223
|
+
-- Name: idx_entity_type_audit_action; Type: INDEX; Schema: public; Owner: -
|
|
3224
|
+
--
|
|
3225
|
+
|
|
3226
|
+
CREATE INDEX idx_entity_type_audit_action ON public.entity_type_audit USING btree (action);
|
|
3227
|
+
|
|
3228
|
+
|
|
3229
|
+
--
|
|
3230
|
+
-- Name: idx_entity_type_audit_type_id; Type: INDEX; Schema: public; Owner: -
|
|
3231
|
+
--
|
|
3232
|
+
|
|
3233
|
+
CREATE INDEX idx_entity_type_audit_type_id ON public.entity_type_audit USING btree (entity_type_id);
|
|
3234
|
+
|
|
3235
|
+
|
|
3236
|
+
--
|
|
3237
|
+
-- Name: idx_entity_types_active; Type: INDEX; Schema: public; Owner: -
|
|
3238
|
+
--
|
|
3239
|
+
|
|
3240
|
+
CREATE INDEX idx_entity_types_active ON public.entity_types USING btree (id) WHERE (deleted_at IS NULL);
|
|
3241
|
+
|
|
3242
|
+
|
|
3243
|
+
--
|
|
3244
|
+
-- Name: idx_entity_types_org_slug; Type: INDEX; Schema: public; Owner: -
|
|
3245
|
+
--
|
|
3246
|
+
|
|
3247
|
+
CREATE UNIQUE INDEX idx_entity_types_org_slug ON public.entity_types USING btree (organization_id, slug) WHERE ((organization_id IS NOT NULL) AND (deleted_at IS NULL));
|
|
3248
|
+
|
|
3249
|
+
|
|
3250
|
+
--
|
|
3251
|
+
-- Name: idx_event_classifications_source; Type: INDEX; Schema: public; Owner: -
|
|
3252
|
+
--
|
|
3253
|
+
|
|
3254
|
+
CREATE INDEX idx_event_classifications_source ON public.event_classifications USING btree (source);
|
|
3255
|
+
|
|
3256
|
+
|
|
3257
|
+
--
|
|
3258
|
+
-- Name: idx_event_classifier_versions_classifier; Type: INDEX; Schema: public; Owner: -
|
|
3259
|
+
--
|
|
3260
|
+
|
|
3261
|
+
CREATE INDEX idx_event_classifier_versions_classifier ON public.event_classifier_versions USING btree (classifier_id);
|
|
3262
|
+
|
|
3263
|
+
|
|
3264
|
+
--
|
|
3265
|
+
-- Name: idx_event_classifier_versions_created_by; Type: INDEX; Schema: public; Owner: -
|
|
3266
|
+
--
|
|
3267
|
+
|
|
3268
|
+
CREATE INDEX idx_event_classifier_versions_created_by ON public.event_classifier_versions USING btree (created_by);
|
|
3269
|
+
|
|
3270
|
+
|
|
3271
|
+
--
|
|
3272
|
+
-- Name: idx_event_classifier_versions_current; Type: INDEX; Schema: public; Owner: -
|
|
3273
|
+
--
|
|
3274
|
+
|
|
3275
|
+
CREATE UNIQUE INDEX idx_event_classifier_versions_current ON public.event_classifier_versions USING btree (classifier_id) WHERE (is_current = true);
|
|
3276
|
+
|
|
3277
|
+
|
|
3278
|
+
--
|
|
3279
|
+
-- Name: idx_event_classifiers_created_by; Type: INDEX; Schema: public; Owner: -
|
|
3280
|
+
--
|
|
3281
|
+
|
|
3282
|
+
CREATE INDEX idx_event_classifiers_created_by ON public.event_classifiers USING btree (created_by);
|
|
3283
|
+
|
|
3284
|
+
|
|
3285
|
+
--
|
|
3286
|
+
-- Name: idx_event_classifiers_entity_id; Type: INDEX; Schema: public; Owner: -
|
|
3287
|
+
--
|
|
3288
|
+
|
|
3289
|
+
CREATE INDEX idx_event_classifiers_entity_id ON public.event_classifiers USING btree (entity_id) WHERE (entity_id IS NOT NULL);
|
|
3290
|
+
|
|
3291
|
+
|
|
3292
|
+
--
|
|
3293
|
+
-- Name: idx_event_classifiers_entity_ids; Type: INDEX; Schema: public; Owner: -
|
|
3294
|
+
--
|
|
3295
|
+
|
|
3296
|
+
CREATE INDEX idx_event_classifiers_entity_ids ON public.event_classifiers USING gin (entity_ids);
|
|
3297
|
+
|
|
3298
|
+
|
|
3299
|
+
--
|
|
3300
|
+
-- Name: idx_event_classifiers_insight_id; Type: INDEX; Schema: public; Owner: -
|
|
3301
|
+
--
|
|
3302
|
+
|
|
3303
|
+
CREATE INDEX idx_event_classifiers_insight_id ON public.event_classifiers USING btree (watcher_id) WHERE (watcher_id IS NOT NULL);
|
|
3304
|
+
|
|
3305
|
+
|
|
3306
|
+
--
|
|
3307
|
+
-- Name: idx_event_classifiers_organization_id; Type: INDEX; Schema: public; Owner: -
|
|
3308
|
+
--
|
|
3309
|
+
|
|
3310
|
+
CREATE INDEX idx_event_classifiers_organization_id ON public.event_classifiers USING btree (organization_id);
|
|
3311
|
+
|
|
3312
|
+
|
|
3313
|
+
--
|
|
3314
|
+
-- Name: idx_event_classifiers_slug; Type: INDEX; Schema: public; Owner: -
|
|
3315
|
+
--
|
|
3316
|
+
|
|
3317
|
+
CREATE INDEX idx_event_classifiers_slug ON public.event_classifiers USING btree (slug);
|
|
3318
|
+
|
|
3319
|
+
|
|
3320
|
+
--
|
|
3321
|
+
-- Name: idx_event_classifiers_status; Type: INDEX; Schema: public; Owner: -
|
|
3322
|
+
--
|
|
3323
|
+
|
|
3324
|
+
CREATE INDEX idx_event_classifiers_status ON public.event_classifiers USING btree (status);
|
|
3325
|
+
|
|
3326
|
+
|
|
3327
|
+
-- Name: idx_event_length; Type: INDEX; Schema: public; Owner: -
|
|
3328
|
+
--
|
|
3329
|
+
|
|
3330
|
+
CREATE INDEX idx_event_length ON public.events USING btree (source_id, (COALESCE(length(payload_text), 0)));
|
|
3331
|
+
|
|
3332
|
+
|
|
3333
|
+
--
|
|
3334
|
+
-- Name: idx_event_source_id; Type: INDEX; Schema: public; Owner: -
|
|
3335
|
+
--
|
|
3336
|
+
|
|
3337
|
+
CREATE INDEX idx_event_source_id ON public.events USING btree (source_id);
|
|
3338
|
+
|
|
3339
|
+
|
|
3340
|
+
--
|
|
3341
|
+
-- Name: idx_events_client_id; Type: INDEX; Schema: public; Owner: -
|
|
3342
|
+
--
|
|
3343
|
+
|
|
3344
|
+
CREATE INDEX idx_events_client_id ON public.events USING btree (client_id) WHERE (client_id IS NOT NULL);
|
|
3345
|
+
|
|
3346
|
+
|
|
3347
|
+
--
|
|
3348
|
+
-- Name: idx_events_connection_origin_id; Type: INDEX; Schema: public; Owner: -
|
|
3349
|
+
--
|
|
3350
|
+
CREATE INDEX idx_events_connection_origin_id ON public.events USING btree (connection_id, origin_id, created_at DESC) WHERE (connection_id IS NOT NULL);
|
|
3351
|
+
|
|
3352
|
+
|
|
3353
|
+
--
|
|
3354
|
+
-- Name: idx_events_connection_id; Type: INDEX; Schema: public; Owner: -
|
|
3355
|
+
--
|
|
3356
|
+
|
|
3357
|
+
CREATE INDEX idx_events_connection_id ON public.events USING btree (connection_id);
|
|
3358
|
+
|
|
3359
|
+
|
|
3360
|
+
--
|
|
3361
|
+
-- Name: idx_events_connector_key; Type: INDEX; Schema: public; Owner: -
|
|
3362
|
+
--
|
|
3363
|
+
|
|
3364
|
+
CREATE INDEX idx_events_connector_key ON public.events USING btree (connector_key);
|
|
3365
|
+
|
|
3366
|
+
|
|
3367
|
+
--
|
|
3368
|
+
-- Name: idx_events_created_at; Type: INDEX; Schema: public; Owner: -
|
|
3369
|
+
--
|
|
3370
|
+
|
|
3371
|
+
CREATE INDEX idx_events_created_at ON public.events USING btree (created_at);
|
|
3372
|
+
|
|
3373
|
+
|
|
3374
|
+
--
|
|
3375
|
+
-- Name: idx_events_created_by; Type: INDEX; Schema: public; Owner: -
|
|
3376
|
+
--
|
|
3377
|
+
|
|
3378
|
+
CREATE INDEX idx_events_created_by ON public.events USING btree (created_by) WHERE (created_by IS NOT NULL);
|
|
3379
|
+
|
|
3380
|
+
|
|
3381
|
+
--
|
|
3382
|
+
-- Name: idx_events_embedding; Type: INDEX; Schema: public; Owner: -
|
|
3383
|
+
--
|
|
3384
|
+
|
|
3385
|
+
CREATE INDEX idx_events_embedding ON public.event_embeddings USING ivfflat (embedding public.vector_cosine_ops) WITH (lists='1000');
|
|
3386
|
+
|
|
3387
|
+
|
|
3388
|
+
--
|
|
3389
|
+
-- Name: idx_events_entity_ids; Type: INDEX; Schema: public; Owner: -
|
|
3390
|
+
--
|
|
3391
|
+
|
|
3392
|
+
CREATE INDEX idx_events_entity_ids ON public.events USING gin (entity_ids);
|
|
3393
|
+
|
|
3394
|
+
|
|
3395
|
+
--
|
|
3396
|
+
-- Name: idx_events_entity_ids_occurred_at; Type: INDEX; Schema: public; Owner: -
|
|
3397
|
+
--
|
|
3398
|
+
CREATE INDEX idx_events_entity_ids_occurred_at ON public.events USING btree ((entity_ids[1]), occurred_at DESC, id DESC) WHERE ((entity_ids IS NOT NULL) AND (entity_ids <> '{}'::bigint[]));
|
|
3399
|
+
|
|
3400
|
+
|
|
3401
|
+
--
|
|
3402
|
+
-- Name: idx_events_feed_id; Type: INDEX; Schema: public; Owner: -
|
|
3403
|
+
--
|
|
3404
|
+
|
|
3405
|
+
CREATE INDEX idx_events_feed_id ON public.events USING btree (feed_id);
|
|
3406
|
+
|
|
3407
|
+
|
|
3408
|
+
--
|
|
3409
|
+
-- Name: idx_events_fulltext; Type: INDEX; Schema: public; Owner: -
|
|
3410
|
+
--
|
|
3411
|
+
|
|
3412
|
+
CREATE INDEX idx_events_fulltext ON public.events USING gin (to_tsvector('english'::regconfig, COALESCE(payload_text, ''::text)));
|
|
3413
|
+
|
|
3414
|
+
|
|
3415
|
+
--
|
|
3416
|
+
-- Name: idx_events_semantic_type; Type: INDEX; Schema: public; Owner: -
|
|
3417
|
+
--
|
|
3418
|
+
CREATE INDEX idx_events_semantic_type ON public.events USING btree (semantic_type);
|
|
3419
|
+
|
|
3420
|
+
|
|
3421
|
+
--
|
|
3422
|
+
-- Name: idx_events_missing_embedding_backfill; Type: INDEX; Schema: public; Owner: -
|
|
3423
|
+
--
|
|
3424
|
+
|
|
3425
|
+
CREATE INDEX idx_events_missing_embedding_backfill ON public.events USING btree (created_at, id) WHERE ((payload_text IS NOT NULL) AND (payload_text <> ''::text));
|
|
3426
|
+
|
|
3427
|
+
|
|
3428
|
+
--
|
|
3429
|
+
-- Name: idx_events_organization_id; Type: INDEX; Schema: public; Owner: -
|
|
3430
|
+
--
|
|
3431
|
+
|
|
3432
|
+
CREATE INDEX idx_events_organization_id ON public.events USING btree (organization_id) WHERE (organization_id IS NOT NULL);
|
|
3433
|
+
|
|
3434
|
+
|
|
3435
|
+
--
|
|
3436
|
+
-- Name: idx_events_origin_parent_id; Type: INDEX; Schema: public; Owner: -
|
|
3437
|
+
--
|
|
3438
|
+
CREATE INDEX idx_events_origin_parent_id ON public.events USING btree (origin_parent_id);
|
|
3439
|
+
|
|
3440
|
+
|
|
3441
|
+
--
|
|
3442
|
+
-- Name: idx_events_raw_content_trgm; Type: INDEX; Schema: public; Owner: -
|
|
3443
|
+
--
|
|
3444
|
+
|
|
3445
|
+
CREATE INDEX idx_events_raw_content_trgm ON public.events USING gin (payload_text public.gin_trgm_ops);
|
|
3446
|
+
|
|
3447
|
+
|
|
3448
|
+
--
|
|
3449
|
+
-- Name: idx_events_run_id; Type: INDEX; Schema: public; Owner: -
|
|
3450
|
+
--
|
|
3451
|
+
|
|
3452
|
+
CREATE INDEX idx_events_run_id ON public.events USING btree (run_id);
|
|
3453
|
+
|
|
3454
|
+
|
|
3455
|
+
--
|
|
3456
|
+
-- Name: idx_events_source_embedding; Type: INDEX; Schema: public; Owner: -
|
|
3457
|
+
--
|
|
3458
|
+
|
|
3459
|
+
CREATE INDEX idx_events_source_embedding ON public.event_embeddings USING btree (event_id);
|
|
3460
|
+
|
|
3461
|
+
|
|
3462
|
+
--
|
|
3463
|
+
-- Name: idx_events_superseded_by; Type: INDEX; Schema: public; Owner: -
|
|
3464
|
+
--
|
|
3465
|
+
|
|
3466
|
+
CREATE UNIQUE INDEX idx_events_superseded_by ON public.events USING btree (supersedes_event_id) WHERE (supersedes_event_id IS NOT NULL);
|
|
3467
|
+
|
|
3468
|
+
|
|
3469
|
+
--
|
|
3470
|
+
-- Name: idx_events_thread_lookup; Type: INDEX; Schema: public; Owner: -
|
|
3471
|
+
--
|
|
3472
|
+
|
|
3473
|
+
CREATE INDEX idx_events_thread_lookup ON public.events USING btree (origin_parent_id, occurred_at) WHERE (origin_parent_id IS NOT NULL);
|
|
3474
|
+
|
|
3475
|
+
|
|
3476
|
+
--
|
|
3477
|
+
-- Name: idx_events_type; Type: INDEX; Schema: public; Owner: -
|
|
3478
|
+
--
|
|
3479
|
+
|
|
3480
|
+
CREATE INDEX idx_events_type ON public.events USING btree (origin_type) WHERE (origin_type IS NOT NULL);
|
|
3481
|
+
|
|
3482
|
+
|
|
3483
|
+
--
|
|
3484
|
+
-- Name: idx_feeds_connection; Type: INDEX; Schema: public; Owner: -
|
|
3485
|
+
--
|
|
3486
|
+
|
|
3487
|
+
CREATE INDEX idx_feeds_connection ON public.feeds USING btree (connection_id);
|
|
3488
|
+
|
|
3489
|
+
|
|
3490
|
+
--
|
|
3491
|
+
-- Name: idx_feeds_deleted_at; Type: INDEX; Schema: public; Owner: -
|
|
3492
|
+
--
|
|
3493
|
+
|
|
3494
|
+
CREATE INDEX idx_feeds_deleted_at ON public.feeds USING btree (deleted_at) WHERE (deleted_at IS NULL);
|
|
3495
|
+
|
|
3496
|
+
|
|
3497
|
+
--
|
|
3498
|
+
-- Name: idx_feeds_entity_ids; Type: INDEX; Schema: public; Owner: -
|
|
3499
|
+
--
|
|
3500
|
+
|
|
3501
|
+
CREATE INDEX idx_feeds_entity_ids ON public.feeds USING gin (entity_ids);
|
|
3502
|
+
|
|
3503
|
+
|
|
3504
|
+
--
|
|
3505
|
+
-- Name: idx_feeds_next_run_at; Type: INDEX; Schema: public; Owner: -
|
|
3506
|
+
--
|
|
3507
|
+
|
|
3508
|
+
CREATE INDEX idx_feeds_next_run_at ON public.feeds USING btree (next_run_at) WHERE ((status = 'active'::text) AND (deleted_at IS NULL));
|
|
3509
|
+
|
|
3510
|
+
|
|
3511
|
+
--
|
|
3512
|
+
-- Name: idx_feeds_org; Type: INDEX; Schema: public; Owner: -
|
|
3513
|
+
--
|
|
3514
|
+
|
|
3515
|
+
CREATE INDEX idx_feeds_org ON public.feeds USING btree (organization_id);
|
|
3516
|
+
|
|
3517
|
+
|
|
3518
|
+
--
|
|
3519
|
+
-- Name: idx_feeds_status; Type: INDEX; Schema: public; Owner: -
|
|
3520
|
+
--
|
|
3521
|
+
|
|
3522
|
+
CREATE INDEX idx_feeds_status ON public.feeds USING btree (status);
|
|
3523
|
+
|
|
3524
|
+
|
|
3525
|
+
--
|
|
3526
|
+
-- Name: idx_latest_ec_classifier_id; Type: INDEX; Schema: public; Owner: -
|
|
3527
|
+
--
|
|
3528
|
+
|
|
3529
|
+
CREATE INDEX idx_latest_ec_classifier_id ON public.latest_event_classifications USING btree (classifier_id);
|
|
3530
|
+
|
|
3531
|
+
|
|
3532
|
+
--
|
|
3533
|
+
-- Name: idx_latest_ec_event_id; Type: INDEX; Schema: public; Owner: -
|
|
3534
|
+
--
|
|
3535
|
+
|
|
3536
|
+
CREATE INDEX idx_latest_ec_event_id ON public.latest_event_classifications USING btree (event_id);
|
|
3537
|
+
|
|
3538
|
+
|
|
3539
|
+
--
|
|
3540
|
+
-- Name: idx_latest_ec_id; Type: INDEX; Schema: public; Owner: -
|
|
3541
|
+
--
|
|
3542
|
+
|
|
3543
|
+
CREATE UNIQUE INDEX idx_latest_ec_id ON public.latest_event_classifications USING btree (id);
|
|
3544
|
+
|
|
3545
|
+
|
|
3546
|
+
--
|
|
3547
|
+
-- Name: idx_latest_ec_source; Type: INDEX; Schema: public; Owner: -
|
|
3548
|
+
--
|
|
3549
|
+
|
|
3550
|
+
CREATE INDEX idx_latest_ec_source ON public.latest_event_classifications USING btree (source);
|
|
3551
|
+
|
|
3552
|
+
|
|
3553
|
+
--
|
|
3554
|
+
-- Name: idx_latest_ec_values_gin; Type: INDEX; Schema: public; Owner: -
|
|
3555
|
+
--
|
|
3556
|
+
|
|
3557
|
+
CREATE INDEX idx_latest_ec_values_gin ON public.latest_event_classifications USING gin ("values");
|
|
3558
|
+
|
|
3559
|
+
|
|
3560
|
+
--
|
|
3561
|
+
-- Name: idx_notifications_listing; Type: INDEX; Schema: public; Owner: -
|
|
3562
|
+
--
|
|
3563
|
+
|
|
3564
|
+
CREATE INDEX idx_notifications_listing ON public.notifications USING btree (organization_id, user_id, created_at DESC);
|
|
3565
|
+
|
|
3566
|
+
|
|
3567
|
+
--
|
|
3568
|
+
-- Name: idx_notifications_unread; Type: INDEX; Schema: public; Owner: -
|
|
3569
|
+
--
|
|
3570
|
+
|
|
3571
|
+
CREATE INDEX idx_notifications_unread ON public.notifications USING btree (organization_id, user_id, is_read, created_at DESC);
|
|
3572
|
+
|
|
3573
|
+
|
|
3574
|
+
--
|
|
3575
|
+
-- Name: idx_rate_limits_updated_at; Type: INDEX; Schema: public; Owner: -
|
|
3576
|
+
--
|
|
3577
|
+
|
|
3578
|
+
CREATE INDEX idx_rate_limits_updated_at ON public.rate_limits USING btree (updated_at);
|
|
3579
|
+
|
|
3580
|
+
|
|
3581
|
+
--
|
|
3582
|
+
-- Name: idx_runs_active_embed_backfill_per_org; Type: INDEX; Schema: public; Owner: -
|
|
3583
|
+
--
|
|
3584
|
+
|
|
3585
|
+
CREATE UNIQUE INDEX idx_runs_active_embed_backfill_per_org ON public.runs USING btree (organization_id) WHERE ((run_type = 'embed_backfill'::text) AND (status = ANY (ARRAY['pending'::text, 'claimed'::text, 'running'::text])));
|
|
3586
|
+
|
|
3587
|
+
|
|
3588
|
+
--
|
|
3589
|
+
-- Name: idx_runs_active_sync_per_feed; Type: INDEX; Schema: public; Owner: -
|
|
3590
|
+
--
|
|
3591
|
+
|
|
3592
|
+
CREATE UNIQUE INDEX idx_runs_active_sync_per_feed ON public.runs USING btree (feed_id) WHERE ((run_type = 'sync'::text) AND (feed_id IS NOT NULL) AND (status = ANY (ARRAY['pending'::text, 'claimed'::text, 'running'::text])));
|
|
3593
|
+
|
|
3594
|
+
|
|
3595
|
+
--
|
|
3596
|
+
-- Name: idx_runs_connection; Type: INDEX; Schema: public; Owner: -
|
|
3597
|
+
--
|
|
3598
|
+
|
|
3599
|
+
CREATE INDEX idx_runs_connection ON public.runs USING btree (connection_id);
|
|
3600
|
+
|
|
3601
|
+
|
|
3602
|
+
--
|
|
3603
|
+
-- Name: idx_runs_feed; Type: INDEX; Schema: public; Owner: -
|
|
3604
|
+
--
|
|
3605
|
+
|
|
3606
|
+
CREATE INDEX idx_runs_feed ON public.runs USING btree (feed_id);
|
|
3607
|
+
|
|
3608
|
+
|
|
3609
|
+
--
|
|
3610
|
+
-- Name: idx_runs_org; Type: INDEX; Schema: public; Owner: -
|
|
3611
|
+
--
|
|
3612
|
+
|
|
3613
|
+
CREATE INDEX idx_runs_org ON public.runs USING btree (organization_id);
|
|
3614
|
+
|
|
3615
|
+
|
|
3616
|
+
--
|
|
3617
|
+
-- Name: idx_runs_pending; Type: INDEX; Schema: public; Owner: -
|
|
3618
|
+
--
|
|
3619
|
+
|
|
3620
|
+
CREATE INDEX idx_runs_pending ON public.runs USING btree (status, created_at) WHERE (status = 'pending'::text);
|
|
3621
|
+
|
|
3622
|
+
|
|
3623
|
+
--
|
|
3624
|
+
-- Name: idx_runs_status; Type: INDEX; Schema: public; Owner: -
|
|
3625
|
+
--
|
|
3626
|
+
|
|
3627
|
+
CREATE INDEX idx_runs_status ON public.runs USING btree (status);
|
|
3628
|
+
|
|
3629
|
+
|
|
3630
|
+
--
|
|
3631
|
+
-- Name: idx_runs_type; Type: INDEX; Schema: public; Owner: -
|
|
3632
|
+
--
|
|
3633
|
+
|
|
3634
|
+
CREATE INDEX idx_runs_type ON public.runs USING btree (run_type);
|
|
3635
|
+
|
|
3636
|
+
|
|
3637
|
+
--
|
|
3638
|
+
-- Name: idx_runs_watcher_id; Type: INDEX; Schema: public; Owner: -
|
|
3639
|
+
--
|
|
3640
|
+
|
|
3641
|
+
CREATE INDEX idx_runs_watcher_id ON public.runs USING btree (watcher_id) WHERE (watcher_id IS NOT NULL);
|
|
3642
|
+
|
|
3643
|
+
|
|
3644
|
+
--
|
|
3645
|
+
-- Name: idx_view_template_versions_resource; Type: INDEX; Schema: public; Owner: -
|
|
3646
|
+
--
|
|
3647
|
+
|
|
3648
|
+
CREATE INDEX idx_view_template_versions_resource ON public.view_template_versions USING btree (resource_type, resource_id, organization_id);
|
|
3649
|
+
|
|
3650
|
+
|
|
3651
|
+
--
|
|
3652
|
+
-- Name: idx_watcher_reactions_org; Type: INDEX; Schema: public; Owner: -
|
|
3653
|
+
--
|
|
3654
|
+
|
|
3655
|
+
CREATE INDEX idx_watcher_reactions_org ON public.watcher_reactions USING btree (organization_id);
|
|
3656
|
+
|
|
3657
|
+
|
|
3658
|
+
--
|
|
3659
|
+
-- Name: idx_watcher_reactions_window; Type: INDEX; Schema: public; Owner: -
|
|
3660
|
+
--
|
|
3661
|
+
|
|
3662
|
+
CREATE INDEX idx_watcher_reactions_window ON public.watcher_reactions USING btree (watcher_id, window_id);
|
|
3663
|
+
|
|
3664
|
+
|
|
3665
|
+
--
|
|
3666
|
+
-- Name: idx_watcher_template_versions_created_by; Type: INDEX; Schema: public; Owner: -
|
|
3667
|
+
--
|
|
3668
|
+
|
|
3669
|
+
CREATE INDEX idx_watcher_template_versions_created_by ON public.watcher_versions USING btree (created_by);
|
|
3670
|
+
|
|
3671
|
+
|
|
3672
|
+
--
|
|
3673
|
+
-- Name: idx_watcher_versions_watcher_version; Type: INDEX; Schema: public; Owner: -
|
|
3674
|
+
--
|
|
3675
|
+
|
|
3676
|
+
CREATE UNIQUE INDEX idx_watcher_versions_watcher_version ON public.watcher_versions USING btree (watcher_id, version);
|
|
3677
|
+
|
|
3678
|
+
|
|
3679
|
+
--
|
|
3680
|
+
-- Name: idx_watcher_window_events_event; Type: INDEX; Schema: public; Owner: -
|
|
3681
|
+
--
|
|
3682
|
+
|
|
3683
|
+
CREATE INDEX idx_watcher_window_events_event ON public.watcher_window_events USING btree (event_id);
|
|
3684
|
+
|
|
3685
|
+
|
|
3686
|
+
--
|
|
3687
|
+
-- Name: idx_watcher_window_events_unique; Type: INDEX; Schema: public; Owner: -
|
|
3688
|
+
--
|
|
3689
|
+
|
|
3690
|
+
CREATE UNIQUE INDEX idx_watcher_window_events_unique ON public.watcher_window_events USING btree (window_id, event_id);
|
|
3691
|
+
|
|
3692
|
+
|
|
3693
|
+
--
|
|
3694
|
+
-- Name: idx_watcher_window_events_window; Type: INDEX; Schema: public; Owner: -
|
|
3695
|
+
--
|
|
3696
|
+
|
|
3697
|
+
CREATE INDEX idx_watcher_window_events_window ON public.watcher_window_events USING btree (window_id);
|
|
3698
|
+
|
|
3699
|
+
|
|
3700
|
+
--
|
|
3701
|
+
-- Name: idx_watcher_windows_parent; Type: INDEX; Schema: public; Owner: -
|
|
3702
|
+
--
|
|
3703
|
+
|
|
3704
|
+
CREATE INDEX idx_watcher_windows_parent ON public.watcher_windows USING btree (parent_window_id) WHERE (parent_window_id IS NOT NULL);
|
|
3705
|
+
|
|
3706
|
+
|
|
3707
|
+
--
|
|
3708
|
+
-- Name: idx_watcher_windows_template_version; Type: INDEX; Schema: public; Owner: -
|
|
3709
|
+
--
|
|
3710
|
+
|
|
3711
|
+
CREATE INDEX idx_watcher_windows_template_version ON public.watcher_windows USING btree (version_id);
|
|
3712
|
+
|
|
3713
|
+
|
|
3714
|
+
--
|
|
3715
|
+
-- Name: idx_watcher_windows_unique_period; Type: INDEX; Schema: public; Owner: -
|
|
3716
|
+
--
|
|
3717
|
+
|
|
3718
|
+
CREATE UNIQUE INDEX idx_watcher_windows_unique_period ON public.watcher_windows USING btree (watcher_id, window_start, window_end) WHERE (is_rollup = false);
|
|
3719
|
+
|
|
3720
|
+
|
|
3721
|
+
--
|
|
3722
|
+
-- Name: idx_watcher_windows_watcher; Type: INDEX; Schema: public; Owner: -
|
|
3723
|
+
--
|
|
3724
|
+
|
|
3725
|
+
CREATE INDEX idx_watcher_windows_watcher ON public.watcher_windows USING btree (watcher_id, granularity, window_start DESC);
|
|
3726
|
+
|
|
3727
|
+
|
|
3728
|
+
--
|
|
3729
|
+
-- Name: idx_watchers_agent_id; Type: INDEX; Schema: public; Owner: -
|
|
3730
|
+
--
|
|
3731
|
+
|
|
3732
|
+
CREATE INDEX idx_watchers_agent_id ON public.watchers USING btree (agent_id) WHERE (agent_id IS NOT NULL);
|
|
3733
|
+
|
|
3734
|
+
|
|
3735
|
+
--
|
|
3736
|
+
-- Name: idx_watchers_connection_id; Type: INDEX; Schema: public; Owner: -
|
|
3737
|
+
--
|
|
3738
|
+
|
|
3739
|
+
CREATE INDEX idx_watchers_connection_id ON public.watchers USING btree (connection_id) WHERE (connection_id IS NOT NULL);
|
|
3740
|
+
|
|
3741
|
+
|
|
3742
|
+
--
|
|
3743
|
+
-- Name: idx_watchers_created_by; Type: INDEX; Schema: public; Owner: -
|
|
3744
|
+
--
|
|
3745
|
+
|
|
3746
|
+
CREATE INDEX idx_watchers_created_by ON public.watchers USING btree (created_by);
|
|
3747
|
+
|
|
3748
|
+
|
|
3749
|
+
--
|
|
3750
|
+
-- Name: idx_watchers_entity_ids; Type: INDEX; Schema: public; Owner: -
|
|
3751
|
+
--
|
|
3752
|
+
|
|
3753
|
+
CREATE INDEX idx_watchers_entity_ids ON public.watchers USING gin (entity_ids);
|
|
3754
|
+
|
|
3755
|
+
|
|
3756
|
+
--
|
|
3757
|
+
-- Name: idx_watchers_next_run_at; Type: INDEX; Schema: public; Owner: -
|
|
3758
|
+
--
|
|
3759
|
+
|
|
3760
|
+
CREATE INDEX idx_watchers_next_run_at ON public.watchers USING btree (next_run_at) WHERE ((schedule IS NOT NULL) AND (status = 'active'::text));
|
|
3761
|
+
|
|
3762
|
+
|
|
3763
|
+
--
|
|
3764
|
+
-- Name: idx_watchers_org_slug; Type: INDEX; Schema: public; Owner: -
|
|
3765
|
+
--
|
|
3766
|
+
|
|
3767
|
+
CREATE UNIQUE INDEX idx_watchers_org_slug ON public.watchers USING btree (organization_id, slug) WHERE (slug IS NOT NULL);
|
|
3768
|
+
|
|
3769
|
+
|
|
3770
|
+
--
|
|
3771
|
+
-- Name: idx_watchers_organization_id; Type: INDEX; Schema: public; Owner: -
|
|
3772
|
+
--
|
|
3773
|
+
|
|
3774
|
+
CREATE INDEX idx_watchers_organization_id ON public.watchers USING btree (organization_id) WHERE (organization_id IS NOT NULL);
|
|
3775
|
+
|
|
3776
|
+
|
|
3777
|
+
--
|
|
3778
|
+
-- Name: idx_workers_heartbeat; Type: INDEX; Schema: public; Owner: -
|
|
3779
|
+
--
|
|
3780
|
+
|
|
3781
|
+
CREATE INDEX idx_workers_heartbeat ON public.workers USING btree (last_heartbeat_at DESC) WHERE (status = ANY (ARRAY['active'::text, 'idle'::text]));
|
|
3782
|
+
|
|
3783
|
+
|
|
3784
|
+
--
|
|
3785
|
+
-- Name: idx_workers_region; Type: INDEX; Schema: public; Owner: -
|
|
3786
|
+
--
|
|
3787
|
+
|
|
3788
|
+
CREATE INDEX idx_workers_region ON public.workers USING btree (region) WHERE (region IS NOT NULL);
|
|
3789
|
+
|
|
3790
|
+
|
|
3791
|
+
--
|
|
3792
|
+
-- Name: idx_workers_status; Type: INDEX; Schema: public; Owner: -
|
|
3793
|
+
--
|
|
3794
|
+
|
|
3795
|
+
CREATE INDEX idx_workers_status ON public.workers USING btree (status, last_heartbeat_at);
|
|
3796
|
+
|
|
3797
|
+
|
|
3798
|
+
--
|
|
3799
|
+
-- Name: idx_workers_user; Type: INDEX; Schema: public; Owner: -
|
|
3800
|
+
--
|
|
3801
|
+
|
|
3802
|
+
CREATE INDEX idx_workers_user ON public.workers USING btree (user_id) WHERE (user_id IS NOT NULL);
|
|
3803
|
+
|
|
3804
|
+
|
|
3805
|
+
--
|
|
3806
|
+
-- Name: invitation_email_idx; Type: INDEX; Schema: public; Owner: -
|
|
3807
|
+
--
|
|
3808
|
+
|
|
3809
|
+
CREATE INDEX invitation_email_idx ON public.invitation USING btree (email);
|
|
3810
|
+
|
|
3811
|
+
|
|
3812
|
+
--
|
|
3813
|
+
-- Name: invitation_organizationId_idx; Type: INDEX; Schema: public; Owner: -
|
|
3814
|
+
--
|
|
3815
|
+
|
|
3816
|
+
CREATE INDEX "invitation_organizationId_idx" ON public.invitation USING btree ("organizationId");
|
|
3817
|
+
|
|
3818
|
+
|
|
3819
|
+
--
|
|
3820
|
+
-- Name: member_organizationId_idx; Type: INDEX; Schema: public; Owner: -
|
|
3821
|
+
--
|
|
3822
|
+
|
|
3823
|
+
CREATE INDEX "member_organizationId_idx" ON public.member USING btree ("organizationId");
|
|
3824
|
+
|
|
3825
|
+
|
|
3826
|
+
--
|
|
3827
|
+
-- Name: member_teamId_idx; Type: INDEX; Schema: public; Owner: -
|
|
3828
|
+
--
|
|
3829
|
+
|
|
3830
|
+
CREATE INDEX "member_teamId_idx" ON public.member USING btree ("teamId");
|
|
3831
|
+
|
|
3832
|
+
|
|
3833
|
+
--
|
|
3834
|
+
-- Name: member_userId_idx; Type: INDEX; Schema: public; Owner: -
|
|
3835
|
+
--
|
|
3836
|
+
|
|
3837
|
+
CREATE INDEX "member_userId_idx" ON public.member USING btree ("userId");
|
|
3838
|
+
|
|
3839
|
+
|
|
3840
|
+
--
|
|
3841
|
+
-- Name: namespace_ref_id_idx; Type: INDEX; Schema: public; Owner: -
|
|
3842
|
+
--
|
|
3843
|
+
|
|
3844
|
+
CREATE INDEX namespace_ref_id_idx ON public.namespace USING btree (ref_id);
|
|
3845
|
+
|
|
3846
|
+
|
|
3847
|
+
--
|
|
3848
|
+
-- Name: namespace_type_idx; Type: INDEX; Schema: public; Owner: -
|
|
3849
|
+
--
|
|
3850
|
+
|
|
3851
|
+
CREATE INDEX namespace_type_idx ON public.namespace USING btree (type);
|
|
3852
|
+
|
|
3853
|
+
|
|
3854
|
+
--
|
|
3855
|
+
-- Name: oauth_authorization_codes_client_id_idx; Type: INDEX; Schema: public; Owner: -
|
|
3856
|
+
--
|
|
3857
|
+
|
|
3858
|
+
CREATE INDEX oauth_authorization_codes_client_id_idx ON public.oauth_authorization_codes USING btree (client_id);
|
|
3859
|
+
|
|
3860
|
+
|
|
3861
|
+
--
|
|
3862
|
+
-- Name: oauth_authorization_codes_expires_at_idx; Type: INDEX; Schema: public; Owner: -
|
|
3863
|
+
--
|
|
3864
|
+
|
|
3865
|
+
CREATE INDEX oauth_authorization_codes_expires_at_idx ON public.oauth_authorization_codes USING btree (expires_at);
|
|
3866
|
+
|
|
3867
|
+
|
|
3868
|
+
--
|
|
3869
|
+
-- Name: oauth_clients_organization_id_idx; Type: INDEX; Schema: public; Owner: -
|
|
3870
|
+
--
|
|
3871
|
+
|
|
3872
|
+
CREATE INDEX oauth_clients_organization_id_idx ON public.oauth_clients USING btree (organization_id);
|
|
3873
|
+
|
|
3874
|
+
|
|
3875
|
+
--
|
|
3876
|
+
-- Name: oauth_clients_software_id_idx; Type: INDEX; Schema: public; Owner: -
|
|
3877
|
+
--
|
|
3878
|
+
|
|
3879
|
+
CREATE INDEX oauth_clients_software_id_idx ON public.oauth_clients USING btree (software_id);
|
|
3880
|
+
|
|
3881
|
+
|
|
3882
|
+
--
|
|
3883
|
+
-- Name: oauth_clients_user_id_idx; Type: INDEX; Schema: public; Owner: -
|
|
3884
|
+
--
|
|
3885
|
+
|
|
3886
|
+
CREATE INDEX oauth_clients_user_id_idx ON public.oauth_clients USING btree (user_id);
|
|
3887
|
+
|
|
3888
|
+
|
|
3889
|
+
--
|
|
3890
|
+
-- Name: oauth_device_codes_client_id_idx; Type: INDEX; Schema: public; Owner: -
|
|
3891
|
+
--
|
|
3892
|
+
|
|
3893
|
+
CREATE INDEX oauth_device_codes_client_id_idx ON public.oauth_device_codes USING btree (client_id);
|
|
3894
|
+
|
|
3895
|
+
|
|
3896
|
+
--
|
|
3897
|
+
-- Name: oauth_device_codes_expires_at_idx; Type: INDEX; Schema: public; Owner: -
|
|
3898
|
+
--
|
|
3899
|
+
|
|
3900
|
+
CREATE INDEX oauth_device_codes_expires_at_idx ON public.oauth_device_codes USING btree (expires_at);
|
|
3901
|
+
|
|
3902
|
+
|
|
3903
|
+
--
|
|
3904
|
+
-- Name: oauth_device_codes_user_code_idx; Type: INDEX; Schema: public; Owner: -
|
|
3905
|
+
--
|
|
3906
|
+
|
|
3907
|
+
CREATE UNIQUE INDEX oauth_device_codes_user_code_idx ON public.oauth_device_codes USING btree (user_code);
|
|
3908
|
+
|
|
3909
|
+
|
|
3910
|
+
--
|
|
3911
|
+
-- Name: oauth_tokens_active_idx; Type: INDEX; Schema: public; Owner: -
|
|
3912
|
+
--
|
|
3913
|
+
|
|
3914
|
+
CREATE INDEX oauth_tokens_active_idx ON public.oauth_tokens USING btree (user_id, expires_at) WHERE (revoked_at IS NULL);
|
|
3915
|
+
|
|
3916
|
+
|
|
3917
|
+
--
|
|
3918
|
+
-- Name: oauth_tokens_client_id_idx; Type: INDEX; Schema: public; Owner: -
|
|
3919
|
+
--
|
|
3920
|
+
|
|
3921
|
+
CREATE INDEX oauth_tokens_client_id_idx ON public.oauth_tokens USING btree (client_id);
|
|
3922
|
+
|
|
3923
|
+
|
|
3924
|
+
--
|
|
3925
|
+
-- Name: oauth_tokens_expires_at_idx; Type: INDEX; Schema: public; Owner: -
|
|
3926
|
+
--
|
|
3927
|
+
|
|
3928
|
+
CREATE INDEX oauth_tokens_expires_at_idx ON public.oauth_tokens USING btree (expires_at);
|
|
3929
|
+
|
|
3930
|
+
|
|
3931
|
+
--
|
|
3932
|
+
-- Name: oauth_tokens_token_hash_idx; Type: INDEX; Schema: public; Owner: -
|
|
3933
|
+
--
|
|
3934
|
+
|
|
3935
|
+
CREATE INDEX oauth_tokens_token_hash_idx ON public.oauth_tokens USING btree (token_hash);
|
|
3936
|
+
|
|
3937
|
+
|
|
3938
|
+
--
|
|
3939
|
+
-- Name: oauth_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
|
|
3940
|
+
--
|
|
3941
|
+
|
|
3942
|
+
CREATE INDEX oauth_tokens_user_id_idx ON public.oauth_tokens USING btree (user_id);
|
|
3943
|
+
|
|
3944
|
+
|
|
3945
|
+
--
|
|
3946
|
+
-- Name: personal_access_tokens_active_idx; Type: INDEX; Schema: public; Owner: -
|
|
3947
|
+
--
|
|
3948
|
+
|
|
3949
|
+
CREATE INDEX personal_access_tokens_active_idx ON public.personal_access_tokens USING btree (user_id, expires_at) WHERE (revoked_at IS NULL);
|
|
3950
|
+
|
|
3951
|
+
|
|
3952
|
+
--
|
|
3953
|
+
-- Name: personal_access_tokens_organization_id_idx; Type: INDEX; Schema: public; Owner: -
|
|
3954
|
+
--
|
|
3955
|
+
|
|
3956
|
+
CREATE INDEX personal_access_tokens_organization_id_idx ON public.personal_access_tokens USING btree (organization_id);
|
|
3957
|
+
|
|
3958
|
+
|
|
3959
|
+
--
|
|
3960
|
+
-- Name: personal_access_tokens_token_hash_idx; Type: INDEX; Schema: public; Owner: -
|
|
3961
|
+
--
|
|
3962
|
+
|
|
3963
|
+
CREATE INDEX personal_access_tokens_token_hash_idx ON public.personal_access_tokens USING btree (token_hash);
|
|
3964
|
+
|
|
3965
|
+
|
|
3966
|
+
--
|
|
3967
|
+
-- Name: personal_access_tokens_token_prefix_idx; Type: INDEX; Schema: public; Owner: -
|
|
3968
|
+
--
|
|
3969
|
+
|
|
3970
|
+
CREATE INDEX personal_access_tokens_token_prefix_idx ON public.personal_access_tokens USING btree (token_prefix);
|
|
3971
|
+
|
|
3972
|
+
|
|
3973
|
+
--
|
|
3974
|
+
-- Name: personal_access_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
|
|
3975
|
+
--
|
|
3976
|
+
|
|
3977
|
+
CREATE INDEX personal_access_tokens_user_id_idx ON public.personal_access_tokens USING btree (user_id);
|
|
3978
|
+
|
|
3979
|
+
|
|
3980
|
+
--
|
|
3981
|
+
-- Name: session_expiresAt_idx; Type: INDEX; Schema: public; Owner: -
|
|
3982
|
+
--
|
|
3983
|
+
|
|
3984
|
+
CREATE INDEX "session_expiresAt_idx" ON public.session USING btree ("expiresAt");
|
|
3985
|
+
|
|
3986
|
+
|
|
3987
|
+
--
|
|
3988
|
+
-- Name: session_token_idx; Type: INDEX; Schema: public; Owner: -
|
|
3989
|
+
--
|
|
3990
|
+
|
|
3991
|
+
CREATE INDEX session_token_idx ON public.session USING btree (token);
|
|
3992
|
+
|
|
3993
|
+
|
|
3994
|
+
--
|
|
3995
|
+
-- Name: session_userId_idx; Type: INDEX; Schema: public; Owner: -
|
|
3996
|
+
--
|
|
3997
|
+
|
|
3998
|
+
CREATE INDEX "session_userId_idx" ON public.session USING btree ("userId");
|
|
3999
|
+
|
|
4000
|
+
|
|
4001
|
+
--
|
|
4002
|
+
-- Name: team_organizationId_idx; Type: INDEX; Schema: public; Owner: -
|
|
4003
|
+
--
|
|
4004
|
+
|
|
4005
|
+
CREATE INDEX "team_organizationId_idx" ON public.team USING btree ("organizationId");
|
|
4006
|
+
|
|
4007
|
+
|
|
4008
|
+
--
|
|
4009
|
+
-- Name: user_username_unique; Type: INDEX; Schema: public; Owner: -
|
|
4010
|
+
--
|
|
4011
|
+
|
|
4012
|
+
CREATE UNIQUE INDEX user_username_unique ON public."user" USING btree (username);
|
|
4013
|
+
|
|
4014
|
+
|
|
4015
|
+
--
|
|
4016
|
+
-- Name: verification_expiresAt_idx; Type: INDEX; Schema: public; Owner: -
|
|
4017
|
+
--
|
|
4018
|
+
|
|
4019
|
+
CREATE INDEX "verification_expiresAt_idx" ON public.verification USING btree ("expiresAt");
|
|
4020
|
+
|
|
4021
|
+
|
|
4022
|
+
--
|
|
4023
|
+
-- Name: verification_identifier_idx; Type: INDEX; Schema: public; Owner: -
|
|
4024
|
+
--
|
|
4025
|
+
|
|
4026
|
+
CREATE INDEX verification_identifier_idx ON public.verification USING btree (identifier);
|
|
4027
|
+
|
|
4028
|
+
|
|
4029
|
+
--
|
|
4030
|
+
-- Name: entities check_entity_cycles; Type: TRIGGER; Schema: public; Owner: -
|
|
4031
|
+
--
|
|
4032
|
+
|
|
4033
|
+
CREATE TRIGGER check_entity_cycles BEFORE INSERT OR UPDATE ON public.entities FOR EACH ROW EXECUTE FUNCTION public.prevent_entity_cycles();
|
|
4034
|
+
|
|
4035
|
+
|
|
4036
|
+
--
|
|
4037
|
+
-- Name: account account_userId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4038
|
+
--
|
|
4039
|
+
|
|
4040
|
+
ALTER TABLE ONLY public.account
|
|
4041
|
+
ADD CONSTRAINT "account_userId_fkey" FOREIGN KEY ("userId") REFERENCES public."user"(id) ON DELETE CASCADE;
|
|
4042
|
+
|
|
4043
|
+
|
|
4044
|
+
--
|
|
4045
|
+
-- Name: agent_channel_bindings agent_channel_bindings_agent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4046
|
+
--
|
|
4047
|
+
|
|
4048
|
+
ALTER TABLE ONLY public.agent_channel_bindings
|
|
4049
|
+
ADD CONSTRAINT agent_channel_bindings_agent_id_fkey FOREIGN KEY (agent_id) REFERENCES public.agents(id) ON DELETE CASCADE;
|
|
4050
|
+
|
|
4051
|
+
|
|
4052
|
+
--
|
|
4053
|
+
-- Name: agent_connections agent_connections_agent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4054
|
+
--
|
|
4055
|
+
|
|
4056
|
+
ALTER TABLE ONLY public.agent_connections
|
|
4057
|
+
ADD CONSTRAINT agent_connections_agent_id_fkey FOREIGN KEY (agent_id) REFERENCES public.agents(id) ON DELETE CASCADE;
|
|
4058
|
+
|
|
4059
|
+
|
|
4060
|
+
--
|
|
4061
|
+
-- Name: agent_grants agent_grants_agent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4062
|
+
--
|
|
4063
|
+
|
|
4064
|
+
ALTER TABLE ONLY public.agent_grants
|
|
4065
|
+
ADD CONSTRAINT agent_grants_agent_id_fkey FOREIGN KEY (agent_id) REFERENCES public.agents(id) ON DELETE CASCADE;
|
|
4066
|
+
|
|
4067
|
+
|
|
4068
|
+
--
|
|
4069
|
+
-- Name: agent_users agent_users_agent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4070
|
+
--
|
|
4071
|
+
|
|
4072
|
+
ALTER TABLE ONLY public.agent_users
|
|
4073
|
+
ADD CONSTRAINT agent_users_agent_id_fkey FOREIGN KEY (agent_id) REFERENCES public.agents(id) ON DELETE CASCADE;
|
|
4074
|
+
|
|
4075
|
+
|
|
4076
|
+
--
|
|
4077
|
+
-- Name: agents agents_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4078
|
+
--
|
|
4079
|
+
|
|
4080
|
+
ALTER TABLE ONLY public.agents
|
|
4081
|
+
ADD CONSTRAINT agents_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE CASCADE;
|
|
4082
|
+
|
|
4083
|
+
|
|
4084
|
+
--
|
|
4085
|
+
-- Name: agents agents_template_agent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4086
|
+
--
|
|
4087
|
+
|
|
4088
|
+
ALTER TABLE ONLY public.agents
|
|
4089
|
+
ADD CONSTRAINT agents_template_agent_id_fkey FOREIGN KEY (template_agent_id) REFERENCES public.agents(id) ON DELETE SET NULL;
|
|
4090
|
+
|
|
4091
|
+
|
|
4092
|
+
--
|
|
4093
|
+
-- Name: auth_profiles auth_profiles_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4094
|
+
--
|
|
4095
|
+
|
|
4096
|
+
ALTER TABLE ONLY public.auth_profiles
|
|
4097
|
+
ADD CONSTRAINT auth_profiles_account_id_fkey FOREIGN KEY (account_id) REFERENCES public.account(id) ON DELETE SET NULL;
|
|
4098
|
+
|
|
4099
|
+
|
|
4100
|
+
--
|
|
4101
|
+
-- Name: auth_profiles auth_profiles_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4102
|
+
--
|
|
4103
|
+
|
|
4104
|
+
ALTER TABLE ONLY public.auth_profiles
|
|
4105
|
+
ADD CONSTRAINT auth_profiles_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE CASCADE;
|
|
4106
|
+
|
|
4107
|
+
|
|
4108
|
+
--
|
|
4109
|
+
-- Name: connect_tokens connect_tokens_auth_profile_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4110
|
+
--
|
|
4111
|
+
|
|
4112
|
+
ALTER TABLE ONLY public.connect_tokens
|
|
4113
|
+
ADD CONSTRAINT connect_tokens_auth_profile_id_fkey FOREIGN KEY (auth_profile_id) REFERENCES public.auth_profiles(id) ON DELETE SET NULL;
|
|
4114
|
+
|
|
4115
|
+
|
|
4116
|
+
--
|
|
4117
|
+
-- Name: connect_tokens connect_tokens_connection_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4118
|
+
--
|
|
4119
|
+
|
|
4120
|
+
ALTER TABLE ONLY public.connect_tokens
|
|
4121
|
+
ADD CONSTRAINT connect_tokens_connection_id_fkey FOREIGN KEY (connection_id) REFERENCES public.connections(id) ON DELETE CASCADE;
|
|
4122
|
+
|
|
4123
|
+
|
|
4124
|
+
--
|
|
4125
|
+
-- Name: connections connections_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4126
|
+
--
|
|
4127
|
+
|
|
4128
|
+
ALTER TABLE ONLY public.connections
|
|
4129
|
+
ADD CONSTRAINT connections_account_id_fkey FOREIGN KEY (account_id) REFERENCES public.account(id) ON DELETE SET NULL;
|
|
4130
|
+
|
|
4131
|
+
|
|
4132
|
+
--
|
|
4133
|
+
-- Name: connections connections_app_auth_profile_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4134
|
+
--
|
|
4135
|
+
|
|
4136
|
+
ALTER TABLE ONLY public.connections
|
|
4137
|
+
ADD CONSTRAINT connections_app_auth_profile_id_fkey FOREIGN KEY (app_auth_profile_id) REFERENCES public.auth_profiles(id) ON DELETE SET NULL;
|
|
4138
|
+
|
|
4139
|
+
|
|
4140
|
+
--
|
|
4141
|
+
-- Name: connections connections_auth_profile_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4142
|
+
--
|
|
4143
|
+
|
|
4144
|
+
ALTER TABLE ONLY public.connections
|
|
4145
|
+
ADD CONSTRAINT connections_auth_profile_id_fkey FOREIGN KEY (auth_profile_id) REFERENCES public.auth_profiles(id) ON DELETE SET NULL;
|
|
4146
|
+
|
|
4147
|
+
|
|
4148
|
+
--
|
|
4149
|
+
-- Name: connections connections_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4150
|
+
--
|
|
4151
|
+
|
|
4152
|
+
ALTER TABLE ONLY public.connections
|
|
4153
|
+
ADD CONSTRAINT connections_created_by_fkey FOREIGN KEY (created_by) REFERENCES public."user"(id) ON DELETE SET NULL;
|
|
4154
|
+
|
|
4155
|
+
|
|
4156
|
+
--
|
|
4157
|
+
-- Name: connections connections_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4158
|
+
--
|
|
4159
|
+
|
|
4160
|
+
ALTER TABLE ONLY public.connections
|
|
4161
|
+
ADD CONSTRAINT connections_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE CASCADE;
|
|
4162
|
+
|
|
4163
|
+
|
|
4164
|
+
--
|
|
4165
|
+
-- Name: connector_definitions connector_definitions_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4166
|
+
--
|
|
4167
|
+
|
|
4168
|
+
ALTER TABLE ONLY public.connector_definitions
|
|
4169
|
+
ADD CONSTRAINT connector_definitions_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE CASCADE;
|
|
4170
|
+
|
|
4171
|
+
|
|
4172
|
+
--
|
|
4173
|
+
-- Name: entities entities_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4174
|
+
--
|
|
4175
|
+
|
|
4176
|
+
ALTER TABLE ONLY public.entities
|
|
4177
|
+
ADD CONSTRAINT entities_created_by_fkey FOREIGN KEY (created_by) REFERENCES public."user"(id) ON DELETE RESTRICT;
|
|
4178
|
+
|
|
4179
|
+
|
|
4180
|
+
--
|
|
4181
|
+
-- Name: entities entities_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4182
|
+
--
|
|
4183
|
+
|
|
4184
|
+
ALTER TABLE ONLY public.entities
|
|
4185
|
+
ADD CONSTRAINT entities_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE CASCADE;
|
|
4186
|
+
|
|
4187
|
+
|
|
4188
|
+
--
|
|
4189
|
+
-- Name: entities entities_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4190
|
+
--
|
|
4191
|
+
|
|
4192
|
+
ALTER TABLE ONLY public.entities
|
|
4193
|
+
ADD CONSTRAINT entities_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES public.entities(id) ON DELETE RESTRICT;
|
|
4194
|
+
|
|
4195
|
+
|
|
4196
|
+
--
|
|
4197
|
+
-- Name: entities entities_view_template_version_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4198
|
+
--
|
|
4199
|
+
|
|
4200
|
+
ALTER TABLE ONLY public.entities
|
|
4201
|
+
ADD CONSTRAINT entities_view_template_version_fk FOREIGN KEY (current_view_template_version_id) REFERENCES public.view_template_versions(id);
|
|
4202
|
+
|
|
4203
|
+
|
|
4204
|
+
--
|
|
4205
|
+
-- Name: entity_relationship_type_rules entity_relationship_type_rules_relationship_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4206
|
+
--
|
|
4207
|
+
|
|
4208
|
+
ALTER TABLE ONLY public.entity_relationship_type_rules
|
|
4209
|
+
ADD CONSTRAINT entity_relationship_type_rules_relationship_type_id_fkey FOREIGN KEY (relationship_type_id) REFERENCES public.entity_relationship_types(id) ON DELETE CASCADE;
|
|
4210
|
+
|
|
4211
|
+
|
|
4212
|
+
--
|
|
4213
|
+
-- Name: entity_relationship_types entity_relationship_types_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4214
|
+
--
|
|
4215
|
+
|
|
4216
|
+
ALTER TABLE ONLY public.entity_relationship_types
|
|
4217
|
+
ADD CONSTRAINT entity_relationship_types_created_by_fkey FOREIGN KEY (created_by) REFERENCES public."user"(id) ON DELETE SET NULL;
|
|
4218
|
+
|
|
4219
|
+
|
|
4220
|
+
--
|
|
4221
|
+
-- Name: entity_relationship_types entity_relationship_types_inverse_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4222
|
+
--
|
|
4223
|
+
|
|
4224
|
+
ALTER TABLE ONLY public.entity_relationship_types
|
|
4225
|
+
ADD CONSTRAINT entity_relationship_types_inverse_type_id_fkey FOREIGN KEY (inverse_type_id) REFERENCES public.entity_relationship_types(id) ON DELETE SET NULL;
|
|
4226
|
+
|
|
4227
|
+
|
|
4228
|
+
--
|
|
4229
|
+
-- Name: entity_relationship_types entity_relationship_types_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4230
|
+
--
|
|
4231
|
+
|
|
4232
|
+
ALTER TABLE ONLY public.entity_relationship_types
|
|
4233
|
+
ADD CONSTRAINT entity_relationship_types_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE CASCADE;
|
|
4234
|
+
|
|
4235
|
+
|
|
4236
|
+
--
|
|
4237
|
+
-- Name: entity_relationships entity_relationships_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4238
|
+
--
|
|
4239
|
+
|
|
4240
|
+
ALTER TABLE ONLY public.entity_relationships
|
|
4241
|
+
ADD CONSTRAINT entity_relationships_created_by_fkey FOREIGN KEY (created_by) REFERENCES public."user"(id) ON DELETE SET NULL;
|
|
4242
|
+
|
|
4243
|
+
|
|
4244
|
+
--
|
|
4245
|
+
-- Name: entity_relationships entity_relationships_from_entity_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4246
|
+
--
|
|
4247
|
+
|
|
4248
|
+
ALTER TABLE ONLY public.entity_relationships
|
|
4249
|
+
ADD CONSTRAINT entity_relationships_from_entity_id_fkey FOREIGN KEY (from_entity_id) REFERENCES public.entities(id) ON DELETE CASCADE;
|
|
4250
|
+
|
|
4251
|
+
|
|
4252
|
+
--
|
|
4253
|
+
-- Name: entity_relationships entity_relationships_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4254
|
+
--
|
|
4255
|
+
|
|
4256
|
+
ALTER TABLE ONLY public.entity_relationships
|
|
4257
|
+
ADD CONSTRAINT entity_relationships_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE CASCADE;
|
|
4258
|
+
|
|
4259
|
+
|
|
4260
|
+
--
|
|
4261
|
+
-- Name: entity_relationships entity_relationships_relationship_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4262
|
+
--
|
|
4263
|
+
|
|
4264
|
+
ALTER TABLE ONLY public.entity_relationships
|
|
4265
|
+
ADD CONSTRAINT entity_relationships_relationship_type_id_fkey FOREIGN KEY (relationship_type_id) REFERENCES public.entity_relationship_types(id) ON DELETE CASCADE;
|
|
4266
|
+
|
|
4267
|
+
|
|
4268
|
+
--
|
|
4269
|
+
-- Name: entity_relationships entity_relationships_to_entity_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4270
|
+
--
|
|
4271
|
+
|
|
4272
|
+
ALTER TABLE ONLY public.entity_relationships
|
|
4273
|
+
ADD CONSTRAINT entity_relationships_to_entity_id_fkey FOREIGN KEY (to_entity_id) REFERENCES public.entities(id) ON DELETE CASCADE;
|
|
4274
|
+
|
|
4275
|
+
|
|
4276
|
+
--
|
|
4277
|
+
-- Name: entity_relationships entity_relationships_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4278
|
+
--
|
|
4279
|
+
|
|
4280
|
+
ALTER TABLE ONLY public.entity_relationships
|
|
4281
|
+
ADD CONSTRAINT entity_relationships_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public."user"(id) ON DELETE SET NULL;
|
|
4282
|
+
|
|
4283
|
+
|
|
4284
|
+
--
|
|
4285
|
+
-- Name: entity_type_audit entity_type_audit_actor_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4286
|
+
--
|
|
4287
|
+
|
|
4288
|
+
ALTER TABLE ONLY public.entity_type_audit
|
|
4289
|
+
ADD CONSTRAINT entity_type_audit_actor_fkey FOREIGN KEY (actor) REFERENCES public."user"(id) ON DELETE SET NULL;
|
|
4290
|
+
|
|
4291
|
+
|
|
4292
|
+
--
|
|
4293
|
+
-- Name: entity_type_audit entity_type_audit_entity_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4294
|
+
--
|
|
4295
|
+
|
|
4296
|
+
ALTER TABLE ONLY public.entity_type_audit
|
|
4297
|
+
ADD CONSTRAINT entity_type_audit_entity_type_id_fkey FOREIGN KEY (entity_type_id) REFERENCES public.entity_types(id) ON DELETE CASCADE;
|
|
4298
|
+
|
|
4299
|
+
|
|
4300
|
+
--
|
|
4301
|
+
-- Name: entity_types entity_types_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4302
|
+
--
|
|
4303
|
+
|
|
4304
|
+
ALTER TABLE ONLY public.entity_types
|
|
4305
|
+
ADD CONSTRAINT entity_types_created_by_fkey FOREIGN KEY (created_by) REFERENCES public."user"(id) ON DELETE SET NULL;
|
|
4306
|
+
|
|
4307
|
+
|
|
4308
|
+
--
|
|
4309
|
+
-- Name: entity_types entity_types_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4310
|
+
--
|
|
4311
|
+
|
|
4312
|
+
ALTER TABLE ONLY public.entity_types
|
|
4313
|
+
ADD CONSTRAINT entity_types_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE CASCADE;
|
|
4314
|
+
|
|
4315
|
+
|
|
4316
|
+
--
|
|
4317
|
+
-- Name: entity_types entity_types_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4318
|
+
--
|
|
4319
|
+
|
|
4320
|
+
ALTER TABLE ONLY public.entity_types
|
|
4321
|
+
ADD CONSTRAINT entity_types_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public."user"(id) ON DELETE SET NULL;
|
|
4322
|
+
|
|
4323
|
+
|
|
4324
|
+
--
|
|
4325
|
+
-- Name: entity_types entity_types_view_template_version_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4326
|
+
--
|
|
4327
|
+
|
|
4328
|
+
ALTER TABLE ONLY public.entity_types
|
|
4329
|
+
ADD CONSTRAINT entity_types_view_template_version_fk FOREIGN KEY (current_view_template_version_id) REFERENCES public.view_template_versions(id);
|
|
4330
|
+
|
|
4331
|
+
|
|
4332
|
+
--
|
|
4333
|
+
-- Name: event_classifications event_classifications_classifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4334
|
+
--
|
|
4335
|
+
|
|
4336
|
+
ALTER TABLE ONLY public.event_classifications
|
|
4337
|
+
ADD CONSTRAINT event_classifications_classifier_id_fkey FOREIGN KEY (classifier_version_id) REFERENCES public.event_classifier_versions(id);
|
|
4338
|
+
|
|
4339
|
+
|
|
4340
|
+
--
|
|
4341
|
+
-- Name: event_classifications event_classifications_classifier_version_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4342
|
+
--
|
|
4343
|
+
|
|
4344
|
+
ALTER TABLE ONLY public.event_classifications
|
|
4345
|
+
ADD CONSTRAINT event_classifications_classifier_version_id_fkey FOREIGN KEY (classifier_version_id) REFERENCES public.event_classifier_versions(id) ON DELETE RESTRICT;
|
|
4346
|
+
|
|
4347
|
+
|
|
4348
|
+
--
|
|
4349
|
+
-- Name: event_classifications event_classifications_event_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4350
|
+
--
|
|
4351
|
+
|
|
4352
|
+
ALTER TABLE ONLY public.event_classifications
|
|
4353
|
+
ADD CONSTRAINT event_classifications_event_id_fkey FOREIGN KEY (event_id) REFERENCES public.events(id) ON DELETE CASCADE;
|
|
4354
|
+
|
|
4355
|
+
|
|
4356
|
+
--
|
|
4357
|
+
-- Name: event_classifications event_classifications_insight_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4358
|
+
--
|
|
4359
|
+
|
|
4360
|
+
ALTER TABLE ONLY public.event_classifications
|
|
4361
|
+
ADD CONSTRAINT event_classifications_insight_id_fkey FOREIGN KEY (watcher_id) REFERENCES public.watchers(id) ON DELETE CASCADE;
|
|
4362
|
+
|
|
4363
|
+
|
|
4364
|
+
--
|
|
4365
|
+
-- Name: event_classifications event_classifications_window_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4366
|
+
--
|
|
4367
|
+
|
|
4368
|
+
ALTER TABLE ONLY public.event_classifications
|
|
4369
|
+
ADD CONSTRAINT event_classifications_window_id_fkey FOREIGN KEY (window_id) REFERENCES public.watcher_windows(id) ON DELETE CASCADE;
|
|
4370
|
+
|
|
4371
|
+
|
|
4372
|
+
--
|
|
4373
|
+
-- Name: event_classifier_versions event_classifier_versions_classifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4374
|
+
--
|
|
4375
|
+
|
|
4376
|
+
ALTER TABLE ONLY public.event_classifier_versions
|
|
4377
|
+
ADD CONSTRAINT event_classifier_versions_classifier_id_fkey FOREIGN KEY (classifier_id) REFERENCES public.event_classifiers(id) ON DELETE CASCADE;
|
|
4378
|
+
|
|
4379
|
+
|
|
4380
|
+
--
|
|
4381
|
+
-- Name: event_classifier_versions event_classifier_versions_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4382
|
+
--
|
|
4383
|
+
|
|
4384
|
+
ALTER TABLE ONLY public.event_classifier_versions
|
|
4385
|
+
ADD CONSTRAINT event_classifier_versions_created_by_fkey FOREIGN KEY (created_by) REFERENCES public."user"(id) ON DELETE RESTRICT;
|
|
4386
|
+
|
|
4387
|
+
|
|
4388
|
+
--
|
|
4389
|
+
-- Name: event_classifiers event_classifiers_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4390
|
+
--
|
|
4391
|
+
|
|
4392
|
+
ALTER TABLE ONLY public.event_classifiers
|
|
4393
|
+
ADD CONSTRAINT event_classifiers_created_by_fkey FOREIGN KEY (created_by) REFERENCES public."user"(id) ON DELETE RESTRICT;
|
|
4394
|
+
|
|
4395
|
+
|
|
4396
|
+
--
|
|
4397
|
+
-- Name: event_classifiers event_classifiers_insight_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4398
|
+
--
|
|
4399
|
+
|
|
4400
|
+
ALTER TABLE ONLY public.event_classifiers
|
|
4401
|
+
ADD CONSTRAINT event_classifiers_insight_id_fkey FOREIGN KEY (watcher_id) REFERENCES public.watchers(id) ON DELETE CASCADE;
|
|
4402
|
+
|
|
4403
|
+
|
|
4404
|
+
--
|
|
4405
|
+
-- Name: event_classifiers event_classifiers_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4406
|
+
--
|
|
4407
|
+
|
|
4408
|
+
ALTER TABLE ONLY public.event_classifiers
|
|
4409
|
+
ADD CONSTRAINT event_classifiers_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE CASCADE;
|
|
4410
|
+
|
|
4411
|
+
|
|
4412
|
+
--
|
|
4413
|
+
-- Name: events events_client_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4414
|
+
--
|
|
4415
|
+
|
|
4416
|
+
ALTER TABLE ONLY public.events
|
|
4417
|
+
ADD CONSTRAINT events_client_id_fkey FOREIGN KEY (client_id) REFERENCES public.oauth_clients(id);
|
|
4418
|
+
|
|
4419
|
+
|
|
4420
|
+
--
|
|
4421
|
+
-- Name: events events_connection_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4422
|
+
--
|
|
4423
|
+
|
|
4424
|
+
ALTER TABLE ONLY public.events
|
|
4425
|
+
ADD CONSTRAINT events_connection_id_fkey FOREIGN KEY (connection_id) REFERENCES public.connections(id) ON DELETE SET NULL;
|
|
4426
|
+
|
|
4427
|
+
|
|
4428
|
+
--
|
|
4429
|
+
-- Name: events events_feed_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4430
|
+
--
|
|
4431
|
+
|
|
4432
|
+
ALTER TABLE ONLY public.events
|
|
4433
|
+
ADD CONSTRAINT events_feed_id_fkey FOREIGN KEY (feed_id) REFERENCES public.feeds(id) ON DELETE SET NULL;
|
|
4434
|
+
|
|
4435
|
+
|
|
4436
|
+
--
|
|
4437
|
+
-- Name: event_embeddings event_embeddings_event_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4438
|
+
--
|
|
4439
|
+
|
|
4440
|
+
ALTER TABLE ONLY public.event_embeddings
|
|
4441
|
+
ADD CONSTRAINT event_embeddings_event_id_fkey FOREIGN KEY (event_id) REFERENCES public.events(id) ON DELETE CASCADE;
|
|
4442
|
+
|
|
4443
|
+
|
|
4444
|
+
--
|
|
4445
|
+
-- Name: events events_run_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4446
|
+
--
|
|
4447
|
+
|
|
4448
|
+
ALTER TABLE ONLY public.events
|
|
4449
|
+
ADD CONSTRAINT events_run_id_fkey FOREIGN KEY (run_id) REFERENCES public.runs(id) ON DELETE SET NULL;
|
|
4450
|
+
|
|
4451
|
+
|
|
4452
|
+
--
|
|
4453
|
+
-- Name: events events_supersedes_event_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4454
|
+
--
|
|
4455
|
+
|
|
4456
|
+
ALTER TABLE ONLY public.events
|
|
4457
|
+
ADD CONSTRAINT events_supersedes_event_id_fkey FOREIGN KEY (supersedes_event_id) REFERENCES public.events(id) ON DELETE SET NULL;
|
|
4458
|
+
|
|
4459
|
+
|
|
4460
|
+
--
|
|
4461
|
+
-- Name: feeds feeds_connection_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4462
|
+
--
|
|
4463
|
+
|
|
4464
|
+
ALTER TABLE ONLY public.feeds
|
|
4465
|
+
ADD CONSTRAINT feeds_connection_id_fkey FOREIGN KEY (connection_id) REFERENCES public.connections(id) ON DELETE CASCADE;
|
|
4466
|
+
|
|
4467
|
+
|
|
4468
|
+
--
|
|
4469
|
+
-- Name: feeds feeds_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4470
|
+
--
|
|
4471
|
+
|
|
4472
|
+
ALTER TABLE ONLY public.feeds
|
|
4473
|
+
ADD CONSTRAINT feeds_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE CASCADE;
|
|
4474
|
+
|
|
4475
|
+
|
|
4476
|
+
--
|
|
4477
|
+
-- Name: event_classifiers fk_event_classifiers_entity; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4478
|
+
--
|
|
4479
|
+
|
|
4480
|
+
ALTER TABLE ONLY public.event_classifiers
|
|
4481
|
+
ADD CONSTRAINT fk_event_classifiers_entity FOREIGN KEY (entity_id) REFERENCES public.entities(id) ON DELETE CASCADE;
|
|
4482
|
+
|
|
4483
|
+
|
|
4484
|
+
--
|
|
4485
|
+
-- Name: event_classifiers fk_event_classifiers_insight; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4486
|
+
--
|
|
4487
|
+
|
|
4488
|
+
ALTER TABLE ONLY public.event_classifiers
|
|
4489
|
+
ADD CONSTRAINT fk_event_classifiers_insight FOREIGN KEY (watcher_id) REFERENCES public.watchers(id) ON DELETE SET NULL;
|
|
4490
|
+
|
|
4491
|
+
|
|
4492
|
+
--
|
|
4493
|
+
-- Name: watcher_versions insight_template_versions_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4494
|
+
--
|
|
4495
|
+
|
|
4496
|
+
ALTER TABLE ONLY public.watcher_versions
|
|
4497
|
+
ADD CONSTRAINT insight_template_versions_created_by_fkey FOREIGN KEY (created_by) REFERENCES public."user"(id) ON DELETE RESTRICT;
|
|
4498
|
+
|
|
4499
|
+
|
|
4500
|
+
--
|
|
4501
|
+
-- Name: watcher_window_events insight_window_events_event_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4502
|
+
--
|
|
4503
|
+
|
|
4504
|
+
ALTER TABLE ONLY public.watcher_window_events
|
|
4505
|
+
ADD CONSTRAINT insight_window_events_event_id_fkey FOREIGN KEY (event_id) REFERENCES public.events(id) ON DELETE CASCADE;
|
|
4506
|
+
|
|
4507
|
+
|
|
4508
|
+
--
|
|
4509
|
+
-- Name: watcher_window_events insight_window_events_window_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4510
|
+
--
|
|
4511
|
+
|
|
4512
|
+
ALTER TABLE ONLY public.watcher_window_events
|
|
4513
|
+
ADD CONSTRAINT insight_window_events_window_id_fkey FOREIGN KEY (window_id) REFERENCES public.watcher_windows(id) ON DELETE CASCADE;
|
|
4514
|
+
|
|
4515
|
+
|
|
4516
|
+
--
|
|
4517
|
+
-- Name: watcher_windows insight_windows_insight_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4518
|
+
--
|
|
4519
|
+
|
|
4520
|
+
ALTER TABLE ONLY public.watcher_windows
|
|
4521
|
+
ADD CONSTRAINT insight_windows_insight_id_fkey FOREIGN KEY (watcher_id) REFERENCES public.watchers(id) ON DELETE CASCADE;
|
|
4522
|
+
|
|
4523
|
+
|
|
4524
|
+
--
|
|
4525
|
+
-- Name: watcher_windows insight_windows_parent_window_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4526
|
+
--
|
|
4527
|
+
|
|
4528
|
+
ALTER TABLE ONLY public.watcher_windows
|
|
4529
|
+
ADD CONSTRAINT insight_windows_parent_window_id_fkey FOREIGN KEY (parent_window_id) REFERENCES public.watcher_windows(id) ON DELETE CASCADE;
|
|
4530
|
+
|
|
4531
|
+
|
|
4532
|
+
--
|
|
4533
|
+
-- Name: watchers insights_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4534
|
+
--
|
|
4535
|
+
|
|
4536
|
+
ALTER TABLE ONLY public.watchers
|
|
4537
|
+
ADD CONSTRAINT insights_created_by_fkey FOREIGN KEY (created_by) REFERENCES public."user"(id) ON DELETE RESTRICT;
|
|
4538
|
+
|
|
4539
|
+
|
|
4540
|
+
--
|
|
4541
|
+
-- Name: invitation invitation_inviterId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4542
|
+
--
|
|
4543
|
+
|
|
4544
|
+
ALTER TABLE ONLY public.invitation
|
|
4545
|
+
ADD CONSTRAINT "invitation_inviterId_fkey" FOREIGN KEY ("inviterId") REFERENCES public."user"(id) ON DELETE SET NULL;
|
|
4546
|
+
|
|
4547
|
+
|
|
4548
|
+
--
|
|
4549
|
+
-- Name: invitation invitation_organizationId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4550
|
+
--
|
|
4551
|
+
|
|
4552
|
+
ALTER TABLE ONLY public.invitation
|
|
4553
|
+
ADD CONSTRAINT "invitation_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES public.organization(id) ON DELETE CASCADE;
|
|
4554
|
+
|
|
4555
|
+
|
|
4556
|
+
--
|
|
4557
|
+
-- Name: member member_organizationId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4558
|
+
--
|
|
4559
|
+
|
|
4560
|
+
ALTER TABLE ONLY public.member
|
|
4561
|
+
ADD CONSTRAINT "member_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES public.organization(id) ON DELETE CASCADE;
|
|
4562
|
+
|
|
4563
|
+
|
|
4564
|
+
--
|
|
4565
|
+
-- Name: member member_teamId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4566
|
+
--
|
|
4567
|
+
|
|
4568
|
+
ALTER TABLE ONLY public.member
|
|
4569
|
+
ADD CONSTRAINT "member_teamId_fkey" FOREIGN KEY ("teamId") REFERENCES public.team(id) ON DELETE SET NULL;
|
|
4570
|
+
|
|
4571
|
+
|
|
4572
|
+
--
|
|
4573
|
+
-- Name: member member_userId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4574
|
+
--
|
|
4575
|
+
|
|
4576
|
+
ALTER TABLE ONLY public.member
|
|
4577
|
+
ADD CONSTRAINT "member_userId_fkey" FOREIGN KEY ("userId") REFERENCES public."user"(id) ON DELETE CASCADE;
|
|
4578
|
+
|
|
4579
|
+
|
|
4580
|
+
--
|
|
4581
|
+
-- Name: oauth_authorization_codes oauth_authorization_codes_client_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4582
|
+
--
|
|
4583
|
+
|
|
4584
|
+
ALTER TABLE ONLY public.oauth_authorization_codes
|
|
4585
|
+
ADD CONSTRAINT oauth_authorization_codes_client_id_fkey FOREIGN KEY (client_id) REFERENCES public.oauth_clients(id) ON DELETE CASCADE;
|
|
4586
|
+
|
|
4587
|
+
|
|
4588
|
+
--
|
|
4589
|
+
-- Name: oauth_authorization_codes oauth_authorization_codes_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4590
|
+
--
|
|
4591
|
+
|
|
4592
|
+
ALTER TABLE ONLY public.oauth_authorization_codes
|
|
4593
|
+
ADD CONSTRAINT oauth_authorization_codes_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE SET NULL;
|
|
4594
|
+
|
|
4595
|
+
|
|
4596
|
+
--
|
|
4597
|
+
-- Name: oauth_authorization_codes oauth_authorization_codes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4598
|
+
--
|
|
4599
|
+
|
|
4600
|
+
ALTER TABLE ONLY public.oauth_authorization_codes
|
|
4601
|
+
ADD CONSTRAINT oauth_authorization_codes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE CASCADE;
|
|
4602
|
+
|
|
4603
|
+
|
|
4604
|
+
--
|
|
4605
|
+
-- Name: oauth_clients oauth_clients_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4606
|
+
--
|
|
4607
|
+
|
|
4608
|
+
ALTER TABLE ONLY public.oauth_clients
|
|
4609
|
+
ADD CONSTRAINT oauth_clients_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE CASCADE;
|
|
4610
|
+
|
|
4611
|
+
|
|
4612
|
+
--
|
|
4613
|
+
-- Name: oauth_clients oauth_clients_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4614
|
+
--
|
|
4615
|
+
|
|
4616
|
+
ALTER TABLE ONLY public.oauth_clients
|
|
4617
|
+
ADD CONSTRAINT oauth_clients_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE CASCADE;
|
|
4618
|
+
|
|
4619
|
+
|
|
4620
|
+
--
|
|
4621
|
+
-- Name: oauth_device_codes oauth_device_codes_client_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4622
|
+
--
|
|
4623
|
+
|
|
4624
|
+
ALTER TABLE ONLY public.oauth_device_codes
|
|
4625
|
+
ADD CONSTRAINT oauth_device_codes_client_id_fkey FOREIGN KEY (client_id) REFERENCES public.oauth_clients(id) ON DELETE CASCADE;
|
|
4626
|
+
|
|
4627
|
+
|
|
4628
|
+
--
|
|
4629
|
+
-- Name: oauth_device_codes oauth_device_codes_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4630
|
+
--
|
|
4631
|
+
|
|
4632
|
+
ALTER TABLE ONLY public.oauth_device_codes
|
|
4633
|
+
ADD CONSTRAINT oauth_device_codes_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE SET NULL;
|
|
4634
|
+
|
|
4635
|
+
|
|
4636
|
+
--
|
|
4637
|
+
-- Name: oauth_device_codes oauth_device_codes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4638
|
+
--
|
|
4639
|
+
|
|
4640
|
+
ALTER TABLE ONLY public.oauth_device_codes
|
|
4641
|
+
ADD CONSTRAINT oauth_device_codes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE CASCADE;
|
|
4642
|
+
|
|
4643
|
+
|
|
4644
|
+
--
|
|
4645
|
+
-- Name: oauth_tokens oauth_tokens_client_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4646
|
+
--
|
|
4647
|
+
|
|
4648
|
+
ALTER TABLE ONLY public.oauth_tokens
|
|
4649
|
+
ADD CONSTRAINT oauth_tokens_client_id_fkey FOREIGN KEY (client_id) REFERENCES public.oauth_clients(id) ON DELETE CASCADE;
|
|
4650
|
+
|
|
4651
|
+
|
|
4652
|
+
--
|
|
4653
|
+
-- Name: oauth_tokens oauth_tokens_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4654
|
+
--
|
|
4655
|
+
|
|
4656
|
+
ALTER TABLE ONLY public.oauth_tokens
|
|
4657
|
+
ADD CONSTRAINT oauth_tokens_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE SET NULL;
|
|
4658
|
+
|
|
4659
|
+
|
|
4660
|
+
--
|
|
4661
|
+
-- Name: oauth_tokens oauth_tokens_parent_token_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4662
|
+
--
|
|
4663
|
+
|
|
4664
|
+
ALTER TABLE ONLY public.oauth_tokens
|
|
4665
|
+
ADD CONSTRAINT oauth_tokens_parent_token_id_fkey FOREIGN KEY (parent_token_id) REFERENCES public.oauth_tokens(id) ON DELETE SET NULL;
|
|
4666
|
+
|
|
4667
|
+
|
|
4668
|
+
--
|
|
4669
|
+
-- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4670
|
+
--
|
|
4671
|
+
|
|
4672
|
+
ALTER TABLE ONLY public.oauth_tokens
|
|
4673
|
+
ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE CASCADE;
|
|
4674
|
+
|
|
4675
|
+
|
|
4676
|
+
--
|
|
4677
|
+
-- Name: organization_lobu_links organization_lobu_links_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4678
|
+
--
|
|
4679
|
+
|
|
4680
|
+
ALTER TABLE ONLY public.organization_lobu_links
|
|
4681
|
+
ADD CONSTRAINT organization_lobu_links_created_by_fkey FOREIGN KEY (created_by) REFERENCES public."user"(id) ON DELETE SET NULL;
|
|
4682
|
+
|
|
4683
|
+
|
|
4684
|
+
--
|
|
4685
|
+
-- Name: organization_lobu_links organization_lobu_links_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4686
|
+
--
|
|
4687
|
+
|
|
4688
|
+
ALTER TABLE ONLY public.organization_lobu_links
|
|
4689
|
+
ADD CONSTRAINT organization_lobu_links_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE CASCADE;
|
|
4690
|
+
|
|
4691
|
+
|
|
4692
|
+
--
|
|
4693
|
+
-- Name: personal_access_tokens personal_access_tokens_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4694
|
+
--
|
|
4695
|
+
|
|
4696
|
+
ALTER TABLE ONLY public.personal_access_tokens
|
|
4697
|
+
ADD CONSTRAINT personal_access_tokens_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE SET NULL;
|
|
4698
|
+
|
|
4699
|
+
|
|
4700
|
+
--
|
|
4701
|
+
-- Name: personal_access_tokens personal_access_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4702
|
+
--
|
|
4703
|
+
|
|
4704
|
+
ALTER TABLE ONLY public.personal_access_tokens
|
|
4705
|
+
ADD CONSTRAINT personal_access_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE CASCADE;
|
|
4706
|
+
|
|
4707
|
+
|
|
4708
|
+
--
|
|
4709
|
+
-- Name: runs runs_connection_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4710
|
+
--
|
|
4711
|
+
|
|
4712
|
+
ALTER TABLE ONLY public.runs
|
|
4713
|
+
ADD CONSTRAINT runs_connection_id_fkey FOREIGN KEY (connection_id) REFERENCES public.connections(id) ON DELETE SET NULL;
|
|
4714
|
+
|
|
4715
|
+
|
|
4716
|
+
--
|
|
4717
|
+
-- Name: runs runs_feed_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4718
|
+
--
|
|
4719
|
+
|
|
4720
|
+
ALTER TABLE ONLY public.runs
|
|
4721
|
+
ADD CONSTRAINT runs_feed_id_fkey FOREIGN KEY (feed_id) REFERENCES public.feeds(id) ON DELETE SET NULL;
|
|
4722
|
+
|
|
4723
|
+
|
|
4724
|
+
--
|
|
4725
|
+
-- Name: runs runs_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4726
|
+
--
|
|
4727
|
+
|
|
4728
|
+
ALTER TABLE ONLY public.runs
|
|
4729
|
+
ADD CONSTRAINT runs_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE CASCADE;
|
|
4730
|
+
|
|
4731
|
+
|
|
4732
|
+
--
|
|
4733
|
+
-- Name: runs runs_watcher_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4734
|
+
--
|
|
4735
|
+
|
|
4736
|
+
ALTER TABLE ONLY public.runs
|
|
4737
|
+
ADD CONSTRAINT runs_watcher_id_fkey FOREIGN KEY (watcher_id) REFERENCES public.watchers(id) ON DELETE SET NULL;
|
|
4738
|
+
|
|
4739
|
+
|
|
4740
|
+
--
|
|
4741
|
+
-- Name: runs runs_window_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4742
|
+
--
|
|
4743
|
+
|
|
4744
|
+
ALTER TABLE ONLY public.runs
|
|
4745
|
+
ADD CONSTRAINT runs_window_id_fkey FOREIGN KEY (window_id) REFERENCES public.watcher_windows(id) ON DELETE SET NULL;
|
|
4746
|
+
|
|
4747
|
+
|
|
4748
|
+
--
|
|
4749
|
+
-- Name: session session_activeOrganizationId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4750
|
+
--
|
|
4751
|
+
|
|
4752
|
+
ALTER TABLE ONLY public.session
|
|
4753
|
+
ADD CONSTRAINT "session_activeOrganizationId_fkey" FOREIGN KEY ("activeOrganizationId") REFERENCES public.organization(id) ON DELETE SET NULL;
|
|
4754
|
+
|
|
4755
|
+
|
|
4756
|
+
--
|
|
4757
|
+
-- Name: session session_userId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4758
|
+
--
|
|
4759
|
+
|
|
4760
|
+
ALTER TABLE ONLY public.session
|
|
4761
|
+
ADD CONSTRAINT "session_userId_fkey" FOREIGN KEY ("userId") REFERENCES public."user"(id) ON DELETE CASCADE;
|
|
4762
|
+
|
|
4763
|
+
|
|
4764
|
+
--
|
|
4765
|
+
-- Name: team team_organizationId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4766
|
+
--
|
|
4767
|
+
|
|
4768
|
+
ALTER TABLE ONLY public.team
|
|
4769
|
+
ADD CONSTRAINT "team_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES public.organization(id) ON DELETE CASCADE;
|
|
4770
|
+
|
|
4771
|
+
|
|
4772
|
+
--
|
|
4773
|
+
-- Name: view_template_active_tabs view_template_active_tabs_version_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4774
|
+
--
|
|
4775
|
+
|
|
4776
|
+
ALTER TABLE ONLY public.view_template_active_tabs
|
|
4777
|
+
ADD CONSTRAINT view_template_active_tabs_version_fk FOREIGN KEY (current_version_id) REFERENCES public.view_template_versions(id);
|
|
4778
|
+
|
|
4779
|
+
|
|
4780
|
+
--
|
|
4781
|
+
-- Name: watcher_reactions watcher_reactions_watcher_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4782
|
+
--
|
|
4783
|
+
|
|
4784
|
+
ALTER TABLE ONLY public.watcher_reactions
|
|
4785
|
+
ADD CONSTRAINT watcher_reactions_watcher_id_fkey FOREIGN KEY (watcher_id) REFERENCES public.watchers(id) ON DELETE CASCADE;
|
|
4786
|
+
|
|
4787
|
+
|
|
4788
|
+
--
|
|
4789
|
+
-- Name: watcher_reactions watcher_reactions_window_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4790
|
+
--
|
|
4791
|
+
|
|
4792
|
+
ALTER TABLE ONLY public.watcher_reactions
|
|
4793
|
+
ADD CONSTRAINT watcher_reactions_window_id_fkey FOREIGN KEY (window_id) REFERENCES public.watcher_windows(id) ON DELETE CASCADE;
|
|
4794
|
+
|
|
4795
|
+
|
|
4796
|
+
--
|
|
4797
|
+
-- Name: watcher_versions watcher_versions_watcher_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4798
|
+
--
|
|
4799
|
+
|
|
4800
|
+
ALTER TABLE ONLY public.watcher_versions
|
|
4801
|
+
ADD CONSTRAINT watcher_versions_watcher_id_fkey FOREIGN KEY (watcher_id) REFERENCES public.watchers(id) ON DELETE CASCADE;
|
|
4802
|
+
|
|
4803
|
+
|
|
4804
|
+
--
|
|
4805
|
+
-- Name: watcher_windows watcher_windows_version_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4806
|
+
--
|
|
4807
|
+
|
|
4808
|
+
ALTER TABLE ONLY public.watcher_windows
|
|
4809
|
+
ADD CONSTRAINT watcher_windows_version_id_fkey FOREIGN KEY (version_id) REFERENCES public.watcher_versions(id);
|
|
4810
|
+
|
|
4811
|
+
|
|
4812
|
+
--
|
|
4813
|
+
-- Name: watchers watchers_current_version_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4814
|
+
--
|
|
4815
|
+
|
|
4816
|
+
ALTER TABLE ONLY public.watchers
|
|
4817
|
+
ADD CONSTRAINT watchers_current_version_id_fkey FOREIGN KEY (current_version_id) REFERENCES public.watcher_versions(id) ON DELETE SET NULL;
|
|
4818
|
+
|
|
4819
|
+
|
|
4820
|
+
--
|
|
4821
|
+
-- Name: workers workers_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4822
|
+
--
|
|
4823
|
+
|
|
4824
|
+
ALTER TABLE ONLY public.workers
|
|
4825
|
+
ADD CONSTRAINT workers_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id);
|
|
4826
|
+
|
|
4827
|
+
|
|
4828
|
+
--
|
|
4829
|
+
-- Name: workspace_settings workspace_settings_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
4830
|
+
--
|
|
4831
|
+
|
|
4832
|
+
ALTER TABLE ONLY public.workspace_settings
|
|
4833
|
+
ADD CONSTRAINT workspace_settings_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id) ON DELETE CASCADE;
|
|
4834
|
+
|
|
4835
|
+
|
|
4836
|
+
--
|
|
4837
|
+
-- PostgreSQL database dump complete
|
|
4838
|
+
--
|
|
4839
|
+
|
|
4840
|
+
|
|
4841
|
+
|
|
4842
|
+
--
|
|
4843
|
+
|
|
4844
|
+
|
|
4845
|
+
--
|
|
4846
|
+
-- Name: watcher_window_feedback; Type: TABLE; Schema: public; Owner: -
|
|
4847
|
+
--
|
|
4848
|
+
|
|
4849
|
+
CREATE TABLE IF NOT EXISTS public.watcher_window_feedback (
|
|
4850
|
+
id bigserial PRIMARY KEY,
|
|
4851
|
+
window_id integer NOT NULL REFERENCES public.watcher_windows(id) ON DELETE CASCADE,
|
|
4852
|
+
watcher_id integer NOT NULL REFERENCES public.watchers(id) ON DELETE CASCADE,
|
|
4853
|
+
organization_id text NOT NULL,
|
|
4854
|
+
corrections jsonb NOT NULL,
|
|
4855
|
+
notes text,
|
|
4856
|
+
created_by text NOT NULL,
|
|
4857
|
+
created_at timestamp with time zone DEFAULT now() NOT NULL
|
|
4858
|
+
);
|
|
4859
|
+
|
|
4860
|
+
CREATE INDEX IF NOT EXISTS idx_wwf_window ON public.watcher_window_feedback(window_id);
|
|
4861
|
+
CREATE INDEX IF NOT EXISTS idx_wwf_watcher ON public.watcher_window_feedback(watcher_id);
|
|
4862
|
+
|
|
4863
|
+
|
|
4864
|
+
-- migrate:down
|
|
4865
|
+
|
|
4866
|
+
DROP SCHEMA public CASCADE;
|
|
4867
|
+
CREATE SCHEMA public;
|