From dd76edfb6b86440684619864f9135ca2dbb38e78 Mon Sep 17 00:00:00 2001 From: Oleksandr Tsurenko Date: Thu, 10 Sep 2026 20:06:26 +0200 Subject: [PATCH] fix: KEEP-1346 index the digest's sponsored-tx count The execution digest counts sponsored step runs per organization. That query is cancelled by the statement timeout on prod, so the affected organizations get no digest email at all. It fails silently: the CronJob still exits 0 and the only trace is an errors.external.service.total metric with error_context ExecutionDigest. Measured on prod 2026-09-10 with EXPLAIN (ANALYZE, BUFFERS) over a single-day window: 25.3 s, 116,611 blocks read (~911 MB), to return 48 rows. The plan nested-loops from workflows to workflow_executions to workflow_execution_logs and applies `output_raw ->> 'sponsored' = 'true'` as a filter on every log row of every execution in the window. output_raw is TOASTed jsonb, so each of the 13,783 loops de-TOASTs about 10 rows and then discards all of them. That one node holds 73.6 s of the 73.7 s total I/O time. A higher timeout is not the fix. The same query was cancelled at 128.9 s under the old 120 s cap during the 2026-09-04 analytics storm, and at ~30 s under the 30 s app-pool bound on 09-06 and 09-08. Quiet it needs 25 s, contended it needs more than 129 s, so any fixed cap is a guess, and a higher one only licenses a ~900 MB read during the exact contention window where it does the most damage. Add a partial index keyed to the join column, the same shape as the existing idx_exec_logs_gas_started_at. Sampling prod puts sponsored rows at about 0.1% of the table, so the index is a couple of MB against the 453 MB plain execution_id index. jsonb ->> text is jsonb_object_field_text, which is IMMUTABLE, so the predicate is legal in an index. workflow_execution_logs is ~65 GB on prod, so the migration carries @requires-db-prep and an operator builds the index CONCURRENTLY out of band. --- ...153_keep_1346_exec_log_sponsored_index.sql | 36 + drizzle/meta/0153_snapshot.json | 9148 +++++++++++++++++ drizzle/meta/_journal.json | 7 + lib/db/schema.ts | 11 + 4 files changed, 9202 insertions(+) create mode 100644 drizzle/0153_keep_1346_exec_log_sponsored_index.sql create mode 100644 drizzle/meta/0153_snapshot.json diff --git a/drizzle/0153_keep_1346_exec_log_sponsored_index.sql b/drizzle/0153_keep_1346_exec_log_sponsored_index.sql new file mode 100644 index 000000000..3779a9084 --- /dev/null +++ b/drizzle/0153_keep_1346_exec_log_sponsored_index.sql @@ -0,0 +1,36 @@ +-- @requires-db-prep +-- KEEP-1346: supporting index for the execution digest's sponsored-tx count. +-- +-- buildDigestStats counts sponsored step runs for one organization over the +-- digest window (lib/notifications/execution-digest.ts). It nested-loops from +-- workflows to workflow_executions to workflow_execution_logs, and the inner +-- probe applies `output_raw ->> 'sponsored' = 'true'` as a filter on every log +-- row belonging to every execution in the window. +-- +-- output_raw is TOASTed jsonb, so that filter de-TOASTs each candidate row and +-- then discards nearly all of them. Measured on prod 2026-09-10 with +-- EXPLAIN (ANALYZE, BUFFERS) over a single-day window: 13,783 loops, ~10 rows +-- de-TOASTed and rejected per loop, 116,611 blocks read (~911 MB), 25.3 s, to +-- return 48 rows. 73.6 s of the 73.7 s total I/O time sat in that one node. +-- The same query was cancelled at 128.9 s under the old 120 s cap on +-- 2026-09-04 and at ~30 s under the 30 s app-pool bound on 2026-09-06 and +-- 2026-09-08, so the digest silently did not go out for those organizations. +-- +-- Sponsored step rows are a small fraction of all log rows, so a partial index +-- keyed to the join column turns the inner probe into an index lookup that +-- reaches the heap only for rows that actually match. `jsonb ->> text` is +-- jsonb_object_field_text, which is IMMUTABLE, so it is legal in an index +-- predicate (checked against prod pg_proc.provolatile). +-- +-- The predicate is written exactly as drizzle emits it from the schema +-- declaration, and the query emits the same shape. Postgres only uses a +-- partial index when it can match the query clause to the index predicate, so +-- the two must not drift apart. +-- +-- DB-PREP: on prod/staging an operator applies this CONCURRENTLY out-of-band +-- (`CREATE INDEX CONCURRENTLY IF NOT EXISTS ...`) before merge, so the plain +-- statement below is a no-op there (IF NOT EXISTS). workflow_execution_logs is +-- ~65 GB on prod, so a plain in-migration build would hold an ACCESS EXCLUSIVE +-- lock for minutes during deploy. On dev / PR-env DBs the table is small, so +-- the plain build is fine. +CREATE INDEX IF NOT EXISTS "idx_exec_logs_sponsored_execution" ON "workflow_execution_logs" USING btree ("execution_id") WHERE "workflow_execution_logs"."output_raw" ->> 'sponsored' = 'true'; diff --git a/drizzle/meta/0153_snapshot.json b/drizzle/meta/0153_snapshot.json new file mode 100644 index 000000000..537437c69 --- /dev/null +++ b/drizzle/meta/0153_snapshot.json @@ -0,0 +1,9148 @@ +{ + "id": "72dcde6c-115e-478e-96c0-deaed0a57f44", + "prevId": "135cb20e-6d81-43c3-9736-d3a9363bc892", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.accounts": { + "name": "accounts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "issuer": { + "name": "issuer", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "idx_accounts_user_id": { + "name": "idx_accounts_user_id", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "accounts_user_id_users_id_fk": { + "name": "accounts_user_id_users_id_fk", + "tableFrom": "accounts", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.address_book_entry": { + "name": "address_book_entry", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "idx_address_book_org": { + "name": "idx_address_book_org", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_address_book_org_address": { + "name": "idx_address_book_org_address", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "address", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "address_book_entry_organization_id_organization_id_fk": { + "name": "address_book_entry_organization_id_organization_id_fk", + "tableFrom": "address_book_entry", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "address_book_entry_created_by_users_id_fk": { + "name": "address_book_entry_created_by_users_id_fk", + "tableFrom": "address_book_entry", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agent_registrations": { + "name": "agent_registrations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "agent_id": { + "name": "agent_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tx_hash": { + "name": "tx_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "registered_at": { + "name": "registered_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "chain_id": { + "name": "chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "registry_address": { + "name": "registry_address", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agentic_wallet_credits": { + "name": "agentic_wallet_credits", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "sub_org_id": { + "name": "sub_org_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "amount_usdc_cents": { + "name": "amount_usdc_cents", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "allocation_reason": { + "name": "allocation_reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'onboard_initial'" + }, + "granted_at": { + "name": "granted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_agentic_wallet_credits_sub_org": { + "name": "idx_agentic_wallet_credits_sub_org", + "columns": [ + { + "expression": "sub_org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "uq_agentic_wallet_credits_sub_org_reason": { + "name": "uq_agentic_wallet_credits_sub_org_reason", + "columns": [ + { + "expression": "sub_org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "allocation_reason", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "agentic_wallet_credits_sub_org_id_agentic_wallets_sub_org_id_fk": { + "name": "agentic_wallet_credits_sub_org_id_agentic_wallets_sub_org_id_fk", + "tableFrom": "agentic_wallet_credits", + "tableTo": "agentic_wallets", + "columnsFrom": [ + "sub_org_id" + ], + "columnsTo": [ + "sub_org_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agentic_wallet_daily_spend": { + "name": "agentic_wallet_daily_spend", + "schema": "", + "columns": { + "sub_org_id": { + "name": "sub_org_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "day_utc": { + "name": "day_utc", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "spent_micros": { + "name": "spent_micros", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": "0" + } + }, + "indexes": { + "idx_agentic_wallet_daily_spend_day": { + "name": "idx_agentic_wallet_daily_spend_day", + "columns": [ + { + "expression": "day_utc", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "agentic_wallet_daily_spend_sub_org_id_agentic_wallets_sub_org_id_fk": { + "name": "agentic_wallet_daily_spend_sub_org_id_agentic_wallets_sub_org_id_fk", + "tableFrom": "agentic_wallet_daily_spend", + "tableTo": "agentic_wallets", + "columnsFrom": [ + "sub_org_id" + ], + "columnsTo": [ + "sub_org_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "agentic_wallet_daily_spend_sub_org_id_day_utc_pk": { + "name": "agentic_wallet_daily_spend_sub_org_id_day_utc_pk", + "columns": [ + "sub_org_id", + "day_utc" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agentic_wallet_hmac_secrets": { + "name": "agentic_wallet_hmac_secrets", + "schema": "", + "columns": { + "sub_org_id": { + "name": "sub_org_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_version": { + "name": "key_version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "secret_ciphertext": { + "name": "secret_ciphertext", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "agentic_wallet_hmac_secrets_sub_org_id_agentic_wallets_sub_org_id_fk": { + "name": "agentic_wallet_hmac_secrets_sub_org_id_agentic_wallets_sub_org_id_fk", + "tableFrom": "agentic_wallet_hmac_secrets", + "tableTo": "agentic_wallets", + "columnsFrom": [ + "sub_org_id" + ], + "columnsTo": [ + "sub_org_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "agentic_wallet_hmac_secrets_sub_org_id_key_version_pk": { + "name": "agentic_wallet_hmac_secrets_sub_org_id_key_version_pk", + "columns": [ + "sub_org_id", + "key_version" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agentic_wallet_rate_limits": { + "name": "agentic_wallet_rate_limits", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "bucket_start": { + "name": "bucket_start", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "request_count": { + "name": "request_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "idx_agentic_wallet_rate_limits_bucket": { + "name": "idx_agentic_wallet_rate_limits_bucket", + "columns": [ + { + "expression": "bucket_start", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "agentic_wallet_rate_limits_key_bucket_start_pk": { + "name": "agentic_wallet_rate_limits_key_bucket_start_pk", + "columns": [ + "key", + "bucket_start" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agentic_wallets": { + "name": "agentic_wallets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "sub_org_id": { + "name": "sub_org_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "wallet_address_base": { + "name": "wallet_address_base", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "wallet_address_tempo": { + "name": "wallet_address_tempo", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "hmac_secret": { + "name": "hmac_secret", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "linked_user_id": { + "name": "linked_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "linked_at": { + "name": "linked_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_agentic_wallets_linked_user": { + "name": "idx_agentic_wallets_linked_user", + "columns": [ + { + "expression": "linked_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_agentic_wallets_wallet_base": { + "name": "idx_agentic_wallets_wallet_base", + "columns": [ + { + "expression": "wallet_address_base", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_agentic_wallets_wallet_tempo": { + "name": "idx_agentic_wallets_wallet_tempo", + "columns": [ + { + "expression": "wallet_address_tempo", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "agentic_wallets_linked_user_id_users_id_fk": { + "name": "agentic_wallets_linked_user_id_users_id_fk", + "tableFrom": "agentic_wallets", + "tableTo": "users", + "columnsFrom": [ + "linked_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "agentic_wallets_sub_org_id_unique": { + "name": "agentic_wallets_sub_org_id_unique", + "nullsNotDistinct": false, + "columns": [ + "sub_org_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.api_keys": { + "name": "api_keys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_prefix": { + "name": "key_prefix", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "api_keys_user_id_users_id_fk": { + "name": "api_keys_user_id_users_id_fk", + "tableFrom": "api_keys", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.beta_access_requests": { + "name": "beta_access_requests", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.billing_events": { + "name": "billing_events", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "provider_event_id": { + "name": "provider_event_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "processed": { + "name": "processed", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "billing_events_provider_event_id_unique": { + "name": "billing_events_provider_event_id_unique", + "nullsNotDistinct": false, + "columns": [ + "provider_event_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.chains": { + "name": "chains", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "chain_id": { + "name": "chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "symbol": { + "name": "symbol", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "aliases": { + "name": "aliases", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "is_payment_rail": { + "name": "is_payment_rail", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "chain_type": { + "name": "chain_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'evm'" + }, + "default_primary_rpc": { + "name": "default_primary_rpc", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "default_fallback_rpc": { + "name": "default_fallback_rpc", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "default_primary_wss": { + "name": "default_primary_wss", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "default_fallback_wss": { + "name": "default_fallback_wss", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "use_private_mempool_rpc": { + "name": "use_private_mempool_rpc", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "default_private_rpc_url": { + "name": "default_private_rpc_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_testnet": { + "name": "is_testnet", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_enabled": { + "name": "is_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'stable'" + }, + "gas_config": { + "name": "gas_config", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'::jsonb" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_chains_chain_id": { + "name": "idx_chains_chain_id", + "columns": [ + { + "expression": "chain_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "chains_chain_id_unique": { + "name": "chains_chain_id_unique", + "nullsNotDistinct": false, + "columns": [ + "chain_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.device_code": { + "name": "device_code", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "device_code": { + "name": "device_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_code": { + "name": "user_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "last_polled_at": { + "name": "last_polled_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "polling_interval": { + "name": "polling_interval", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "device_code_user_id_users_id_fk": { + "name": "device_code_user_id_users_id_fk", + "tableFrom": "device_code", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.direct_executions": { + "name": "direct_executions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "api_key_id": { + "name": "api_key_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "input": { + "name": "input", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "output": { + "name": "output", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "transaction_hash": { + "name": "transaction_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "receipts": { + "name": "receipts", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "network": { + "name": "network", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "gas_used_wei": { + "name": "gas_used_wei", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "gas_price_wei": { + "name": "gas_price_wei", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "value_wei": { + "name": "value_wei", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "value_lamports": { + "name": "value_lamports", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estimated_cost_usd": { + "name": "estimated_cost_usd", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "idx_direct_executions_org": { + "name": "idx_direct_executions_org", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_direct_executions_status": { + "name": "idx_direct_executions_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "direct_executions_organization_id_organization_id_fk": { + "name": "direct_executions_organization_id_organization_id_fk", + "tableFrom": "direct_executions", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.execution_debt": { + "name": "execution_debt", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "overage_record_id": { + "name": "overage_record_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_invoice_id": { + "name": "provider_invoice_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "debt_executions": { + "name": "debt_executions", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "enforced_at": { + "name": "enforced_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "cleared_at": { + "name": "cleared_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_execution_debt_org_status": { + "name": "idx_execution_debt_org_status", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_execution_debt_invoice": { + "name": "idx_execution_debt_invoice", + "columns": [ + { + "expression": "provider_invoice_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "execution_debt_organization_id_organization_id_fk": { + "name": "execution_debt_organization_id_organization_id_fk", + "tableFrom": "execution_debt", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "execution_debt_overage_record_id_overage_billing_records_id_fk": { + "name": "execution_debt_overage_record_id_overage_billing_records_id_fk", + "tableFrom": "execution_debt", + "tableTo": "overage_billing_records", + "columnsFrom": [ + "overage_record_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "execution_debt_overage_record_id_unique": { + "name": "execution_debt_overage_record_id_unique", + "nullsNotDistinct": false, + "columns": [ + "overage_record_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.execution_quota_notifications": { + "name": "execution_quota_notifications", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "period_start": { + "name": "period_start", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "threshold": { + "name": "threshold", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "usage_percent": { + "name": "usage_percent", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "executions_used": { + "name": "executions_used", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "execution_limit": { + "name": "execution_limit", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "recipient_count": { + "name": "recipient_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "notified_at": { + "name": "notified_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_execution_quota_notif_org": { + "name": "idx_execution_quota_notif_org", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "execution_quota_notif_org_fk": { + "name": "execution_quota_notif_org_fk", + "tableFrom": "execution_quota_notifications", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "execution_quota_notif_org_period_threshold": { + "name": "execution_quota_notif_org_period_threshold", + "nullsNotDistinct": false, + "columns": [ + "organization_id", + "period_start", + "threshold" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.explorer_configs": { + "name": "explorer_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "chain_id": { + "name": "chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "chain_type": { + "name": "chain_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'evm'" + }, + "explorer_url": { + "name": "explorer_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "explorer_api_type": { + "name": "explorer_api_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "explorer_api_url": { + "name": "explorer_api_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "backup_explorer_api_type": { + "name": "backup_explorer_api_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "backup_explorer_api_url": { + "name": "backup_explorer_api_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "backup_explorer_api_key_needed": { + "name": "backup_explorer_api_key_needed", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "backup_explorer_api_key": { + "name": "backup_explorer_api_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "backup_explorer_url": { + "name": "backup_explorer_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "backup_explorer_tx_path": { + "name": "backup_explorer_tx_path", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "backup_explorer_address_path": { + "name": "backup_explorer_address_path", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "backup_explorer_contract_path": { + "name": "backup_explorer_contract_path", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "explorer_tx_path": { + "name": "explorer_tx_path", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'/tx/{hash}'" + }, + "explorer_address_path": { + "name": "explorer_address_path", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'/address/{address}'" + }, + "explorer_contract_path": { + "name": "explorer_contract_path", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_explorer_configs_chain_id": { + "name": "idx_explorer_configs_chain_id", + "columns": [ + { + "expression": "chain_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "explorer_configs_chain_id_chains_chain_id_fk": { + "name": "explorer_configs_chain_id_chains_chain_id_fk", + "tableFrom": "explorer_configs", + "tableTo": "chains", + "columnsFrom": [ + "chain_id" + ], + "columnsTo": [ + "chain_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "explorer_configs_chain_id_unique": { + "name": "explorer_configs_chain_id_unique", + "nullsNotDistinct": false, + "columns": [ + "chain_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.feedback": { + "name": "feedback", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "agent_registry": { + "name": "agent_registry", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'erc-8004'" + }, + "agent_chain_id": { + "name": "agent_chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "agent_id": { + "name": "agent_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "payer_wallet": { + "name": "payer_wallet", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value_decimals": { + "name": "value_decimals", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "feedback_hash": { + "name": "feedback_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tx_chain_id": { + "name": "tx_chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tx_hash": { + "name": "tx_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "feedback_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "broadcast_at": { + "name": "broadcast_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "idx_feedback_execution": { + "name": "idx_feedback_execution", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_feedback_payer": { + "name": "idx_feedback_payer", + "columns": [ + { + "expression": "payer_wallet", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_feedback_agent": { + "name": "idx_feedback_agent", + "columns": [ + { + "expression": "agent_registry", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "agent_chain_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "agent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_feedback_status": { + "name": "idx_feedback_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "feedback_execution_id_workflow_executions_id_fk": { + "name": "feedback_execution_id_workflow_executions_id_fk", + "tableFrom": "feedback", + "tableTo": "workflow_executions", + "columnsFrom": [ + "execution_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "feedback_workflow_id_workflows_id_fk": { + "name": "feedback_workflow_id_workflows_id_fk", + "tableFrom": "feedback", + "tableTo": "workflows", + "columnsFrom": [ + "workflow_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.gas_credit_allocations": { + "name": "gas_credit_allocations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "period_start": { + "name": "period_start", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "allocated_cents": { + "name": "allocated_cents", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_gas_credit_alloc_org": { + "name": "idx_gas_credit_alloc_org", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "gas_credit_allocations_organization_id_organization_id_fk": { + "name": "gas_credit_allocations_organization_id_organization_id_fk", + "tableFrom": "gas_credit_allocations", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "gas_credit_alloc_org_period": { + "name": "gas_credit_alloc_org_period", + "nullsNotDistinct": false, + "columns": [ + "organization_id", + "period_start" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.gas_credit_usage": { + "name": "gas_credit_usage", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chain_id": { + "name": "chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tx_hash": { + "name": "tx_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "gas_used": { + "name": "gas_used", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "gas_price_wei": { + "name": "gas_price_wei", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "gas_cost_wei": { + "name": "gas_cost_wei", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "gas_cost_micro_usd": { + "name": "gas_cost_micro_usd", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "eth_price_usd": { + "name": "eth_price_usd", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_gas_usage_org_created": { + "name": "idx_gas_usage_org_created", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "gas_credit_usage_organization_id_organization_id_fk": { + "name": "gas_credit_usage_organization_id_organization_id_fk", + "tableFrom": "gas_credit_usage", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "gas_usage_org_tx": { + "name": "gas_usage_org_tx", + "nullsNotDistinct": false, + "columns": [ + "organization_id", + "tx_hash" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.gas_sponsorship_delegations": { + "name": "gas_sponsorship_delegations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "wallet_address": { + "name": "wallet_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chain_id": { + "name": "chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "delegation_tx_hash": { + "name": "delegation_tx_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "implementation_address": { + "name": "implementation_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "delegated_at": { + "name": "delegated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_gas_delegation_org": { + "name": "idx_gas_delegation_org", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "gas_sponsorship_delegations_organization_id_organization_id_fk": { + "name": "gas_sponsorship_delegations_organization_id_organization_id_fk", + "tableFrom": "gas_sponsorship_delegations", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "gas_delegation_org_chain": { + "name": "gas_delegation_org_chain", + "nullsNotDistinct": false, + "columns": [ + "organization_id", + "chain_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.gas_sponsorship_monthly": { + "name": "gas_sponsorship_monthly", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chain_id": { + "name": "chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "month_start": { + "name": "month_start", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "sponsored_wei": { + "name": "sponsored_wei", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sponsored_micro_usd": { + "name": "sponsored_micro_usd", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tx_count": { + "name": "tx_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_gas_sponsorship_monthly_org_month": { + "name": "idx_gas_sponsorship_monthly_org_month", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "month_start", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "gas_sponsorship_monthly_organization_id_organization_id_fk": { + "name": "gas_sponsorship_monthly_organization_id_organization_id_fk", + "tableFrom": "gas_sponsorship_monthly", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "gas_sponsorship_monthly_org_month_chain": { + "name": "gas_sponsorship_monthly_org_month_chain", + "nullsNotDistinct": false, + "columns": [ + "organization_id", + "month_start", + "chain_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.integration_grants": { + "name": "integration_grants", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "integration_id": { + "name": "integration_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "granted_by": { + "name": "granted_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_integration_grants_integration_user": { + "name": "idx_integration_grants_integration_user", + "columns": [ + { + "expression": "integration_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_integration_grants_user": { + "name": "idx_integration_grants_user", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "integration_grants_integration_id_integrations_id_fk": { + "name": "integration_grants_integration_id_integrations_id_fk", + "tableFrom": "integration_grants", + "tableTo": "integrations", + "columnsFrom": [ + "integration_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "integration_grants_user_id_users_id_fk": { + "name": "integration_grants_user_id_users_id_fk", + "tableFrom": "integration_grants", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "integration_grants_granted_by_users_id_fk": { + "name": "integration_grants_granted_by_users_id_fk", + "tableFrom": "integration_grants", + "tableTo": "users", + "columnsFrom": [ + "granted_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.integrations": { + "name": "integrations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "is_managed": { + "name": "is_managed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "visibility": { + "name": "visibility", + "type": "integration_visibility", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'private'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_integrations_org_web3": { + "name": "idx_integrations_org_web3", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"integrations\".\"type\" = 'web3' AND \"integrations\".\"organization_id\" IS NOT NULL", + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_integrations_created_by": { + "name": "idx_integrations_created_by", + "columns": [ + { + "expression": "created_by", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "integrations_created_by_users_id_fk": { + "name": "integrations_created_by_users_id_fk", + "tableFrom": "integrations", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "integrations_organization_id_organization_id_fk": { + "name": "integrations_organization_id_organization_id_fk", + "tableFrom": "integrations", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.internal_service_hmac_secrets": { + "name": "internal_service_hmac_secrets", + "schema": "", + "columns": { + "caller": { + "name": "caller", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_version": { + "name": "key_version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "secret_ciphertext": { + "name": "secret_ciphertext", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "internal_service_hmac_secrets_caller_key_version_pk": { + "name": "internal_service_hmac_secrets_caller_key_version_pk", + "columns": [ + "caller", + "key_version" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.invitation": { + "name": "invitation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "inviter_id": { + "name": "inviter_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "invitation_organization_id_organization_id_fk": { + "name": "invitation_organization_id_organization_id_fk", + "tableFrom": "invitation", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "invitation_inviter_id_users_id_fk": { + "name": "invitation_inviter_id_users_id_fk", + "tableFrom": "invitation", + "tableTo": "users", + "columnsFrom": [ + "inviter_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.key_export_codes": { + "name": "key_export_codes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "code_hash": { + "name": "code_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "attempts": { + "name": "attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "key_export_codes_organization_id_organization_id_fk": { + "name": "key_export_codes_organization_id_organization_id_fk", + "tableFrom": "key_export_codes", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mcp_oauth_auth_codes": { + "name": "mcp_oauth_auth_codes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "redirect_uri": { + "name": "redirect_uri", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "code_challenge": { + "name": "code_challenge", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "code_challenge_method": { + "name": "code_challenge_method", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "mcp_oauth_auth_codes_code_unique": { + "name": "mcp_oauth_auth_codes_code_unique", + "nullsNotDistinct": false, + "columns": [ + "code" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mcp_oauth_clients": { + "name": "mcp_oauth_clients", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "client_secret_hash": { + "name": "client_secret_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token_endpoint_auth_method": { + "name": "token_endpoint_auth_method", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'none'" + }, + "client_name": { + "name": "client_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "redirect_uris": { + "name": "redirect_uris", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "scopes": { + "name": "scopes", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "grant_types": { + "name": "grant_types", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "mcp_oauth_clients_client_id_unique": { + "name": "mcp_oauth_clients_client_id_unique", + "nullsNotDistinct": false, + "columns": [ + "client_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.mcp_oauth_refresh_tokens": { + "name": "mcp_oauth_refresh_tokens", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "token_hash": { + "name": "token_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "connected_at": { + "name": "connected_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "idx_mcp_refresh_tokens_client": { + "name": "idx_mcp_refresh_tokens_client", + "columns": [ + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_mcp_refresh_tokens_user": { + "name": "idx_mcp_refresh_tokens_user", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_mcp_refresh_tokens_org": { + "name": "idx_mcp_refresh_tokens_org", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "mcp_oauth_refresh_tokens_token_hash_unique": { + "name": "mcp_oauth_refresh_tokens_token_hash_unique", + "nullsNotDistinct": false, + "columns": [ + "token_hash" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.member": { + "name": "member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'member'" + }, + "mcp_max_scope": { + "name": "mcp_max_scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "idx_member_user_id": { + "name": "idx_member_user_id", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_member_organization_id": { + "name": "idx_member_organization_id", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "member_org_single_owner": { + "name": "member_org_single_owner", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"member\".\"role\" = 'owner'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "member_organization_id_organization_id_fk": { + "name": "member_organization_id_organization_id_fk", + "tableFrom": "member", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "member_user_id_users_id_fk": { + "name": "member_user_id_users_id_fk", + "tableFrom": "member", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization": { + "name": "organization", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "logo": { + "name": "logo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "deactivated_at": { + "name": "deactivated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "enforce_mfa": { + "name": "enforce_mfa", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "enforced_mfa_factors": { + "name": "enforced_mfa_factors", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "mcp_max_scope": { + "name": "mcp_max_scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "halted_at": { + "name": "halted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "halted_reason": { + "name": "halted_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "halted_by": { + "name": "halted_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "organization_slug_unique": { + "name": "organization_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization_api_keys": { + "name": "organization_api_keys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_prefix": { + "name": "key_prefix", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "revoked_at": { + "name": "revoked_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "idx_org_api_keys_org_id": { + "name": "idx_org_api_keys_org_id", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_org_api_keys_created_by": { + "name": "idx_org_api_keys_created_by", + "columns": [ + { + "expression": "created_by", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_api_keys_organization_id_organization_id_fk": { + "name": "organization_api_keys_organization_id_organization_id_fk", + "tableFrom": "organization_api_keys", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_api_keys_created_by_users_id_fk": { + "name": "organization_api_keys_created_by_users_id_fk", + "tableFrom": "organization_api_keys", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "organization_api_keys_key_hash_unique": { + "name": "organization_api_keys_key_hash_unique", + "nullsNotDistinct": false, + "columns": [ + "key_hash" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization_spend_caps": { + "name": "organization_spend_caps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "daily_cap_wei": { + "name": "daily_cap_wei", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "daily_value_cap_wei": { + "name": "daily_value_cap_wei", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "daily_solana_value_cap_lamports": { + "name": "daily_solana_value_cap_lamports", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "organization_spend_caps_organization_id_organization_id_fk": { + "name": "organization_spend_caps_organization_id_organization_id_fk", + "tableFrom": "organization_spend_caps", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "organization_spend_caps_organization_id_unique": { + "name": "organization_spend_caps_organization_id_unique", + "nullsNotDistinct": false, + "columns": [ + "organization_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization_subscriptions": { + "name": "organization_subscriptions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_customer_id": { + "name": "provider_customer_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider_subscription_id": { + "name": "provider_subscription_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider_price_id": { + "name": "provider_price_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "plan": { + "name": "plan", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'free'" + }, + "tier": { + "name": "tier", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "current_period_start": { + "name": "current_period_start", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "current_period_end": { + "name": "current_period_end", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "cancel_at_period_end": { + "name": "cancel_at_period_end", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "billing_alert": { + "name": "billing_alert", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "billing_alert_url": { + "name": "billing_alert_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "trial_started_at": { + "name": "trial_started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "plan_overrides": { + "name": "plan_overrides", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_org_subscriptions_org": { + "name": "idx_org_subscriptions_org", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_org_subscriptions_provider_sub": { + "name": "idx_org_subscriptions_provider_sub", + "columns": [ + { + "expression": "provider_subscription_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_subscriptions_organization_id_organization_id_fk": { + "name": "organization_subscriptions_organization_id_organization_id_fk", + "tableFrom": "organization_subscriptions", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "organization_subscriptions_organization_id_unique": { + "name": "organization_subscriptions_organization_id_unique", + "nullsNotDistinct": false, + "columns": [ + "organization_id" + ] + }, + "organization_subscriptions_provider_customer_id_unique": { + "name": "organization_subscriptions_provider_customer_id_unique", + "nullsNotDistinct": false, + "columns": [ + "provider_customer_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization_tokens": { + "name": "organization_tokens", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "safe_wallet_id": { + "name": "safe_wallet_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "chain_id": { + "name": "chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "token_address": { + "name": "token_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "symbol": { + "name": "symbol", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "decimals": { + "name": "decimals", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "logo_url": { + "name": "logo_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_org_tokens_org_chain": { + "name": "idx_org_tokens_org_chain", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "chain_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_org_tokens_safe": { + "name": "idx_org_tokens_safe", + "columns": [ + { + "expression": "safe_wallet_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_tokens_organization_id_organization_id_fk": { + "name": "organization_tokens_organization_id_organization_id_fk", + "tableFrom": "organization_tokens", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_tokens_safe_wallet_id_safe_wallets_id_fk": { + "name": "organization_tokens_safe_wallet_id_safe_wallets_id_fk", + "tableFrom": "organization_tokens", + "tableTo": "safe_wallets", + "columnsFrom": [ + "safe_wallet_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization_wallets": { + "name": "organization_wallets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "wallet_address": { + "name": "wallet_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "turnkey_sub_org_id": { + "name": "turnkey_sub_org_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "turnkey_wallet_id": { + "name": "turnkey_wallet_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "turnkey_private_key_id": { + "name": "turnkey_private_key_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "solana_address": { + "name": "solana_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "organization_wallets_org_active_unique": { + "name": "organization_wallets_org_active_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"organization_wallets\".\"is_active\" = true", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_wallets_user_id_users_id_fk": { + "name": "organization_wallets_user_id_users_id_fk", + "tableFrom": "organization_wallets", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_wallets_organization_id_organization_id_fk": { + "name": "organization_wallets_organization_id_organization_id_fk", + "tableFrom": "organization_wallets", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.overage_billing_records": { + "name": "overage_billing_records", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "period_start": { + "name": "period_start", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "period_end": { + "name": "period_end", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "execution_limit": { + "name": "execution_limit", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "total_executions": { + "name": "total_executions", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "overage_count": { + "name": "overage_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "overage_rate_cents": { + "name": "overage_rate_cents", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "total_charge_cents": { + "name": "total_charge_cents", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "provider_invoice_item_id": { + "name": "provider_invoice_item_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "provider_invoice_id": { + "name": "provider_invoice_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_overage_billing_org": { + "name": "idx_overage_billing_org", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_overage_billing_status": { + "name": "idx_overage_billing_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "overage_billing_records_organization_id_organization_id_fk": { + "name": "overage_billing_records_organization_id_organization_id_fk", + "tableFrom": "overage_billing_records", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "overage_billing_org_period": { + "name": "overage_billing_org_period", + "nullsNotDistinct": false, + "columns": [ + "organization_id", + "period_start", + "period_end" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payg_config": { + "name": "payg_config", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "daily_cap_raw": { + "name": "daily_cap_raw", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "period_cap_raw": { + "name": "period_cap_raw", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "chain_id": { + "name": "chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 8453 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_payg_config_org": { + "name": "idx_payg_config_org", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "payg_config_organization_id_organization_id_fk": { + "name": "payg_config_organization_id_organization_id_fk", + "tableFrom": "payg_config", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "payg_config_organization_id_unique": { + "name": "payg_config_organization_id_unique", + "nullsNotDistinct": false, + "columns": [ + "organization_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payg_payments": { + "name": "payg_payments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "amount_raw": { + "name": "amount_raw", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tx_hash": { + "name": "tx_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "chain_id": { + "name": "chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "payer_address": { + "name": "payer_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "treasury_address": { + "name": "treasury_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'settled'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_payg_payments_org_created": { + "name": "idx_payg_payments_org_created", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "payg_payments_organization_id_organization_id_fk": { + "name": "payg_payments_organization_id_organization_id_fk", + "tableFrom": "payg_payments", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "payg_payments_org_execution": { + "name": "payg_payments_org_execution", + "nullsNotDistinct": false, + "columns": [ + "organization_id", + "execution_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pending_transactions": { + "name": "pending_transactions", + "schema": "", + "columns": { + "wallet_address": { + "name": "wallet_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chain_id": { + "name": "chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "nonce": { + "name": "nonce", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "tx_hash": { + "name": "tx_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "gas_price": { + "name": "gas_price", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'pending'" + } + }, + "indexes": { + "idx_pending_tx_status": { + "name": "idx_pending_tx_status", + "columns": [ + { + "expression": "wallet_address", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "chain_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_pending_tx_execution": { + "name": "idx_pending_tx_execution", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_pending_tx_stuck": { + "name": "idx_pending_tx_stuck", + "columns": [ + { + "expression": "submitted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "chain_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"pending_transactions\".\"status\" = 'pending'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "pending_transactions_wallet_address_chain_id_nonce_pk": { + "name": "pending_transactions_wallet_address_chain_id_nonce_pk", + "columns": [ + "wallet_address", + "chain_id", + "nonce" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.projects": { + "name": "projects", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_projects_org": { + "name": "idx_projects_org", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "projects_organization_id_organization_id_fk": { + "name": "projects_organization_id_organization_id_fk", + "tableFrom": "projects", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "projects_user_id_users_id_fk": { + "name": "projects_user_id_users_id_fk", + "tableFrom": "projects", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.public_tags": { + "name": "public_tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "public_tags_name_unique": { + "name": "public_tags_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + }, + "public_tags_slug_unique": { + "name": "public_tags_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.safe_role_allowances": { + "name": "safe_role_allowances", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "protocol_slug": { + "name": "protocol_slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "allowance_key": { + "name": "allowance_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token_address": { + "name": "token_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token_symbol": { + "name": "token_symbol", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token_decimals": { + "name": "token_decimals", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "max_refill_wei": { + "name": "max_refill_wei", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "refill_wei": { + "name": "refill_wei", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "period_seconds": { + "name": "period_seconds", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "last_chain_balance_wei": { + "name": "last_chain_balance_wei", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_chain_timestamp": { + "name": "last_chain_timestamp", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_reconciled_at": { + "name": "last_reconciled_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "last_applied_tx_hash": { + "name": "last_applied_tx_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_updated_at": { + "name": "last_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "safe_role_allowances_role_key_unique": { + "name": "safe_role_allowances_role_key_unique", + "columns": [ + { + "expression": "role_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "allowance_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_safe_role_allowances_role": { + "name": "idx_safe_role_allowances_role", + "columns": [ + { + "expression": "role_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "safe_role_allowances_role_id_safe_roles_id_fk": { + "name": "safe_role_allowances_role_id_safe_roles_id_fk", + "tableFrom": "safe_role_allowances", + "tableTo": "safe_roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.safe_role_direct_rules": { + "name": "safe_role_direct_rules", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token_address": { + "name": "token_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token_symbol": { + "name": "token_symbol", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token_decimals": { + "name": "token_decimals", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "counterparty": { + "name": "counterparty", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "amount_human": { + "name": "amount_human", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "period_seconds": { + "name": "period_seconds", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'allowed'" + }, + "last_applied_tx_hash": { + "name": "last_applied_tx_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_updated_at": { + "name": "last_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "safe_role_direct_rules_role_kind_token_cp_unique": { + "name": "safe_role_direct_rules_role_kind_token_cp_unique", + "columns": [ + { + "expression": "role_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "kind", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "token_address", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "counterparty", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_safe_role_direct_rules_role": { + "name": "idx_safe_role_direct_rules_role", + "columns": [ + { + "expression": "role_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "safe_role_direct_rules_role_id_safe_roles_id_fk": { + "name": "safe_role_direct_rules_role_id_safe_roles_id_fk", + "tableFrom": "safe_role_direct_rules", + "tableTo": "safe_roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.safe_role_protocols": { + "name": "safe_role_protocols", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "protocol_slug": { + "name": "protocol_slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "template_slug": { + "name": "template_slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "allowed_token_symbols": { + "name": "allowed_token_symbols", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "target_addresses": { + "name": "target_addresses", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "allowed_selectors": { + "name": "allowed_selectors", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'allowed'" + }, + "last_applied_tx_hash": { + "name": "last_applied_tx_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_updated_at": { + "name": "last_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "safe_role_protocols_role_slug_unique": { + "name": "safe_role_protocols_role_slug_unique", + "columns": [ + { + "expression": "role_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "protocol_slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_safe_role_protocols_role": { + "name": "idx_safe_role_protocols_role", + "columns": [ + { + "expression": "role_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "safe_role_protocols_role_id_safe_roles_id_fk": { + "name": "safe_role_protocols_role_id_safe_roles_id_fk", + "tableFrom": "safe_role_protocols", + "tableTo": "safe_roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.safe_roles": { + "name": "safe_roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "safe_wallet_id": { + "name": "safe_wallet_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role_type": { + "name": "role_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'automation'" + }, + "role_key": { + "name": "role_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "roles_modifier_address": { + "name": "roles_modifier_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "delegate_address": { + "name": "delegate_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "installed_tx_hash": { + "name": "installed_tx_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_reconciled_at": { + "name": "last_reconciled_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "safe_roles_safe_type_unique": { + "name": "safe_roles_safe_type_unique", + "columns": [ + { + "expression": "safe_wallet_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "role_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_safe_roles_safe": { + "name": "idx_safe_roles_safe", + "columns": [ + { + "expression": "safe_wallet_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "safe_roles_safe_wallet_id_safe_wallets_id_fk": { + "name": "safe_roles_safe_wallet_id_safe_wallets_id_fk", + "tableFrom": "safe_roles", + "tableTo": "safe_wallets", + "columnsFrom": [ + "safe_wallet_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.safe_wallets": { + "name": "safe_wallets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chain_id": { + "name": "chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "safe_address": { + "name": "safe_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "owner_wallet_id": { + "name": "owner_wallet_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "owners": { + "name": "owners", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "threshold": { + "name": "threshold", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "salt_nonce": { + "name": "salt_nonce", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "safe_version": { + "name": "safe_version", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'1.4.1'" + }, + "singleton_address": { + "name": "singleton_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "factory_address": { + "name": "factory_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "deployment_tx_hash": { + "name": "deployment_tx_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "deployment_block": { + "name": "deployment_block", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "deployed_at": { + "name": "deployed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "is_signing_active": { + "name": "is_signing_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "safe_wallets_org_chain_unique": { + "name": "safe_wallets_org_chain_unique", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "chain_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_safe_wallets_org": { + "name": "idx_safe_wallets_org", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "safe_wallets_organization_id_organization_id_fk": { + "name": "safe_wallets_organization_id_organization_id_fk", + "tableFrom": "safe_wallets", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "safe_wallets_owner_wallet_id_organization_wallets_id_fk": { + "name": "safe_wallets_owner_wallet_id_organization_wallets_id_fk", + "tableFrom": "safe_wallets", + "tableTo": "organization_wallets", + "columnsFrom": [ + "owner_wallet_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.security_audit_log": { + "name": "security_audit_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "actor_user_id": { + "name": "actor_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "actor_label": { + "name": "actor_label", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "organization_label": { + "name": "organization_label", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "auth_method": { + "name": "auth_method", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "api_key_id": { + "name": "api_key_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "resource_id": { + "name": "resource_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "correlation_id": { + "name": "correlation_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "outcome": { + "name": "outcome", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'succeeded'" + }, + "diff": { + "name": "diff", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_security_audit_org_created": { + "name": "idx_security_audit_org_created", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_security_audit_actor_created": { + "name": "idx_security_audit_actor_created", + "columns": [ + { + "expression": "actor_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_security_audit_resource_created": { + "name": "idx_security_audit_resource_created", + "columns": [ + { + "expression": "resource_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_security_audit_action_created": { + "name": "idx_security_audit_action_created", + "columns": [ + { + "expression": "action", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_security_audit_correlation_created": { + "name": "idx_security_audit_correlation_created", + "columns": [ + { + "expression": "correlation_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "security_audit_log_actor_user_id_users_id_fk": { + "name": "security_audit_log_actor_user_id_users_id_fk", + "tableFrom": "security_audit_log", + "tableTo": "users", + "columnsFrom": [ + "actor_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "security_audit_log_organization_id_organization_id_fk": { + "name": "security_audit_log_organization_id_organization_id_fk", + "tableFrom": "security_audit_log", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sessions": { + "name": "sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "active_organization_id": { + "name": "active_organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "requires_mfa": { + "name": "requires_mfa", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "mfa_verified_at": { + "name": "mfa_verified_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "risk_flags_json": { + "name": "risk_flags_json", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "idx_sessions_user_id": { + "name": "idx_sessions_user_id", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sessions_user_id_users_id_fk": { + "name": "sessions_user_id_users_id_fk", + "tableFrom": "sessions", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "sessions_token_unique": { + "name": "sessions_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.supported_tokens": { + "name": "supported_tokens", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "chain_id": { + "name": "chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "token_address": { + "name": "token_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "symbol": { + "name": "symbol", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "decimals": { + "name": "decimals", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "logo_url": { + "name": "logo_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_stablecoin": { + "name": "is_stablecoin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_supported_tokens_chain": { + "name": "idx_supported_tokens_chain", + "columns": [ + { + "expression": "chain_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "supported_tokens_chain_address": { + "name": "supported_tokens_chain_address", + "nullsNotDistinct": false, + "columns": [ + "chain_id", + "token_address" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tags": { + "name": "tags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_tags_org": { + "name": "idx_tags_org", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tags_organization_id_organization_id_fk": { + "name": "tags_organization_id_organization_id_fk", + "tableFrom": "tags", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tags_user_id_users_id_fk": { + "name": "tags_user_id_users_id_fk", + "tableFrom": "tags", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tempo_held_payments": { + "name": "tempo_held_payments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_by_user_id": { + "name": "created_by_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "chain_id": { + "name": "chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "from_address": { + "name": "from_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "to_address": { + "name": "to_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token_address": { + "name": "token_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "amount_raw": { + "name": "amount_raw", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token_symbol": { + "name": "token_symbol", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "token_decimals": { + "name": "token_decimals", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "amount_display": { + "name": "amount_display", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "memo": { + "name": "memo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "serialized_tx": { + "name": "serialized_tx", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "precomputed_hash": { + "name": "precomputed_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "nonce_key": { + "name": "nonce_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "max_fee_per_gas": { + "name": "max_fee_per_gas", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "valid_after": { + "name": "valid_after", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "valid_before": { + "name": "valid_before", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "broadcast_at": { + "name": "broadcast_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "tempo_held_payment_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "attempt_count": { + "name": "attempt_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "broadcast_tx_hash": { + "name": "broadcast_tx_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "dispatch_key": { + "name": "dispatch_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_tempo_held_payments_org": { + "name": "idx_tempo_held_payments_org", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_tempo_held_payments_org_created": { + "name": "idx_tempo_held_payments_org_created", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_tempo_held_payments_status": { + "name": "idx_tempo_held_payments_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_tempo_held_payments_due": { + "name": "idx_tempo_held_payments_due", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "broadcast_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_tempo_held_payments_expiry": { + "name": "idx_tempo_held_payments_expiry", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "valid_before", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "uq_tempo_held_payments_hash": { + "name": "uq_tempo_held_payments_hash", + "columns": [ + { + "expression": "precomputed_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "uq_tempo_held_payments_dispatch_key": { + "name": "uq_tempo_held_payments_dispatch_key", + "columns": [ + { + "expression": "dispatch_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tempo_held_payments_organization_id_organization_id_fk": { + "name": "tempo_held_payments_organization_id_organization_id_fk", + "tableFrom": "tempo_held_payments", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tempo_held_payments_created_by_user_id_users_id_fk": { + "name": "tempo_held_payments_created_by_user_id_users_id_fk", + "tableFrom": "tempo_held_payments", + "tableTo": "users", + "columnsFrom": [ + "created_by_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.two_factor": { + "name": "two_factor", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret": { + "name": "secret", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "backup_codes": { + "name": "backup_codes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "enrolled_at": { + "name": "enrolled_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "verified": { + "name": "verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "failed_verification_count": { + "name": "failed_verification_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "locked_until": { + "name": "locked_until", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "idx_two_factor_user_id": { + "name": "idx_two_factor_user_id", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "two_factor_user_id_users_id_fk": { + "name": "two_factor_user_id_users_id_fk", + "tableFrom": "two_factor", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "two_factor_user_id_unique": { + "name": "two_factor_user_id_unique", + "nullsNotDistinct": false, + "columns": [ + "user_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_rpc_preferences": { + "name": "user_rpc_preferences", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chain_id": { + "name": "chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "primary_rpc_url": { + "name": "primary_rpc_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "fallback_rpc_url": { + "name": "fallback_rpc_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "primary_wss_url": { + "name": "primary_wss_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "fallback_wss_url": { + "name": "fallback_wss_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_user_rpc_user_chain": { + "name": "idx_user_rpc_user_chain", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "chain_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_user_rpc_user_id": { + "name": "idx_user_rpc_user_id", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_rpc_preferences_user_id_users_id_fk": { + "name": "user_rpc_preferences_user_id_users_id_fk", + "tableFrom": "user_rpc_preferences", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_trusted_countries": { + "name": "user_trusted_countries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country": { + "name": "country", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "first_seen_at": { + "name": "first_seen_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_user_trusted_countries_user_id": { + "name": "idx_user_trusted_countries_user_id", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_user_trusted_countries_user_country": { + "name": "idx_user_trusted_countries_user_country", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "country", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_trusted_countries_user_id_users_id_fk": { + "name": "user_trusted_countries_user_id_users_id_fk", + "tableFrom": "user_trusted_countries", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_trusted_devices": { + "name": "user_trusted_devices", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "device_id": { + "name": "device_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "first_seen_at": { + "name": "first_seen_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_user_trusted_devices_user_id": { + "name": "idx_user_trusted_devices_user_id", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_user_trusted_devices_user_device": { + "name": "idx_user_trusted_devices_user_device", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "device_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_trusted_devices_user_id_users_id_fk": { + "name": "user_trusted_devices_user_id_users_id_fk", + "tableFrom": "user_trusted_devices", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_trusted_ips": { + "name": "user_trusted_ips", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "ip": { + "name": "ip", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "country": { + "name": "country", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "first_seen_at": { + "name": "first_seen_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_user_trusted_ips_user_id": { + "name": "idx_user_trusted_ips_user_id", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_user_trusted_ips_user_ip": { + "name": "idx_user_trusted_ips_user_ip", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "ip", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_trusted_ips_user_id_users_id_fk": { + "name": "user_trusted_ips_user_id_users_id_fk", + "tableFrom": "user_trusted_ips", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email_verified": { + "name": "email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "is_anonymous": { + "name": "is_anonymous", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "deactivated_at": { + "name": "deactivated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "two_factor_enabled": { + "name": "two_factor_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "display_name_confirmed": { + "name": "display_name_confirmed", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "onboarding_completed": { + "name": "onboarding_completed", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "step_up_policy": { + "name": "step_up_policy", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "step_up_email": { + "name": "step_up_email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "signup_notified_at": { + "name": "signup_notified_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verifications": { + "name": "verifications", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.wallet_address": { + "name": "wallet_address", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chain_id": { + "name": "chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "is_primary": { + "name": "is_primary", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_wallet_address_user_id": { + "name": "idx_wallet_address_user_id", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_wallet_address_address_unique": { + "name": "idx_wallet_address_address_unique", + "columns": [ + { + "expression": "address", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "wallet_address_user_id_users_id_fk": { + "name": "wallet_address_user_id_users_id_fk", + "tableFrom": "wallet_address", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.wallet_approval_requests": { + "name": "wallet_approval_requests", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "sub_org_id": { + "name": "sub_org_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "operation_payload": { + "name": "operation_payload", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "approval_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "risk_level": { + "name": "risk_level", + "type": "approval_risk_level", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "bound_recipient": { + "name": "bound_recipient", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "bound_amount_micro": { + "name": "bound_amount_micro", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "bound_chain": { + "name": "bound_chain", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "bound_contract": { + "name": "bound_contract", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now() + interval '15 minutes'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "resolved_at": { + "name": "resolved_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "resolved_by_user_id": { + "name": "resolved_by_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "idx_wallet_approval_sub_org": { + "name": "idx_wallet_approval_sub_org", + "columns": [ + { + "expression": "sub_org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_wallet_approval_status": { + "name": "idx_wallet_approval_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_wallet_approval_created": { + "name": "idx_wallet_approval_created", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_wallet_approval_resolved_by": { + "name": "idx_wallet_approval_resolved_by", + "columns": [ + { + "expression": "resolved_by_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "wallet_approval_requests_sub_org_id_agentic_wallets_sub_org_id_fk": { + "name": "wallet_approval_requests_sub_org_id_agentic_wallets_sub_org_id_fk", + "tableFrom": "wallet_approval_requests", + "tableTo": "agentic_wallets", + "columnsFrom": [ + "sub_org_id" + ], + "columnsTo": [ + "sub_org_id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "wallet_approval_requests_resolved_by_user_id_users_id_fk": { + "name": "wallet_approval_requests_resolved_by_user_id_users_id_fk", + "tableFrom": "wallet_approval_requests", + "tableTo": "users", + "columnsFrom": [ + "resolved_by_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.wallet_locks": { + "name": "wallet_locks", + "schema": "", + "columns": { + "wallet_address": { + "name": "wallet_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "chain_id": { + "name": "chain_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "locked_by": { + "name": "locked_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "locked_at": { + "name": "locked_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "wallet_locks_wallet_address_chain_id_pk": { + "name": "wallet_locks_wallet_address_chain_id_pk", + "columns": [ + "wallet_address", + "chain_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_execution_digest_settings": { + "name": "workflow_execution_digest_settings", + "schema": "", + "columns": { + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cadences": { + "name": "cadences", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[\"weekly\"]'::jsonb" + }, + "subscriber_user_ids": { + "name": "subscriber_user_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "last_sent": { + "name": "last_sent", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_execution_digest_enabled": { + "name": "idx_execution_digest_enabled", + "columns": [ + { + "expression": "enabled", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_execution_digest_settings_organization_id_organization_id_fk": { + "name": "workflow_execution_digest_settings_organization_id_organization_id_fk", + "tableFrom": "workflow_execution_digest_settings", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_execution_logs": { + "name": "workflow_execution_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "node_id": { + "name": "node_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "node_name": { + "name": "node_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "node_type": { + "name": "node_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "input": { + "name": "input", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "output": { + "name": "output", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "output_raw": { + "name": "output_raw", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "duration": { + "name": "duration", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "timestamp": { + "name": "timestamp", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "iteration_index": { + "name": "iteration_index", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "for_each_node_id": { + "name": "for_each_node_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "network": { + "name": "network", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "gas_used_wei": { + "name": "gas_used_wei", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "idx_exec_logs_started_at": { + "name": "idx_exec_logs_started_at", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_exec_logs_execution_id": { + "name": "idx_exec_logs_execution_id", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_exec_logs_sponsored_execution": { + "name": "idx_exec_logs_sponsored_execution", + "columns": [ + { + "expression": "execution_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"workflow_execution_logs\".\"output_raw\" ->> 'sponsored' = 'true'", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_execution_logs_execution_id_workflow_executions_id_fk": { + "name": "workflow_execution_logs_execution_id_workflow_executions_id_fk", + "tableFrom": "workflow_execution_logs", + "tableTo": "workflow_executions", + "columnsFrom": [ + "execution_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_executions": { + "name": "workflow_executions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "input": { + "name": "input", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "output": { + "name": "output", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_category": { + "name": "error_category", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_type": { + "name": "error_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_code": { + "name": "error_code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "duration": { + "name": "duration", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "total_steps": { + "name": "total_steps", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "completed_steps": { + "name": "completed_steps", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "current_node_id": { + "name": "current_node_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "current_node_name": { + "name": "current_node_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_successful_node_id": { + "name": "last_successful_node_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_successful_node_name": { + "name": "last_successful_node_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "execution_trace": { + "name": "execution_trace", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "run_id": { + "name": "run_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "transaction_hashes": { + "name": "transaction_hashes", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "gas_used_wei": { + "name": "gas_used_wei", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "billable": { + "name": "billable", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "triggered_by_user_api_key_id": { + "name": "triggered_by_user_api_key_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "triggered_by_org_api_key_id": { + "name": "triggered_by_org_api_key_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "triggered_by_ip": { + "name": "triggered_by_ip", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "triggered_by_country": { + "name": "triggered_by_country", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "trigger_source": { + "name": "trigger_source", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "triggered_by_credential_type": { + "name": "triggered_by_credential_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "triggered_by_credential_label": { + "name": "triggered_by_credential_label", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "executed_workflow_hash": { + "name": "executed_workflow_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "dispatch_key": { + "name": "dispatch_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "idx_workflow_executions_status": { + "name": "idx_workflow_executions_status", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_workflow_executions_user_id": { + "name": "idx_workflow_executions_user_id", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_workflow_executions_organization_id": { + "name": "idx_workflow_executions_organization_id", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_workflow_executions_executed_hash": { + "name": "idx_workflow_executions_executed_hash", + "columns": [ + { + "expression": "executed_workflow_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_workflow_executions_dispatch_key": { + "name": "idx_workflow_executions_dispatch_key", + "columns": [ + { + "expression": "dispatch_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_executions_workflow_id_workflows_id_fk": { + "name": "workflow_executions_workflow_id_workflows_id_fk", + "tableFrom": "workflow_executions", + "tableTo": "workflows", + "columnsFrom": [ + "workflow_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "workflow_executions_organization_id_organization_id_fk": { + "name": "workflow_executions_organization_id_organization_id_fk", + "tableFrom": "workflow_executions", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "workflow_executions_user_id_users_id_fk": { + "name": "workflow_executions_user_id_users_id_fk", + "tableFrom": "workflow_executions", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "workflow_executions_triggered_by_user_api_key_id_api_keys_id_fk": { + "name": "workflow_executions_triggered_by_user_api_key_id_api_keys_id_fk", + "tableFrom": "workflow_executions", + "tableTo": "api_keys", + "columnsFrom": [ + "triggered_by_user_api_key_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_history": { + "name": "workflow_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "changed_by_user_id": { + "name": "changed_by_user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "auth_method": { + "name": "auth_method", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "snapshot": { + "name": "snapshot", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "change": { + "name": "change", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "previous_version": { + "name": "previous_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "previous_hash": { + "name": "previous_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "uq_workflow_history_workflow_version": { + "name": "uq_workflow_history_workflow_version", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "version", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_workflow_history_content_hash": { + "name": "idx_workflow_history_content_hash", + "columns": [ + { + "expression": "content_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_history_workflow_id_workflows_id_fk": { + "name": "workflow_history_workflow_id_workflows_id_fk", + "tableFrom": "workflow_history", + "tableTo": "workflows", + "columnsFrom": [ + "workflow_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_history_organization_id_organization_id_fk": { + "name": "workflow_history_organization_id_organization_id_fk", + "tableFrom": "workflow_history", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workflow_history_changed_by_user_id_users_id_fk": { + "name": "workflow_history_changed_by_user_id_users_id_fk", + "tableFrom": "workflow_history", + "tableTo": "users", + "columnsFrom": [ + "changed_by_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_payments": { + "name": "workflow_payments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "payment_hash": { + "name": "payment_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "execution_id": { + "name": "execution_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "kind": { + "name": "kind", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "'execution'" + }, + "deliverable": { + "name": "deliverable", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "amount_usdc": { + "name": "amount_usdc", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "payer_address": { + "name": "payer_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "creator_wallet_address": { + "name": "creator_wallet_address", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "settled_at": { + "name": "settled_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "protocol": { + "name": "protocol", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true, + "default": "'x402'" + }, + "chain": { + "name": "chain", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'base'" + } + }, + "indexes": { + "idx_workflow_payments_hash": { + "name": "idx_workflow_payments_hash", + "columns": [ + { + "expression": "payment_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_workflow_payments_workflow": { + "name": "idx_workflow_payments_workflow", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_public_tags": { + "name": "workflow_public_tags", + "schema": "", + "columns": { + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "public_tag_id": { + "name": "public_tag_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "idx_workflow_public_tags_workflow": { + "name": "idx_workflow_public_tags_workflow", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_workflow_public_tags_tag": { + "name": "idx_workflow_public_tags_tag", + "columns": [ + { + "expression": "public_tag_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_public_tags_workflow_id_workflows_id_fk": { + "name": "workflow_public_tags_workflow_id_workflows_id_fk", + "tableFrom": "workflow_public_tags", + "tableTo": "workflows", + "columnsFrom": [ + "workflow_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_public_tags_public_tag_id_public_tags_id_fk": { + "name": "workflow_public_tags_public_tag_id_public_tags_id_fk", + "tableFrom": "workflow_public_tags", + "tableTo": "public_tags", + "columnsFrom": [ + "public_tag_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "workflow_public_tags_workflow_id_public_tag_id_pk": { + "name": "workflow_public_tags_workflow_id_public_tag_id_pk", + "columns": [ + "workflow_id", + "public_tag_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_ratings": { + "name": "workflow_ratings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "rating": { + "name": "rating", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_workflow_ratings_workflow": { + "name": "idx_workflow_ratings_workflow", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_ratings_workflow_id_workflows_id_fk": { + "name": "workflow_ratings_workflow_id_workflows_id_fk", + "tableFrom": "workflow_ratings", + "tableTo": "workflows", + "columnsFrom": [ + "workflow_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_ratings_user_id_users_id_fk": { + "name": "workflow_ratings_user_id_users_id_fk", + "tableFrom": "workflow_ratings", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uq_workflow_ratings_workflow_user": { + "name": "uq_workflow_ratings_workflow_user", + "nullsNotDistinct": false, + "columns": [ + "workflow_id", + "user_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_schedules": { + "name": "workflow_schedules", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cron_expression": { + "name": "cron_expression", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "interval_seconds": { + "name": "interval_seconds", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "anchor_at": { + "name": "anchor_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "timezone": { + "name": "timezone", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'UTC'" + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "last_run_at": { + "name": "last_run_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "last_status": { + "name": "last_status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "next_run_at": { + "name": "next_run_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "run_count": { + "name": "run_count", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_workflow_schedules_enabled": { + "name": "idx_workflow_schedules_enabled", + "columns": [ + { + "expression": "enabled", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_workflow_schedules_workflow": { + "name": "idx_workflow_schedules_workflow", + "columns": [ + { + "expression": "workflow_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflow_schedules_workflow_id_workflows_id_fk": { + "name": "workflow_schedules_workflow_id_workflows_id_fk", + "tableFrom": "workflow_schedules", + "tableTo": "workflows", + "columnsFrom": [ + "workflow_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "workflow_schedules_workflow_id_unique": { + "name": "workflow_schedules_workflow_id_unique", + "nullsNotDistinct": false, + "columns": [ + "workflow_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflows": { + "name": "workflows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_anonymous": { + "name": "is_anonymous", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "featured": { + "name": "featured", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "featured_order": { + "name": "featured_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "featured_protocol": { + "name": "featured_protocol", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "featured_protocol_order": { + "name": "featured_protocol_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tag_id": { + "name": "tag_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "nodes": { + "name": "nodes", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "edges": { + "name": "edges", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'private'" + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "source_workflow_id": { + "name": "source_workflow_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "seeded_at": { + "name": "seeded_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "is_listed": { + "name": "is_listed", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "listed_slug": { + "name": "listed_slug", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "listed_at": { + "name": "listed_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "share_execution_status": { + "name": "share_execution_status", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "input_schema": { + "name": "input_schema", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "output_mapping": { + "name": "output_mapping", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "price_usdc_per_call": { + "name": "price_usdc_per_call", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "workflow_type": { + "name": "workflow_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'read'" + }, + "category": { + "name": "category", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "chain": { + "name": "chain", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "listing_version": { + "name": "listing_version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "deactivated_at": { + "name": "deactivated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "idx_workflows_listed_slug": { + "name": "idx_workflows_listed_slug", + "columns": [ + { + "expression": "listed_slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"workflows\".\"listed_slug\" is not null", + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_workflows_user_id": { + "name": "idx_workflows_user_id", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_workflows_tag_id": { + "name": "idx_workflows_tag_id", + "columns": [ + { + "expression": "tag_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_workflows_project_id": { + "name": "idx_workflows_project_id", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workflows_user_id_users_id_fk": { + "name": "workflows_user_id_users_id_fk", + "tableFrom": "workflows", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "workflows_organization_id_organization_id_fk": { + "name": "workflows_organization_id_organization_id_fk", + "tableFrom": "workflows", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflows_project_id_projects_id_fk": { + "name": "workflows_project_id_projects_id_fk", + "tableFrom": "workflows", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workflows_tag_id_tags_id_fk": { + "name": "workflows_tag_id_tags_id_fk", + "tableFrom": "workflows", + "tableTo": "tags", + "columnsFrom": [ + "tag_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.approval_risk_level": { + "name": "approval_risk_level", + "schema": "public", + "values": [ + "auto", + "ask", + "block" + ] + }, + "public.approval_status": { + "name": "approval_status", + "schema": "public", + "values": [ + "pending", + "approved", + "rejected", + "expired" + ] + }, + "public.feedback_status": { + "name": "feedback_status", + "schema": "public", + "values": [ + "pending", + "broadcast", + "confirmed", + "failed" + ] + }, + "public.integration_visibility": { + "name": "integration_visibility", + "schema": "public", + "values": [ + "private", + "specific_members", + "organization" + ] + }, + "public.tempo_held_payment_status": { + "name": "tempo_held_payment_status", + "schema": "public", + "values": [ + "pending", + "broadcasting", + "broadcast", + "confirmed", + "failed", + "expired", + "canceled" + ] + }, + "public.status": { + "name": "status", + "schema": "public", + "values": [ + "pending", + "running", + "completed", + "failed", + "cancelled" + ] + }, + "public.step_status": { + "name": "step_status", + "schema": "public", + "values": [ + "pending", + "running", + "completed", + "failed", + "cancelled" + ] + }, + "public.wait_status": { + "name": "wait_status", + "schema": "public", + "values": [ + "waiting", + "completed" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index 5d2f1356b..ce81be634 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -1072,6 +1072,13 @@ "when": 1788862439420, "tag": "0152_keep_1291_pending_tx_stuck_index", "breakpoints": true + }, + { + "idx": 153, + "version": "7", + "when": 1789062501958, + "tag": "0153_keep_1346_exec_log_sponsored_index", + "breakpoints": true } ] } \ No newline at end of file diff --git a/lib/db/schema.ts b/lib/db/schema.ts index 9b72086fb..ce92ae2b4 100644 --- a/lib/db/schema.ts +++ b/lib/db/schema.ts @@ -909,6 +909,17 @@ export const workflowExecutionLogs = pgTable( // so a dev DB bootstrapped with db:push (which only builds what this file // declares) would seq-scan the log table instead. index("idx_exec_logs_execution_id").on(table.executionId), + // KEEP-1346: the execution digest counts sponsored step runs by joining on + // execution_id and filtering output_raw->>'sponsored'. output_raw is + // TOASTed, so the plain execution_id index above makes the probe de-TOAST + // every log row of every execution in the window and then discard nearly + // all of them. Keying a partial index to the predicate keeps the heap out + // of it. The predicate must stay written exactly as the query emits it, + // because the planner only uses a partial index when it can match the + // query clause to the index predicate. + index("idx_exec_logs_sponsored_execution") + .on(table.executionId) + .where(sql`${table.outputRaw} ->> 'sponsored' = 'true'`), ] );