diff --git a/controlplane/migrations/0137_peaceful_marauders.sql b/controlplane/migrations/0137_peaceful_marauders.sql new file mode 100644 index 0000000000..a203282063 --- /dev/null +++ b/controlplane/migrations/0137_peaceful_marauders.sql @@ -0,0 +1,18 @@ +CREATE TABLE IF NOT EXISTS "persisted_operation_to_feature_flags" ( + "persisted_operation_id" uuid NOT NULL, + "feature_flag_id" uuid NOT NULL, + CONSTRAINT "persisted_operation_to_feature_flags_persisted_operation_id_feature_flag_id_pk" PRIMARY KEY("persisted_operation_id","feature_flag_id") +); +--> statement-breakpoint +ALTER TABLE "federated_graph_persisted_operations" ADD COLUMN "valid_on_base_graph" boolean DEFAULT true NOT NULL;--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "persisted_operation_to_feature_flags" ADD CONSTRAINT "persisted_operation_to_feature_flags_persisted_operation_id_federated_graph_persisted_operations_id_fk" FOREIGN KEY ("persisted_operation_id") REFERENCES "public"."federated_graph_persisted_operations"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "persisted_operation_to_feature_flags" ADD CONSTRAINT "persisted_operation_to_feature_flags_feature_flag_id_feature_flags_id_fk" FOREIGN KEY ("feature_flag_id") REFERENCES "public"."feature_flags"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/controlplane/migrations/meta/0137_snapshot.json b/controlplane/migrations/meta/0137_snapshot.json new file mode 100644 index 0000000000..7f798082ab --- /dev/null +++ b/controlplane/migrations/meta/0137_snapshot.json @@ -0,0 +1,8962 @@ +{ + "id": "624cefda-5e83-4d75-92bb-d74352c62336", + "prevId": "d474eefb-2a0d-4a07-8887-3260aee174d4", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.api_key_permissions": { + "name": "api_key_permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "api_key_id": { + "name": "api_key_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "akp_api_key_id_idx": { + "name": "akp_api_key_id_idx", + "columns": [ + { + "expression": "api_key_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "api_key_permissions_api_key_id_api_keys_id_fk": { + "name": "api_key_permissions_api_key_id_api_keys_id_fk", + "tableFrom": "api_key_permissions", + "tableTo": "api_keys", + "columnsFrom": [ + "api_key_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.api_key_resources": { + "name": "api_key_resources", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "api_key_id": { + "name": "api_key_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "akr_api_key_id_idx": { + "name": "akr_api_key_id_idx", + "columns": [ + { + "expression": "api_key_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "akr_target_id_idx": { + "name": "akr_target_id_idx", + "columns": [ + { + "expression": "target_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "api_key_resources_api_key_id_api_keys_id_fk": { + "name": "api_key_resources_api_key_id_api_keys_id_fk", + "tableFrom": "api_key_resources", + "tableTo": "api_keys", + "columnsFrom": [ + "api_key_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "api_key_resources_target_id_targets_id_fk": { + "name": "api_key_resources_target_id_targets_id_fk", + "tableFrom": "api_key_resources", + "tableTo": "targets", + "columnsFrom": [ + "target_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.api_keys": { + "name": "api_keys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "group_id": { + "name": "group_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "external": { + "name": "external", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "apikey_name_idx": { + "name": "apikey_name_idx", + "columns": [ + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "ak_user_id_idx": { + "name": "ak_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "ak_organization_id_idx": { + "name": "ak_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "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": "cascade", + "onUpdate": "no action" + }, + "api_keys_organization_id_organizations_id_fk": { + "name": "api_keys_organization_id_organizations_id_fk", + "tableFrom": "api_keys", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "api_keys_group_id_organization_groups_id_fk": { + "name": "api_keys_group_id_organization_groups_id_fk", + "tableFrom": "api_keys", + "tableTo": "organization_groups", + "columnsFrom": [ + "group_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "api_keys_key_unique": { + "name": "api_keys_key_unique", + "nullsNotDistinct": false, + "columns": [ + "key" + ] + } + }, + "checkConstraints": {} + }, + "public.audit_logs": { + "name": "audit_logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "organization_slug": { + "name": "organization_slug", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "audit_action": { + "name": "audit_action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "auditable_type": { + "name": "auditable_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "auditable_display_name": { + "name": "auditable_display_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "target_type": { + "name": "target_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "target_display_name": { + "name": "target_display_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "target_namespace_id": { + "name": "target_namespace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "target_namespace": { + "name": "target_namespace", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "actor_id": { + "name": "actor_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "actor_display_name": { + "name": "actor_display_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "actor_type": { + "name": "actor_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "api_key_name": { + "name": "api_key_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "auditlogs_organization_idx": { + "name": "auditlogs_organization_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "auditlogs_created_at_idx": { + "name": "auditlogs_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.billing_plans": { + "name": "billing_plans", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "price": { + "name": "price", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "features": { + "name": "features", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "stripe_price_id": { + "name": "stripe_price_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "weight": { + "name": "weight", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.billing_subscriptions": { + "name": "billing_subscriptions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "price_id": { + "name": "price_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "quantity": { + "name": "quantity", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "cancel_at_period_end": { + "name": "cancel_at_period_end", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "cancel_at": { + "name": "cancel_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "canceled_at": { + "name": "canceled_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "current_period_start": { + "name": "current_period_start", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "current_period_end": { + "name": "current_period_end", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "ended_at": { + "name": "ended_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "trial_start": { + "name": "trial_start", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "trial_end": { + "name": "trial_end", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "billsubs_organization_id_idx": { + "name": "billsubs_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "billing_subscriptions_organization_id_organizations_id_fk": { + "name": "billing_subscriptions_organization_id_organizations_id_fk", + "tableFrom": "billing_subscriptions", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.cache_warmer_operations": { + "name": "cache_warmer_operations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "federated_graph_id": { + "name": "federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "operation_content": { + "name": "operation_content", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "operation_hash": { + "name": "operation_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "operation_persisted_id": { + "name": "operation_persisted_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "operation_name": { + "name": "operation_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "client_name": { + "name": "client_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "client_version": { + "name": "client_version", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "planning_time": { + "name": "planning_time", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "is_manually_added": { + "name": "is_manually_added", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_by_id": { + "name": "created_by_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "cwo_organization_id_idx": { + "name": "cwo_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "cwo_federated_graph_id_idx": { + "name": "cwo_federated_graph_id_idx", + "columns": [ + { + "expression": "federated_graph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "cwo_created_by_id_idx": { + "name": "cwo_created_by_id_idx", + "columns": [ + { + "expression": "created_by_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "cache_warmer_operations_organization_id_organizations_id_fk": { + "name": "cache_warmer_operations_organization_id_organizations_id_fk", + "tableFrom": "cache_warmer_operations", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cache_warmer_operations_federated_graph_id_federated_graphs_id_fk": { + "name": "cache_warmer_operations_federated_graph_id_federated_graphs_id_fk", + "tableFrom": "cache_warmer_operations", + "tableTo": "federated_graphs", + "columnsFrom": [ + "federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cache_warmer_operations_created_by_id_users_id_fk": { + "name": "cache_warmer_operations_created_by_id_users_id_fk", + "tableFrom": "cache_warmer_operations", + "tableTo": "users", + "columnsFrom": [ + "created_by_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.contracts": { + "name": "contracts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "source_federated_graph_id": { + "name": "source_federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "downstream_federated_graph_id": { + "name": "downstream_federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "exclude_tags": { + "name": "exclude_tags", + "type": "text[]", + "primaryKey": false, + "notNull": true + }, + "include_tags": { + "name": "include_tags", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'::text[]" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_by_id": { + "name": "created_by_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "updated_by_id": { + "name": "updated_by_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "contracts_created_by_id_idx": { + "name": "contracts_created_by_id_idx", + "columns": [ + { + "expression": "created_by_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "contracts_updated_by_id_idx": { + "name": "contracts_updated_by_id_idx", + "columns": [ + { + "expression": "updated_by_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "contracts_downstream_federated_graph_id_idx": { + "name": "contracts_downstream_federated_graph_id_idx", + "columns": [ + { + "expression": "downstream_federated_graph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "contracts_source_federated_graph_id_federated_graphs_id_fk": { + "name": "contracts_source_federated_graph_id_federated_graphs_id_fk", + "tableFrom": "contracts", + "tableTo": "federated_graphs", + "columnsFrom": [ + "source_federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contracts_downstream_federated_graph_id_federated_graphs_id_fk": { + "name": "contracts_downstream_federated_graph_id_federated_graphs_id_fk", + "tableFrom": "contracts", + "tableTo": "federated_graphs", + "columnsFrom": [ + "downstream_federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "contracts_created_by_id_users_id_fk": { + "name": "contracts_created_by_id_users_id_fk", + "tableFrom": "contracts", + "tableTo": "users", + "columnsFrom": [ + "created_by_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "contracts_updated_by_id_users_id_fk": { + "name": "contracts_updated_by_id_users_id_fk", + "tableFrom": "contracts", + "tableTo": "users", + "columnsFrom": [ + "updated_by_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "federated_graph_source_downstream_id": { + "name": "federated_graph_source_downstream_id", + "nullsNotDistinct": false, + "columns": [ + "source_federated_graph_id", + "downstream_federated_graph_id" + ] + } + }, + "checkConstraints": {} + }, + "public.feature_flags_to_feature_subgraphs": { + "name": "feature_flags_to_feature_subgraphs", + "schema": "", + "columns": { + "feature_flag_id": { + "name": "feature_flag_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "feature_subgraph_id": { + "name": "feature_subgraph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "fffs_feature_flag_id_idx": { + "name": "fffs_feature_flag_id_idx", + "columns": [ + { + "expression": "feature_flag_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "fffs_feature_subgraph_id_idx": { + "name": "fffs_feature_subgraph_id_idx", + "columns": [ + { + "expression": "feature_subgraph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "feature_flags_to_feature_subgraphs_feature_flag_id_feature_flags_id_fk": { + "name": "feature_flags_to_feature_subgraphs_feature_flag_id_feature_flags_id_fk", + "tableFrom": "feature_flags_to_feature_subgraphs", + "tableTo": "feature_flags", + "columnsFrom": [ + "feature_flag_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "feature_flags_to_feature_subgraphs_feature_subgraph_id_subgraphs_id_fk": { + "name": "feature_flags_to_feature_subgraphs_feature_subgraph_id_subgraphs_id_fk", + "tableFrom": "feature_flags_to_feature_subgraphs", + "tableTo": "subgraphs", + "columnsFrom": [ + "feature_subgraph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "feature_flags_to_feature_subgraphs_feature_flag_id_feature_subgraph_id_pk": { + "name": "feature_flags_to_feature_subgraphs_feature_flag_id_feature_subgraph_id_pk", + "columns": [ + "feature_flag_id", + "feature_subgraph_id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.feature_flags": { + "name": "feature_flags", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "namespace_id": { + "name": "namespace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "labels": { + "name": "labels", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "is_enabled": { + "name": "is_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "ff_organization_id_idx": { + "name": "ff_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "ff_namespace_id_idx": { + "name": "ff_namespace_id_idx", + "columns": [ + { + "expression": "namespace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "ff_created_by_idx": { + "name": "ff_created_by_idx", + "columns": [ + { + "expression": "created_by", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "feature_flags_organization_id_organizations_id_fk": { + "name": "feature_flags_organization_id_organizations_id_fk", + "tableFrom": "feature_flags", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "feature_flags_namespace_id_namespaces_id_fk": { + "name": "feature_flags_namespace_id_namespaces_id_fk", + "tableFrom": "feature_flags", + "tableTo": "namespaces", + "columnsFrom": [ + "namespace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "feature_flags_created_by_users_id_fk": { + "name": "feature_flags_created_by_users_id_fk", + "tableFrom": "feature_flags", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.feature_subgraphs_to_base_subgraphs": { + "name": "feature_subgraphs_to_base_subgraphs", + "schema": "", + "columns": { + "feature_subgraph_id": { + "name": "feature_subgraph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "base_subgraph_id": { + "name": "base_subgraph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "fsbs_feature_subgraph_id_idx": { + "name": "fsbs_feature_subgraph_id_idx", + "columns": [ + { + "expression": "feature_subgraph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "fsbs_base_subgraph_id_idx": { + "name": "fsbs_base_subgraph_id_idx", + "columns": [ + { + "expression": "base_subgraph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "feature_subgraphs_to_base_subgraphs_feature_subgraph_id_subgraphs_id_fk": { + "name": "feature_subgraphs_to_base_subgraphs_feature_subgraph_id_subgraphs_id_fk", + "tableFrom": "feature_subgraphs_to_base_subgraphs", + "tableTo": "subgraphs", + "columnsFrom": [ + "feature_subgraph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "feature_subgraphs_to_base_subgraphs_base_subgraph_id_subgraphs_id_fk": { + "name": "feature_subgraphs_to_base_subgraphs_base_subgraph_id_subgraphs_id_fk", + "tableFrom": "feature_subgraphs_to_base_subgraphs", + "tableTo": "subgraphs", + "columnsFrom": [ + "base_subgraph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "feature_subgraphs_to_base_subgraphs_feature_subgraph_id_base_subgraph_id_pk": { + "name": "feature_subgraphs_to_base_subgraphs_feature_subgraph_id_base_subgraph_id_pk", + "columns": [ + "feature_subgraph_id", + "base_subgraph_id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.federated_graph_clients": { + "name": "federated_graph_clients", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "federated_graph_id": { + "name": "federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_by_id": { + "name": "created_by_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "updated_by_id": { + "name": "updated_by_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "fgc_created_by_id_idx": { + "name": "fgc_created_by_id_idx", + "columns": [ + { + "expression": "created_by_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "fgc_updated_by_id_idx": { + "name": "fgc_updated_by_id_idx", + "columns": [ + { + "expression": "updated_by_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "federated_graph_clients_federated_graph_id_federated_graphs_id_fk": { + "name": "federated_graph_clients_federated_graph_id_federated_graphs_id_fk", + "tableFrom": "federated_graph_clients", + "tableTo": "federated_graphs", + "columnsFrom": [ + "federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "federated_graph_clients_created_by_id_users_id_fk": { + "name": "federated_graph_clients_created_by_id_users_id_fk", + "tableFrom": "federated_graph_clients", + "tableTo": "users", + "columnsFrom": [ + "created_by_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "federated_graph_clients_updated_by_id_users_id_fk": { + "name": "federated_graph_clients_updated_by_id_users_id_fk", + "tableFrom": "federated_graph_clients", + "tableTo": "users", + "columnsFrom": [ + "updated_by_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "federated_graph_client_name": { + "name": "federated_graph_client_name", + "nullsNotDistinct": false, + "columns": [ + "federated_graph_id", + "name" + ] + } + }, + "checkConstraints": {} + }, + "public.federated_graph_persisted_operations": { + "name": "federated_graph_persisted_operations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "federated_graph_id": { + "name": "federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "client_id": { + "name": "client_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "operation_id": { + "name": "operation_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "hash": { + "name": "hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "file_path": { + "name": "file_path", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "operation_names": { + "name": "operation_names", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "operation_content": { + "name": "operation_content", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by_id": { + "name": "created_by_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "updated_by_id": { + "name": "updated_by_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "valid_on_base_graph": { + "name": "valid_on_base_graph", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + } + }, + "indexes": { + "fgpo_created_by_id_idx": { + "name": "fgpo_created_by_id_idx", + "columns": [ + { + "expression": "created_by_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "fgpo_updated_by_id_idx": { + "name": "fgpo_updated_by_id_idx", + "columns": [ + { + "expression": "updated_by_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "fgpo_client_id_idx": { + "name": "fgpo_client_id_idx", + "columns": [ + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "federated_graph_persisted_operations_federated_graph_id_federated_graphs_id_fk": { + "name": "federated_graph_persisted_operations_federated_graph_id_federated_graphs_id_fk", + "tableFrom": "federated_graph_persisted_operations", + "tableTo": "federated_graphs", + "columnsFrom": [ + "federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "federated_graph_persisted_operations_client_id_federated_graph_clients_id_fk": { + "name": "federated_graph_persisted_operations_client_id_federated_graph_clients_id_fk", + "tableFrom": "federated_graph_persisted_operations", + "tableTo": "federated_graph_clients", + "columnsFrom": [ + "client_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "federated_graph_persisted_operations_created_by_id_users_id_fk": { + "name": "federated_graph_persisted_operations_created_by_id_users_id_fk", + "tableFrom": "federated_graph_persisted_operations", + "tableTo": "users", + "columnsFrom": [ + "created_by_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "federated_graph_persisted_operations_updated_by_id_users_id_fk": { + "name": "federated_graph_persisted_operations_updated_by_id_users_id_fk", + "tableFrom": "federated_graph_persisted_operations", + "tableTo": "users", + "columnsFrom": [ + "updated_by_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "federated_graph_persisted_operations_file_path_unique": { + "name": "federated_graph_persisted_operations_file_path_unique", + "nullsNotDistinct": false, + "columns": [ + "file_path" + ] + }, + "federated_graph_operation_id": { + "name": "federated_graph_operation_id", + "nullsNotDistinct": false, + "columns": [ + "federated_graph_id", + "client_id", + "operation_id" + ] + } + }, + "checkConstraints": {} + }, + "public.federated_graphs": { + "name": "federated_graphs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "routing_url": { + "name": "routing_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "composed_schema_version_id": { + "name": "composed_schema_version_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "admission_webhook_url": { + "name": "admission_webhook_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "admission_webhook_secret": { + "name": "admission_webhook_secret", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "supports_federation": { + "name": "supports_federation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "router_compatibility_version": { + "name": "router_compatibility_version", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'1'" + } + }, + "indexes": { + "fgs_target_id_idx": { + "name": "fgs_target_id_idx", + "columns": [ + { + "expression": "target_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "fgs_composed_schema_version_id_idx": { + "name": "fgs_composed_schema_version_id_idx", + "columns": [ + { + "expression": "composed_schema_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "federated_graphs_target_id_targets_id_fk": { + "name": "federated_graphs_target_id_targets_id_fk", + "tableFrom": "federated_graphs", + "tableTo": "targets", + "columnsFrom": [ + "target_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "federated_graphs_composed_schema_version_id_schema_versions_id_fk": { + "name": "federated_graphs_composed_schema_version_id_schema_versions_id_fk", + "tableFrom": "federated_graphs", + "tableTo": "schema_versions", + "columnsFrom": [ + "composed_schema_version_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.federated_graphs_to_feature_flag_schema_versions": { + "name": "federated_graphs_to_feature_flag_schema_versions", + "schema": "", + "columns": { + "federated_graph_id": { + "name": "federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "base_composition_schema_version_id": { + "name": "base_composition_schema_version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "composed_schema_version_id": { + "name": "composed_schema_version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "feature_flag_id": { + "name": "feature_flag_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "fgffsv_federated_graph_id_idx": { + "name": "fgffsv_federated_graph_id_idx", + "columns": [ + { + "expression": "federated_graph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "fgffsv_base_composition_schema_version_id_idx": { + "name": "fgffsv_base_composition_schema_version_id_idx", + "columns": [ + { + "expression": "base_composition_schema_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "fgffsv_composed_schema_version_id_idx": { + "name": "fgffsv_composed_schema_version_id_idx", + "columns": [ + { + "expression": "composed_schema_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "fgffsv_feature_flag_id_idx": { + "name": "fgffsv_feature_flag_id_idx", + "columns": [ + { + "expression": "feature_flag_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "federated_graphs_to_feature_flag_schema_versions_federated_graph_id_federated_graphs_id_fk": { + "name": "federated_graphs_to_feature_flag_schema_versions_federated_graph_id_federated_graphs_id_fk", + "tableFrom": "federated_graphs_to_feature_flag_schema_versions", + "tableTo": "federated_graphs", + "columnsFrom": [ + "federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "federated_graphs_to_feature_flag_schema_versions_base_composition_schema_version_id_schema_versions_id_fk": { + "name": "federated_graphs_to_feature_flag_schema_versions_base_composition_schema_version_id_schema_versions_id_fk", + "tableFrom": "federated_graphs_to_feature_flag_schema_versions", + "tableTo": "schema_versions", + "columnsFrom": [ + "base_composition_schema_version_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "federated_graphs_to_feature_flag_schema_versions_composed_schema_version_id_schema_versions_id_fk": { + "name": "federated_graphs_to_feature_flag_schema_versions_composed_schema_version_id_schema_versions_id_fk", + "tableFrom": "federated_graphs_to_feature_flag_schema_versions", + "tableTo": "schema_versions", + "columnsFrom": [ + "composed_schema_version_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "federated_graphs_to_feature_flag_schema_versions_feature_flag_id_feature_flags_id_fk": { + "name": "federated_graphs_to_feature_flag_schema_versions_feature_flag_id_feature_flags_id_fk", + "tableFrom": "federated_graphs_to_feature_flag_schema_versions", + "tableTo": "feature_flags", + "columnsFrom": [ + "feature_flag_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "federated_graphs_to_feature_flag_schema_versions_federated_graph_id_base_composition_schema_version_id_composed_schema_version_id_pk": { + "name": "federated_graphs_to_feature_flag_schema_versions_federated_graph_id_base_composition_schema_version_id_composed_schema_version_id_pk", + "columns": [ + "federated_graph_id", + "base_composition_schema_version_id", + "composed_schema_version_id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.field_grace_period": { + "name": "field_grace_period", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "subgraph_id": { + "name": "subgraph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "namespace_id": { + "name": "namespace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "is_deprecated": { + "name": "is_deprecated", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "unique_field_grace_period_idx": { + "name": "unique_field_grace_period_idx", + "columns": [ + { + "expression": "subgraph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "namespace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "path", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "is_deprecated", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "fgp_subgraph_id_idx": { + "name": "fgp_subgraph_id_idx", + "columns": [ + { + "expression": "subgraph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "fgp_organization_id_idx": { + "name": "fgp_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "fgp_namespace_id_idx": { + "name": "fgp_namespace_id_idx", + "columns": [ + { + "expression": "namespace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "field_grace_period_subgraph_id_subgraphs_id_fk": { + "name": "field_grace_period_subgraph_id_subgraphs_id_fk", + "tableFrom": "field_grace_period", + "tableTo": "subgraphs", + "columnsFrom": [ + "subgraph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "field_grace_period_organization_id_organizations_id_fk": { + "name": "field_grace_period_organization_id_organizations_id_fk", + "tableFrom": "field_grace_period", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "field_grace_period_namespace_id_namespaces_id_fk": { + "name": "field_grace_period_namespace_id_namespaces_id_fk", + "tableFrom": "field_grace_period", + "tableTo": "namespaces", + "columnsFrom": [ + "namespace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.git_installations": { + "name": "git_installations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "git_installation_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "provider_account_id": { + "name": "provider_account_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "provider_installation_id": { + "name": "provider_installation_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "provider_name": { + "name": "provider_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "oauth_token": { + "name": "oauth_token", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.graph_api_tokens": { + "name": "graph_api_tokens", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "federated_graph_id": { + "name": "federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "graphApiToken_name_idx": { + "name": "graphApiToken_name_idx", + "columns": [ + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "federated_graph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "gat_organization_id_idx": { + "name": "gat_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "gat_federated_graph_id_idx": { + "name": "gat_federated_graph_id_idx", + "columns": [ + { + "expression": "federated_graph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "gat_created_by_idx": { + "name": "gat_created_by_idx", + "columns": [ + { + "expression": "created_by", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "graph_api_tokens_organization_id_organizations_id_fk": { + "name": "graph_api_tokens_organization_id_organizations_id_fk", + "tableFrom": "graph_api_tokens", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "graph_api_tokens_federated_graph_id_federated_graphs_id_fk": { + "name": "graph_api_tokens_federated_graph_id_federated_graphs_id_fk", + "tableFrom": "graph_api_tokens", + "tableTo": "federated_graphs", + "columnsFrom": [ + "federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "graph_api_tokens_created_by_users_id_fk": { + "name": "graph_api_tokens_created_by_users_id_fk", + "tableFrom": "graph_api_tokens", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "graph_api_tokens_token_unique": { + "name": "graph_api_tokens_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + } + }, + "checkConstraints": {} + }, + "public.graph_composition_subgraphs": { + "name": "graph_composition_subgraphs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "graph_composition_id": { + "name": "graph_composition_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "subgraph_id": { + "name": "subgraph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "subgraph_target_id": { + "name": "subgraph_target_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "subgraph_name": { + "name": "subgraph_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "schema_version_id": { + "name": "schema_version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "change_type": { + "name": "change_type", + "type": "graph_composition_subgraph_change_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'unchanged'" + }, + "is_feature_subgraph": { + "name": "is_feature_subgraph", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "graphcompsub_graph_composition_id_idx": { + "name": "graphcompsub_graph_composition_id_idx", + "columns": [ + { + "expression": "graph_composition_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "graphcompsub_schema_version_id_idx": { + "name": "graphcompsub_schema_version_id_idx", + "columns": [ + { + "expression": "schema_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "graph_composition_subgraphs_graph_composition_id_graph_compositions_id_fk": { + "name": "graph_composition_subgraphs_graph_composition_id_graph_compositions_id_fk", + "tableFrom": "graph_composition_subgraphs", + "tableTo": "graph_compositions", + "columnsFrom": [ + "graph_composition_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "graph_composition_subgraphs_schema_version_id_schema_versions_id_fk": { + "name": "graph_composition_subgraphs_schema_version_id_schema_versions_id_fk", + "tableFrom": "graph_composition_subgraphs", + "tableTo": "schema_versions", + "columnsFrom": [ + "schema_version_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.graph_compositions": { + "name": "graph_compositions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "schema_version_id": { + "name": "schema_version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "is_composable": { + "name": "is_composable", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "composition_errors": { + "name": "composition_errors", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "composition_warnings": { + "name": "composition_warnings", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "router_config_signature": { + "name": "router_config_signature", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "deployment_error": { + "name": "deployment_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "admission_error": { + "name": "admission_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by_id": { + "name": "created_by_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_by_email": { + "name": "created_by_email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_feature_flag_composition": { + "name": "is_feature_flag_composition", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "router_compatibility_version": { + "name": "router_compatibility_version", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'1'" + } + }, + "indexes": { + "graphcomp_schema_version_id_idx": { + "name": "graphcomp_schema_version_id_idx", + "columns": [ + { + "expression": "schema_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "graphcomp_created_by_id_idx": { + "name": "graphcomp_created_by_id_idx", + "columns": [ + { + "expression": "created_by_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "graph_compositions_schema_version_id_schema_versions_id_fk": { + "name": "graph_compositions_schema_version_id_schema_versions_id_fk", + "tableFrom": "graph_compositions", + "tableTo": "schema_versions", + "columnsFrom": [ + "schema_version_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "graph_compositions_created_by_id_users_id_fk": { + "name": "graph_compositions_created_by_id_users_id_fk", + "tableFrom": "graph_compositions", + "tableTo": "users", + "columnsFrom": [ + "created_by_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.graph_request_keys": { + "name": "graph_request_keys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "federated_graph_id": { + "name": "federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "privateKey": { + "name": "privateKey", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "publicKey": { + "name": "publicKey", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "grk_organization_id_idx": { + "name": "grk_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "grk_federated_graph_id_idx": { + "name": "grk_federated_graph_id_idx", + "columns": [ + { + "expression": "federated_graph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "graph_request_keys_organization_id_organizations_id_fk": { + "name": "graph_request_keys_organization_id_organizations_id_fk", + "tableFrom": "graph_request_keys", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "graph_request_keys_federated_graph_id_federated_graphs_id_fk": { + "name": "graph_request_keys_federated_graph_id_federated_graphs_id_fk", + "tableFrom": "graph_request_keys", + "tableTo": "federated_graphs", + "columnsFrom": [ + "federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "graph_request_keys_federated_graph_id_unique": { + "name": "graph_request_keys_federated_graph_id_unique", + "nullsNotDistinct": false, + "columns": [ + "federated_graph_id" + ] + }, + "graph_request_keys_privateKey_unique": { + "name": "graph_request_keys_privateKey_unique", + "nullsNotDistinct": false, + "columns": [ + "privateKey" + ] + }, + "graph_request_keys_publicKey_unique": { + "name": "graph_request_keys_publicKey_unique", + "nullsNotDistinct": false, + "columns": [ + "publicKey" + ] + } + }, + "checkConstraints": {} + }, + "public.linked_schema_checks": { + "name": "linked_schema_checks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "schema_check_id": { + "name": "schema_check_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "linked_schema_check_id": { + "name": "linked_schema_check_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "lsc_schema_check_id_linked_schema_check_id_unique": { + "name": "lsc_schema_check_id_linked_schema_check_id_unique", + "columns": [ + { + "expression": "schema_check_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "linked_schema_check_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "lsc_schema_check_id_idx": { + "name": "lsc_schema_check_id_idx", + "columns": [ + { + "expression": "schema_check_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "lsc_linked_schema_check_id_idx": { + "name": "lsc_linked_schema_check_id_idx", + "columns": [ + { + "expression": "linked_schema_check_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "linked_schema_checks_schema_check_id_schema_checks_id_fk": { + "name": "linked_schema_checks_schema_check_id_schema_checks_id_fk", + "tableFrom": "linked_schema_checks", + "tableTo": "schema_checks", + "columnsFrom": [ + "schema_check_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "linked_schema_checks_linked_schema_check_id_schema_checks_id_fk": { + "name": "linked_schema_checks_linked_schema_check_id_schema_checks_id_fk", + "tableFrom": "linked_schema_checks", + "tableTo": "schema_checks", + "columnsFrom": [ + "linked_schema_check_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.linked_subgraphs": { + "name": "linked_subgraphs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "source_subgraph_id": { + "name": "source_subgraph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "target_subgraph_id": { + "name": "target_subgraph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by_id": { + "name": "created_by_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "ls_source_subgraph_id_idx": { + "name": "ls_source_subgraph_id_idx", + "columns": [ + { + "expression": "source_subgraph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "ls_target_subgraph_id_idx": { + "name": "ls_target_subgraph_id_idx", + "columns": [ + { + "expression": "target_subgraph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "ls_created_by_id_idx": { + "name": "ls_created_by_id_idx", + "columns": [ + { + "expression": "created_by_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "linked_subgraphs_source_subgraph_id_subgraphs_id_fk": { + "name": "linked_subgraphs_source_subgraph_id_subgraphs_id_fk", + "tableFrom": "linked_subgraphs", + "tableTo": "subgraphs", + "columnsFrom": [ + "source_subgraph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "linked_subgraphs_target_subgraph_id_subgraphs_id_fk": { + "name": "linked_subgraphs_target_subgraph_id_subgraphs_id_fk", + "tableFrom": "linked_subgraphs", + "tableTo": "subgraphs", + "columnsFrom": [ + "target_subgraph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "linked_subgraphs_created_by_id_users_id_fk": { + "name": "linked_subgraphs_created_by_id_users_id_fk", + "tableFrom": "linked_subgraphs", + "tableTo": "users", + "columnsFrom": [ + "created_by_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "linked_subgraphs_source_subgraph_id_unique": { + "name": "linked_subgraphs_source_subgraph_id_unique", + "nullsNotDistinct": false, + "columns": [ + "source_subgraph_id" + ] + } + }, + "checkConstraints": {} + }, + "public.namespace_cache_warmer_config": { + "name": "namespace_cache_warmer_config", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "namespace_id": { + "name": "namespace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "max_operations_count": { + "name": "max_operations_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "nscwc_namespace_id_idx": { + "name": "nscwc_namespace_id_idx", + "columns": [ + { + "expression": "namespace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "namespace_cache_warmer_config_namespace_id_namespaces_id_fk": { + "name": "namespace_cache_warmer_config_namespace_id_namespaces_id_fk", + "tableFrom": "namespace_cache_warmer_config", + "tableTo": "namespaces", + "columnsFrom": [ + "namespace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "namespace_cache_warmer_config_namespace_id_unique": { + "name": "namespace_cache_warmer_config_namespace_id_unique", + "nullsNotDistinct": false, + "columns": [ + "namespace_id" + ] + } + }, + "checkConstraints": {} + }, + "public.namespace_config": { + "name": "namespace_config", + "schema": "", + "columns": { + "namespace_id": { + "name": "namespace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "enable_linting": { + "name": "enable_linting", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "enable_graph_pruning": { + "name": "enable_graph_pruning", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "enable_cache_warming": { + "name": "enable_cache_warming", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "checks_timeframe_in_days": { + "name": "checks_timeframe_in_days", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "enable_proposals": { + "name": "enable_proposals", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "enable_subgraph_check_extensions": { + "name": "enable_subgraph_check_extensions", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "namespace_config_namespace_id_namespaces_id_fk": { + "name": "namespace_config_namespace_id_namespaces_id_fk", + "tableFrom": "namespace_config", + "tableTo": "namespaces", + "columnsFrom": [ + "namespace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "unique_namespace": { + "name": "unique_namespace", + "nullsNotDistinct": false, + "columns": [ + "namespace_id" + ] + } + }, + "checkConstraints": {} + }, + "public.namespace_graph_pruning_check_config": { + "name": "namespace_graph_pruning_check_config", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "namespace_id": { + "name": "namespace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "graph_pruning_rule": { + "name": "graph_pruning_rule", + "type": "graph_pruning_rules", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "severity_level": { + "name": "severity_level", + "type": "lint_severity", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "grace_period": { + "name": "grace_period", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "scheme_usage_check_period": { + "name": "scheme_usage_check_period", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "nsgpcc_namespace_id_idx": { + "name": "nsgpcc_namespace_id_idx", + "columns": [ + { + "expression": "namespace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "namespace_graph_pruning_check_config_namespace_id_namespaces_id_fk": { + "name": "namespace_graph_pruning_check_config_namespace_id_namespaces_id_fk", + "tableFrom": "namespace_graph_pruning_check_config", + "tableTo": "namespaces", + "columnsFrom": [ + "namespace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.namespace_lint_check_config": { + "name": "namespace_lint_check_config", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "namespace_id": { + "name": "namespace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "lint_rule": { + "name": "lint_rule", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "severity_level": { + "name": "severity_level", + "type": "lint_severity", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "nslcc_namespace_id_idx": { + "name": "nslcc_namespace_id_idx", + "columns": [ + { + "expression": "namespace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "namespace_lint_check_config_namespace_id_namespaces_id_fk": { + "name": "namespace_lint_check_config_namespace_id_namespaces_id_fk", + "tableFrom": "namespace_lint_check_config", + "tableTo": "namespaces", + "columnsFrom": [ + "namespace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.namespace_proposal_config": { + "name": "namespace_proposal_config", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "namespace_id": { + "name": "namespace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "check_severity_level": { + "name": "check_severity_level", + "type": "lint_severity", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "publish_severity_level": { + "name": "publish_severity_level", + "type": "lint_severity", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "namespace_proposal_config_namespace_id_namespaces_id_fk": { + "name": "namespace_proposal_config_namespace_id_namespaces_id_fk", + "tableFrom": "namespace_proposal_config", + "tableTo": "namespaces", + "columnsFrom": [ + "namespace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "npc_namespace_id_idx": { + "name": "npc_namespace_id_idx", + "nullsNotDistinct": false, + "columns": [ + "namespace_id" + ] + } + }, + "checkConstraints": {} + }, + "public.namespace_subgraph_check_extensions_config": { + "name": "namespace_subgraph_check_extensions_config", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "namespace_id": { + "name": "namespace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "endpoint": { + "name": "endpoint", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret_key": { + "name": "secret_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "include_composed_sdl": { + "name": "include_composed_sdl", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "include_linting_issues": { + "name": "include_linting_issues", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "include_pruning_issues": { + "name": "include_pruning_issues", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "include_schema_changes": { + "name": "include_schema_changes", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "include_affected_operations": { + "name": "include_affected_operations", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "nsce_namespace_id_idx": { + "name": "nsce_namespace_id_idx", + "columns": [ + { + "expression": "namespace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "namespace_subgraph_check_extensions_config_namespace_id_namespaces_id_fk": { + "name": "namespace_subgraph_check_extensions_config_namespace_id_namespaces_id_fk", + "tableFrom": "namespace_subgraph_check_extensions_config", + "tableTo": "namespaces", + "columnsFrom": [ + "namespace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "namespace_subgraph_check_extensions_config_namespace_id_unique": { + "name": "namespace_subgraph_check_extensions_config_namespace_id_unique", + "nullsNotDistinct": false, + "columns": [ + "namespace_id" + ] + } + }, + "checkConstraints": {} + }, + "public.namespaces": { + "name": "namespaces", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "ns_organization_id_idx": { + "name": "ns_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "ns_created_by_idx": { + "name": "ns_created_by_idx", + "columns": [ + { + "expression": "created_by", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "namespaces_organization_id_organizations_id_fk": { + "name": "namespaces_organization_id_organizations_id_fk", + "tableFrom": "namespaces", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "namespaces_created_by_users_id_fk": { + "name": "namespaces_created_by_users_id_fk", + "tableFrom": "namespaces", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "unique_name": { + "name": "unique_name", + "nullsNotDistinct": false, + "columns": [ + "name", + "organization_id" + ] + } + }, + "checkConstraints": {} + }, + "public.oidc_providers": { + "name": "oidc_providers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "alias": { + "name": "alias", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "endpoint": { + "name": "endpoint", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "oidcp_organization_id_idx": { + "name": "oidcp_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "oidc_providers_organization_id_organizations_id_fk": { + "name": "oidc_providers_organization_id_organizations_id_fk", + "tableFrom": "oidc_providers", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "oidc_providers_alias_unique": { + "name": "oidc_providers_alias_unique", + "nullsNotDistinct": false, + "columns": [ + "alias" + ] + } + }, + "checkConstraints": {} + }, + "public.operation_change_overrides": { + "name": "operation_change_overrides", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "hash": { + "name": "hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "namespace_id": { + "name": "namespace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "change_type": { + "name": "change_type", + "type": "schema_change_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "hash_change_idx": { + "name": "hash_change_idx", + "columns": [ + { + "expression": "hash", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "namespace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "change_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "path", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oco_created_by_idx": { + "name": "oco_created_by_idx", + "columns": [ + { + "expression": "created_by", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "operation_change_overrides_created_by_users_id_fk": { + "name": "operation_change_overrides_created_by_users_id_fk", + "tableFrom": "operation_change_overrides", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.operation_ignore_all_overrides": { + "name": "operation_ignore_all_overrides", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "hash": { + "name": "hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "namespace_id": { + "name": "namespace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "hash_namespace_ignore_idx": { + "name": "hash_namespace_ignore_idx", + "columns": [ + { + "expression": "hash", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "namespace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "oiao_created_by_idx": { + "name": "oiao_created_by_idx", + "columns": [ + { + "expression": "created_by", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "operation_ignore_all_overrides_created_by_users_id_fk": { + "name": "operation_ignore_all_overrides_created_by_users_id_fk", + "tableFrom": "operation_ignore_all_overrides", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.organization_billing": { + "name": "organization_billing", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "plan": { + "name": "plan", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "stripe_customer_id": { + "name": "stripe_customer_id", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "organization_billing_idx": { + "name": "organization_billing_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "organization_billing_stripe_idx": { + "name": "organization_billing_stripe_idx", + "columns": [ + { + "expression": "stripe_customer_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_billing_organization_id_organizations_id_fk": { + "name": "organization_billing_organization_id_organizations_id_fk", + "tableFrom": "organization_billing", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.organization_features": { + "name": "organization_features", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "feature": { + "name": "feature", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "limit": { + "name": "limit", + "type": "real", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "organization_feature_idx": { + "name": "organization_feature_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "feature", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "orgf_organization_id_idx": { + "name": "orgf_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_features_organization_id_organizations_id_fk": { + "name": "organization_features_organization_id_organizations_id_fk", + "tableFrom": "organization_features", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.organization_group_members": { + "name": "organization_group_members", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_member_id": { + "name": "organization_member_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "group_id": { + "name": "group_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "organization_member_group_idx": { + "name": "organization_member_group_idx", + "columns": [ + { + "expression": "organization_member_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_group_members_organization_member_id_organization_members_id_fk": { + "name": "organization_group_members_organization_member_id_organization_members_id_fk", + "tableFrom": "organization_group_members", + "tableTo": "organization_members", + "columnsFrom": [ + "organization_member_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_group_members_group_id_organization_groups_id_fk": { + "name": "organization_group_members_group_id_organization_groups_id_fk", + "tableFrom": "organization_group_members", + "tableTo": "organization_groups", + "columnsFrom": [ + "group_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.organization_group_rule_namespaces": { + "name": "organization_group_rule_namespaces", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "rule_id": { + "name": "rule_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "namespace_id": { + "name": "namespace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "organization_group_rule_namespaces_rule_id_organization_group_rules_id_fk": { + "name": "organization_group_rule_namespaces_rule_id_organization_group_rules_id_fk", + "tableFrom": "organization_group_rule_namespaces", + "tableTo": "organization_group_rules", + "columnsFrom": [ + "rule_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_group_rule_namespaces_namespace_id_namespaces_id_fk": { + "name": "organization_group_rule_namespaces_namespace_id_namespaces_id_fk", + "tableFrom": "organization_group_rule_namespaces", + "tableTo": "namespaces", + "columnsFrom": [ + "namespace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.organization_group_rule_targets": { + "name": "organization_group_rule_targets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "rule_id": { + "name": "rule_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "organization_group_rule_targets_rule_id_organization_group_rules_id_fk": { + "name": "organization_group_rule_targets_rule_id_organization_group_rules_id_fk", + "tableFrom": "organization_group_rule_targets", + "tableTo": "organization_group_rules", + "columnsFrom": [ + "rule_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_group_rule_targets_target_id_targets_id_fk": { + "name": "organization_group_rule_targets_target_id_targets_id_fk", + "tableFrom": "organization_group_rule_targets", + "tableTo": "targets", + "columnsFrom": [ + "target_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.organization_group_rules": { + "name": "organization_group_rules", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "group_id": { + "name": "group_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "organization_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "organization_group_rules_group_id_organization_groups_id_fk": { + "name": "organization_group_rules_group_id_organization_groups_id_fk", + "tableFrom": "organization_group_rules", + "tableTo": "organization_groups", + "columnsFrom": [ + "group_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.organization_groups": { + "name": "organization_groups", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "builtin": { + "name": "builtin", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "kc_group_id": { + "name": "kc_group_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "organization_groups_organization_id_organizations_id_fk": { + "name": "organization_groups_organization_id_organizations_id_fk", + "tableFrom": "organization_groups", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "organization_groups_kc_group_id_unique": { + "name": "organization_groups_kc_group_id_unique", + "nullsNotDistinct": false, + "columns": [ + "kc_group_id" + ] + } + }, + "checkConstraints": {} + }, + "public.organization_integrations": { + "name": "organization_integrations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "events": { + "name": "events", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "integration_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "organization_integration_idx": { + "name": "organization_integration_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "orgint_organization_id_idx": { + "name": "orgint_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_integrations_organization_id_organizations_id_fk": { + "name": "organization_integrations_organization_id_organizations_id_fk", + "tableFrom": "organization_integrations", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.organization_invitation_groups": { + "name": "organization_invitation_groups", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "invitation_id": { + "name": "invitation_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "group_id": { + "name": "group_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "org_inv_invitation_idx": { + "name": "org_inv_invitation_idx", + "columns": [ + { + "expression": "invitation_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "org_inv_group_id": { + "name": "org_inv_group_id", + "columns": [ + { + "expression": "group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_invitation_groups_invitation_id_organization_invitations_id_fk": { + "name": "organization_invitation_groups_invitation_id_organization_invitations_id_fk", + "tableFrom": "organization_invitation_groups", + "tableTo": "organization_invitations", + "columnsFrom": [ + "invitation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_invitation_groups_group_id_organization_groups_id_fk": { + "name": "organization_invitation_groups_group_id_organization_groups_id_fk", + "tableFrom": "organization_invitation_groups", + "tableTo": "organization_groups", + "columnsFrom": [ + "group_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.organization_invitations": { + "name": "organization_invitations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "invited_by": { + "name": "invited_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "accepted": { + "name": "accepted", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "last_sent_at": { + "name": "last_sent_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "orginv_organization_id_idx": { + "name": "orginv_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "orginv_user_id_idx": { + "name": "orginv_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "orginv_invited_by_idx": { + "name": "orginv_invited_by_idx", + "columns": [ + { + "expression": "invited_by", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_invitations_organization_id_organizations_id_fk": { + "name": "organization_invitations_organization_id_organizations_id_fk", + "tableFrom": "organization_invitations", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_invitations_user_id_users_id_fk": { + "name": "organization_invitations_user_id_users_id_fk", + "tableFrom": "organization_invitations", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_invitations_invited_by_users_id_fk": { + "name": "organization_invitations_invited_by_users_id_fk", + "tableFrom": "organization_invitations", + "tableTo": "users", + "columnsFrom": [ + "invited_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.organization_member_roles": { + "name": "organization_member_roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_member_id": { + "name": "organization_member_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "member_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "organization_member_role_idx": { + "name": "organization_member_role_idx", + "columns": [ + { + "expression": "organization_member_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "role", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_member_roles_organization_member_id_organization_members_id_fk": { + "name": "organization_member_roles_organization_member_id_organization_members_id_fk", + "tableFrom": "organization_member_roles", + "tableTo": "organization_members", + "columnsFrom": [ + "organization_member_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.organization_webhook_configs": { + "name": "organization_webhook_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "endpoint": { + "name": "endpoint", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "events": { + "name": "events", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "orgwc_organization_id_idx": { + "name": "orgwc_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_webhook_configs_organization_id_organizations_id_fk": { + "name": "organization_webhook_configs_organization_id_organizations_id_fk", + "tableFrom": "organization_webhook_configs", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.organizations": { + "name": "organizations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "invite_code": { + "name": "invite_code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "kc_group_id": { + "name": "kc_group_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_deactivated": { + "name": "is_deactivated", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "deactivation_reason": { + "name": "deactivation_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "deactivated_at": { + "name": "deactivated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "queued_for_deletion_at": { + "name": "queued_for_deletion_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "queued_for_deletion_by": { + "name": "queued_for_deletion_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "orgs_created_by_idx": { + "name": "orgs_created_by_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organizations_user_id_users_id_fk": { + "name": "organizations_user_id_users_id_fk", + "tableFrom": "organizations", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "organizations_slug_unique": { + "name": "organizations_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + }, + "organizations_kc_group_id_unique": { + "name": "organizations_kc_group_id_unique", + "nullsNotDistinct": false, + "columns": [ + "kc_group_id" + ] + } + }, + "checkConstraints": {} + }, + "public.organization_members": { + "name": "organization_members", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "organization_member_idx": { + "name": "organization_member_idx", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "unique_organization_member_idx": { + "name": "unique_organization_member_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "orgm_organization_id_idx": { + "name": "orgm_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "organization_members_user_id_users_id_fk": { + "name": "organization_members_user_id_users_id_fk", + "tableFrom": "organization_members", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "organization_members_organization_id_organizations_id_fk": { + "name": "organization_members_organization_id_organizations_id_fk", + "tableFrom": "organization_members", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.persisted_operation_to_feature_flags": { + "name": "persisted_operation_to_feature_flags", + "schema": "", + "columns": { + "persisted_operation_id": { + "name": "persisted_operation_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "feature_flag_id": { + "name": "feature_flag_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "persisted_operation_to_feature_flags_persisted_operation_id_federated_graph_persisted_operations_id_fk": { + "name": "persisted_operation_to_feature_flags_persisted_operation_id_federated_graph_persisted_operations_id_fk", + "tableFrom": "persisted_operation_to_feature_flags", + "tableTo": "federated_graph_persisted_operations", + "columnsFrom": [ + "persisted_operation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "persisted_operation_to_feature_flags_feature_flag_id_feature_flags_id_fk": { + "name": "persisted_operation_to_feature_flags_feature_flag_id_feature_flags_id_fk", + "tableFrom": "persisted_operation_to_feature_flags", + "tableTo": "feature_flags", + "columnsFrom": [ + "feature_flag_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "persisted_operation_to_feature_flags_persisted_operation_id_feature_flag_id_pk": { + "name": "persisted_operation_to_feature_flags_persisted_operation_id_feature_flag_id_pk", + "columns": [ + "persisted_operation_id", + "feature_flag_id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.playground_scripts": { + "name": "playground_scripts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by_id": { + "name": "created_by_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "type": { + "name": "type", + "type": "playground_script_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + } + }, + "indexes": { + "ps_organization_id_idx": { + "name": "ps_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "ps_created_by_id_idx": { + "name": "ps_created_by_id_idx", + "columns": [ + { + "expression": "created_by_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "playground_scripts_organization_id_organizations_id_fk": { + "name": "playground_scripts_organization_id_organizations_id_fk", + "tableFrom": "playground_scripts", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "playground_scripts_created_by_id_users_id_fk": { + "name": "playground_scripts_created_by_id_users_id_fk", + "tableFrom": "playground_scripts", + "tableTo": "users", + "columnsFrom": [ + "created_by_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.plugin_image_versions": { + "name": "plugin_image_versions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "schema_version_id": { + "name": "schema_version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "platform": { + "name": "platform", + "type": "text[]", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "plugin_image_versions_schema_version_id_schema_versions_id_fk": { + "name": "plugin_image_versions_schema_version_id_schema_versions_id_fk", + "tableFrom": "plugin_image_versions", + "tableTo": "schema_versions", + "columnsFrom": [ + "schema_version_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.proposal_checks": { + "name": "proposal_checks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "schema_check_id": { + "name": "schema_check_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "proposal_id": { + "name": "proposal_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "pc_check_id_proposal_id_idx": { + "name": "pc_check_id_proposal_id_idx", + "columns": [ + { + "expression": "schema_check_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "proposal_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "proposal_checks_schema_check_id_schema_checks_id_fk": { + "name": "proposal_checks_schema_check_id_schema_checks_id_fk", + "tableFrom": "proposal_checks", + "tableTo": "schema_checks", + "columnsFrom": [ + "schema_check_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "proposal_checks_proposal_id_proposals_id_fk": { + "name": "proposal_checks_proposal_id_proposals_id_fk", + "tableFrom": "proposal_checks", + "tableTo": "proposals", + "columnsFrom": [ + "proposal_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.proposal_subgraphs": { + "name": "proposal_subgraphs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "proposal_id": { + "name": "proposal_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "subgraph_id": { + "name": "subgraph_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "subgraph_name": { + "name": "subgraph_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "schema_sdl": { + "name": "schema_sdl", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_deleted": { + "name": "is_deleted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_new": { + "name": "is_new", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "is_published": { + "name": "is_published", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "current_schema_version_id": { + "name": "current_schema_version_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "labels": { + "name": "labels", + "type": "text[]", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "proposal_subgraphs_proposal_id_proposals_id_fk": { + "name": "proposal_subgraphs_proposal_id_proposals_id_fk", + "tableFrom": "proposal_subgraphs", + "tableTo": "proposals", + "columnsFrom": [ + "proposal_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "proposal_subgraphs_subgraph_id_subgraphs_id_fk": { + "name": "proposal_subgraphs_subgraph_id_subgraphs_id_fk", + "tableFrom": "proposal_subgraphs", + "tableTo": "subgraphs", + "columnsFrom": [ + "subgraph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "proposal_subgraphs_current_schema_version_id_schema_versions_id_fk": { + "name": "proposal_subgraphs_current_schema_version_id_schema_versions_id_fk", + "tableFrom": "proposal_subgraphs", + "tableTo": "schema_versions", + "columnsFrom": [ + "current_schema_version_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "proposal_subgraph": { + "name": "proposal_subgraph", + "nullsNotDistinct": false, + "columns": [ + "proposal_id", + "subgraph_name" + ] + } + }, + "checkConstraints": {} + }, + "public.proposals": { + "name": "proposals", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "federated_graph_id": { + "name": "federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by_id": { + "name": "created_by_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "proposal_state", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "origin": { + "name": "origin", + "type": "proposal_origin", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'INTERNAL'" + } + }, + "indexes": { + "pr_created_by_id_idx": { + "name": "pr_created_by_id_idx", + "columns": [ + { + "expression": "created_by_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "pr_federated_graph_id_idx": { + "name": "pr_federated_graph_id_idx", + "columns": [ + { + "expression": "federated_graph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "proposals_federated_graph_id_federated_graphs_id_fk": { + "name": "proposals_federated_graph_id_federated_graphs_id_fk", + "tableFrom": "proposals", + "tableTo": "federated_graphs", + "columnsFrom": [ + "federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "proposals_created_by_id_users_id_fk": { + "name": "proposals_created_by_id_users_id_fk", + "tableFrom": "proposals", + "tableTo": "users", + "columnsFrom": [ + "created_by_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "federated_graph_proposal_name": { + "name": "federated_graph_proposal_name", + "nullsNotDistinct": false, + "columns": [ + "federated_graph_id", + "name" + ] + } + }, + "checkConstraints": {} + }, + "public.protobuf_schema_versions": { + "name": "protobuf_schema_versions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "schema_version_id": { + "name": "schema_version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "proto_schema": { + "name": "proto_schema", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "proto_mappings": { + "name": "proto_mappings", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "proto_lock": { + "name": "proto_lock", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "protobuf_schema_versions_schema_version_id_schema_versions_id_fk": { + "name": "protobuf_schema_versions_schema_version_id_schema_versions_id_fk", + "tableFrom": "protobuf_schema_versions", + "tableTo": "schema_versions", + "columnsFrom": [ + "schema_version_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.schema_check_change_action": { + "name": "schema_check_change_action", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "schema_check_id": { + "name": "schema_check_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "change_type": { + "name": "change_type", + "type": "schema_change_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "change_message": { + "name": "change_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_breaking": { + "name": "is_breaking", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "schema_check_subgraph_id": { + "name": "schema_check_subgraph_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "is_fed_graph_change": { + "name": "is_fed_graph_change", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": { + "scca_schema_check_id_idx": { + "name": "scca_schema_check_id_idx", + "columns": [ + { + "expression": "schema_check_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "schema_check_change_action_schema_check_id_schema_checks_id_fk": { + "name": "schema_check_change_action_schema_check_id_schema_checks_id_fk", + "tableFrom": "schema_check_change_action", + "tableTo": "schema_checks", + "columnsFrom": [ + "schema_check_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "schema_check_change_action_schema_check_subgraph_id_schema_check_subgraphs_id_fk": { + "name": "schema_check_change_action_schema_check_subgraph_id_schema_check_subgraphs_id_fk", + "tableFrom": "schema_check_change_action", + "tableTo": "schema_check_subgraphs", + "columnsFrom": [ + "schema_check_subgraph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.schema_check_change_operation_usage": { + "name": "schema_check_change_operation_usage", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "schema_check_change_action_id": { + "name": "schema_check_change_action_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "hash": { + "name": "hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "first_seen_at": { + "name": "first_seen_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "federated_graph_id": { + "name": "federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "is_safe_override": { + "name": "is_safe_override", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": { + "sccou_schema_check_change_action_id_idx": { + "name": "sccou_schema_check_change_action_id_idx", + "columns": [ + { + "expression": "schema_check_change_action_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sccou_federated_graph_id_idx": { + "name": "sccou_federated_graph_id_idx", + "columns": [ + { + "expression": "federated_graph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "schema_check_change_operation_usage_schema_check_change_action_id_schema_check_change_action_id_fk": { + "name": "schema_check_change_operation_usage_schema_check_change_action_id_schema_check_change_action_id_fk", + "tableFrom": "schema_check_change_operation_usage", + "tableTo": "schema_check_change_action", + "columnsFrom": [ + "schema_check_change_action_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "schema_check_change_operation_usage_federated_graph_id_federated_graphs_id_fk": { + "name": "schema_check_change_operation_usage_federated_graph_id_federated_graphs_id_fk", + "tableFrom": "schema_check_change_operation_usage", + "tableTo": "federated_graphs", + "columnsFrom": [ + "federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.schema_check_composition": { + "name": "schema_check_composition", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "schema_check_id": { + "name": "schema_check_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "composition_errors": { + "name": "composition_errors", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "composition_warnings": { + "name": "composition_warnings", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "composed_schema_sdl": { + "name": "composed_schema_sdl", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "client_schema": { + "name": "client_schema", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "scc_schema_check_id_idx": { + "name": "scc_schema_check_id_idx", + "columns": [ + { + "expression": "schema_check_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scc_target_id_idx": { + "name": "scc_target_id_idx", + "columns": [ + { + "expression": "target_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "schema_check_composition_schema_check_id_schema_checks_id_fk": { + "name": "schema_check_composition_schema_check_id_schema_checks_id_fk", + "tableFrom": "schema_check_composition", + "tableTo": "schema_checks", + "columnsFrom": [ + "schema_check_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "schema_check_composition_target_id_targets_id_fk": { + "name": "schema_check_composition_target_id_targets_id_fk", + "tableFrom": "schema_check_composition", + "tableTo": "targets", + "columnsFrom": [ + "target_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.schema_check_federated_graph_changes": { + "name": "schema_check_federated_graph_changes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "schema_check_federated_graph_id": { + "name": "schema_check_federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "schema_check_change_action_id": { + "name": "schema_check_change_action_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "scfgsc_schema_check_federated_graph_id_idx": { + "name": "scfgsc_schema_check_federated_graph_id_idx", + "columns": [ + { + "expression": "schema_check_federated_graph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scfgsc_schema_check_change_action_id_idx": { + "name": "scfgsc_schema_check_change_action_id_idx", + "columns": [ + { + "expression": "schema_check_change_action_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scfgc_fed_graph_change_action_unique": { + "name": "scfgc_fed_graph_change_action_unique", + "columns": [ + { + "expression": "schema_check_federated_graph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "schema_check_change_action_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "schema_check_federated_graph_changes_schema_check_federated_graph_id_schema_check_federated_graphs_id_fk": { + "name": "schema_check_federated_graph_changes_schema_check_federated_graph_id_schema_check_federated_graphs_id_fk", + "tableFrom": "schema_check_federated_graph_changes", + "tableTo": "schema_check_federated_graphs", + "columnsFrom": [ + "schema_check_federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "schema_check_federated_graph_changes_schema_check_change_action_id_schema_check_change_action_id_fk": { + "name": "schema_check_federated_graph_changes_schema_check_change_action_id_schema_check_change_action_id_fk", + "tableFrom": "schema_check_federated_graph_changes", + "tableTo": "schema_check_change_action", + "columnsFrom": [ + "schema_check_change_action_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.schema_check_federated_graphs": { + "name": "schema_check_federated_graphs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "check_id": { + "name": "check_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "federated_graph_id": { + "name": "federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "traffic_check_days": { + "name": "traffic_check_days", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "scfg_check_id_idx": { + "name": "scfg_check_id_idx", + "columns": [ + { + "expression": "check_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scfg_federated_graph_id_idx": { + "name": "scfg_federated_graph_id_idx", + "columns": [ + { + "expression": "federated_graph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "schema_check_federated_graphs_check_id_schema_checks_id_fk": { + "name": "schema_check_federated_graphs_check_id_schema_checks_id_fk", + "tableFrom": "schema_check_federated_graphs", + "tableTo": "schema_checks", + "columnsFrom": [ + "check_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "schema_check_federated_graphs_federated_graph_id_federated_graphs_id_fk": { + "name": "schema_check_federated_graphs_federated_graph_id_federated_graphs_id_fk", + "tableFrom": "schema_check_federated_graphs", + "tableTo": "federated_graphs", + "columnsFrom": [ + "federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.schema_check_graph_pruning_action": { + "name": "schema_check_graph_pruning_action", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "schema_check_id": { + "name": "schema_check_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "graph_pruning_rule": { + "name": "graph_pruning_rule", + "type": "graph_pruning_rules", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "field_path": { + "name": "field_path", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_error": { + "name": "is_error", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "location": { + "name": "location", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "federated_graph_id": { + "name": "federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "schema_check_subgraph_id": { + "name": "schema_check_subgraph_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "scgpa_schema_check_id_idx": { + "name": "scgpa_schema_check_id_idx", + "columns": [ + { + "expression": "schema_check_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scgpa_federated_graph_id_idx": { + "name": "scgpa_federated_graph_id_idx", + "columns": [ + { + "expression": "federated_graph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "schema_check_graph_pruning_action_schema_check_id_schema_checks_id_fk": { + "name": "schema_check_graph_pruning_action_schema_check_id_schema_checks_id_fk", + "tableFrom": "schema_check_graph_pruning_action", + "tableTo": "schema_checks", + "columnsFrom": [ + "schema_check_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "schema_check_graph_pruning_action_federated_graph_id_federated_graphs_id_fk": { + "name": "schema_check_graph_pruning_action_federated_graph_id_federated_graphs_id_fk", + "tableFrom": "schema_check_graph_pruning_action", + "tableTo": "federated_graphs", + "columnsFrom": [ + "federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "schema_check_graph_pruning_action_schema_check_subgraph_id_schema_check_subgraphs_id_fk": { + "name": "schema_check_graph_pruning_action_schema_check_subgraph_id_schema_check_subgraphs_id_fk", + "tableFrom": "schema_check_graph_pruning_action", + "tableTo": "schema_check_subgraphs", + "columnsFrom": [ + "schema_check_subgraph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.schema_check_lint_action": { + "name": "schema_check_lint_action", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "schema_check_id": { + "name": "schema_check_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "lint_rule_type": { + "name": "lint_rule_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_error": { + "name": "is_error", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "location": { + "name": "location", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "schema_check_subgraph_id": { + "name": "schema_check_subgraph_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "sclact_schema_check_id_idx": { + "name": "sclact_schema_check_id_idx", + "columns": [ + { + "expression": "schema_check_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "schema_check_lint_action_schema_check_id_schema_checks_id_fk": { + "name": "schema_check_lint_action_schema_check_id_schema_checks_id_fk", + "tableFrom": "schema_check_lint_action", + "tableTo": "schema_checks", + "columnsFrom": [ + "schema_check_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "schema_check_lint_action_schema_check_subgraph_id_schema_check_subgraphs_id_fk": { + "name": "schema_check_lint_action_schema_check_subgraph_id_schema_check_subgraphs_id_fk", + "tableFrom": "schema_check_lint_action", + "tableTo": "schema_check_subgraphs", + "columnsFrom": [ + "schema_check_subgraph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.schema_check_proposal_match": { + "name": "schema_check_proposal_match", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "schema_check_id": { + "name": "schema_check_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "proposal_id": { + "name": "proposal_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "proposal_match": { + "name": "proposal_match", + "type": "boolean", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "scpm_schema_check_id_idx": { + "name": "scpm_schema_check_id_idx", + "columns": [ + { + "expression": "schema_check_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scpm_proposal_id_idx": { + "name": "scpm_proposal_id_idx", + "columns": [ + { + "expression": "proposal_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "schema_check_proposal_match_schema_check_id_schema_checks_id_fk": { + "name": "schema_check_proposal_match_schema_check_id_schema_checks_id_fk", + "tableFrom": "schema_check_proposal_match", + "tableTo": "schema_checks", + "columnsFrom": [ + "schema_check_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "schema_check_proposal_match_proposal_id_proposals_id_fk": { + "name": "schema_check_proposal_match_proposal_id_proposals_id_fk", + "tableFrom": "schema_check_proposal_match", + "tableTo": "proposals", + "columnsFrom": [ + "proposal_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "unique_schema_check_proposal_match": { + "name": "unique_schema_check_proposal_match", + "nullsNotDistinct": false, + "columns": [ + "schema_check_id", + "proposal_id" + ] + } + }, + "checkConstraints": {} + }, + "public.schema_check_subgraphs": { + "name": "schema_check_subgraphs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "schema_check_id": { + "name": "schema_check_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "subgraph_id": { + "name": "subgraph_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "subgraph_name": { + "name": "subgraph_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "proposed_subgraph_schema_sdl": { + "name": "proposed_subgraph_schema_sdl", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_deleted": { + "name": "is_deleted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_new": { + "name": "is_new", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "namespace_id": { + "name": "namespace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "labels": { + "name": "labels", + "type": "text[]", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "scs_schema_check_id_idx": { + "name": "scs_schema_check_id_idx", + "columns": [ + { + "expression": "schema_check_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scs_subgraph_id_idx": { + "name": "scs_subgraph_id_idx", + "columns": [ + { + "expression": "subgraph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "schema_check_subgraphs_schema_check_id_schema_checks_id_fk": { + "name": "schema_check_subgraphs_schema_check_id_schema_checks_id_fk", + "tableFrom": "schema_check_subgraphs", + "tableTo": "schema_checks", + "columnsFrom": [ + "schema_check_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "schema_check_subgraphs_subgraph_id_subgraphs_id_fk": { + "name": "schema_check_subgraphs_subgraph_id_subgraphs_id_fk", + "tableFrom": "schema_check_subgraphs", + "tableTo": "subgraphs", + "columnsFrom": [ + "subgraph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "schema_check_subgraphs_namespace_id_namespaces_id_fk": { + "name": "schema_check_subgraphs_namespace_id_namespaces_id_fk", + "tableFrom": "schema_check_subgraphs", + "tableTo": "namespaces", + "columnsFrom": [ + "namespace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.schema_check_subgraphs_federated_graphs": { + "name": "schema_check_subgraphs_federated_graphs", + "schema": "", + "columns": { + "schema_check_federated_graph_id": { + "name": "schema_check_federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "schema_check_subgraph_id": { + "name": "schema_check_subgraph_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "scsfg_schema_check_subgraph_id_idx": { + "name": "scsfg_schema_check_subgraph_id_idx", + "columns": [ + { + "expression": "schema_check_subgraph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scsfg_schema_check_federated_graph_id_idx": { + "name": "scsfg_schema_check_federated_graph_id_idx", + "columns": [ + { + "expression": "schema_check_federated_graph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "schema_check_subgraphs_federated_graphs_schema_check_federated_graph_id_schema_check_federated_graphs_id_fk": { + "name": "schema_check_subgraphs_federated_graphs_schema_check_federated_graph_id_schema_check_federated_graphs_id_fk", + "tableFrom": "schema_check_subgraphs_federated_graphs", + "tableTo": "schema_check_federated_graphs", + "columnsFrom": [ + "schema_check_federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "schema_check_subgraphs_federated_graphs_schema_check_subgraph_id_schema_check_subgraphs_id_fk": { + "name": "schema_check_subgraphs_federated_graphs_schema_check_subgraph_id_schema_check_subgraphs_id_fk", + "tableFrom": "schema_check_subgraphs_federated_graphs", + "tableTo": "schema_check_subgraphs", + "columnsFrom": [ + "schema_check_subgraph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.schema_checks": { + "name": "schema_checks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "is_composable": { + "name": "is_composable", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_deleted": { + "name": "is_deleted", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "has_breaking_changes": { + "name": "has_breaking_changes", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "has_lint_errors": { + "name": "has_lint_errors", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "has_graph_pruning_errors": { + "name": "has_graph_pruning_errors", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "has_client_traffic": { + "name": "has_client_traffic", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "proposal_match": { + "name": "proposal_match", + "type": "proposal_match", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "client_traffic_check_skipped": { + "name": "client_traffic_check_skipped", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "lint_skipped": { + "name": "lint_skipped", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "graph_pruning_skipped": { + "name": "graph_pruning_skipped", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "composition_skipped": { + "name": "composition_skipped", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "breaking_changes_skipped": { + "name": "breaking_changes_skipped", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "proposed_subgraph_schema_sdl": { + "name": "proposed_subgraph_schema_sdl", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "gh_details": { + "name": "gh_details", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "forced_success": { + "name": "forced_success", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "vcs_context": { + "name": "vcs_context", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "check_extension_delivery_id": { + "name": "check_extension_delivery_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "check_extension_error_message": { + "name": "check_extension_error_message", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "sc_target_id_idx": { + "name": "sc_target_id_idx", + "columns": [ + { + "expression": "target_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "schema_checks_target_id_targets_id_fk": { + "name": "schema_checks_target_id_targets_id_fk", + "tableFrom": "schema_checks", + "tableTo": "targets", + "columnsFrom": [ + "target_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "schema_checks_check_extension_delivery_id_webhook_deliveries_id_fk": { + "name": "schema_checks_check_extension_delivery_id_webhook_deliveries_id_fk", + "tableFrom": "schema_checks", + "tableTo": "webhook_deliveries", + "columnsFrom": [ + "check_extension_delivery_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.schema_versions": { + "name": "schema_versions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "schema_sdl": { + "name": "schema_sdl", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "client_schema": { + "name": "client_schema", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_v2_graph": { + "name": "is_v2_graph", + "type": "boolean", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "sv_organization_id_idx": { + "name": "sv_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sv_target_id_idx": { + "name": "sv_target_id_idx", + "columns": [ + { + "expression": "target_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "schema_versions_organization_id_organizations_id_fk": { + "name": "schema_versions_organization_id_organizations_id_fk", + "tableFrom": "schema_versions", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.schema_version_change_action": { + "name": "schema_version_change_action", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "schema_version_id": { + "name": "schema_version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "change_type": { + "name": "change_type", + "type": "schema_change_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "change_message": { + "name": "change_message", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "svca_schema_version_id_idx": { + "name": "svca_schema_version_id_idx", + "columns": [ + { + "expression": "schema_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "schema_version_change_action_schema_version_id_schema_versions_id_fk": { + "name": "schema_version_change_action_schema_version_id_schema_versions_id_fk", + "tableFrom": "schema_version_change_action", + "tableTo": "schema_versions", + "columnsFrom": [ + "schema_version_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.sessions": { + "name": "sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "sessions_user_id_idx": { + "name": "sessions_user_id_idx", + "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": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "sessions_user_id_unique": { + "name": "sessions_user_id_unique", + "nullsNotDistinct": false, + "columns": [ + "user_id" + ] + } + }, + "checkConstraints": {} + }, + "public.slack_installations": { + "name": "slack_installations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "slack_organization_id": { + "name": "slack_organization_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slack_organization_name": { + "name": "slack_organization_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slack_channel_id": { + "name": "slack_channel_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slack_channel_name": { + "name": "slack_channel_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slack_user_id": { + "name": "slack_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "slack_installations_idx": { + "name": "slack_installations_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "slack_organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "slack_channel_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "slackinst_organization_id_idx": { + "name": "slackinst_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "slack_installations_organization_id_organizations_id_fk": { + "name": "slack_installations_organization_id_organizations_id_fk", + "tableFrom": "slack_installations", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.slack_integration_configs": { + "name": "slack_integration_configs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "integration_id": { + "name": "integration_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "endpoint": { + "name": "endpoint", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "slackintconf_integration_id_idx": { + "name": "slackintconf_integration_id_idx", + "columns": [ + { + "expression": "integration_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "slack_integration_configs_integration_id_organization_integrations_id_fk": { + "name": "slack_integration_configs_integration_id_organization_integrations_id_fk", + "tableFrom": "slack_integration_configs", + "tableTo": "organization_integrations", + "columnsFrom": [ + "integration_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.slack_schema_update_event_configs": { + "name": "slack_schema_update_event_configs", + "schema": "", + "columns": { + "slack_integration_config_id": { + "name": "slack_integration_config_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "federated_graph_id": { + "name": "federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "slacksuec_slack_integration_config_id_idx": { + "name": "slacksuec_slack_integration_config_id_idx", + "columns": [ + { + "expression": "slack_integration_config_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "slacksuec_federated_graph_id_idx": { + "name": "slacksuec_federated_graph_id_idx", + "columns": [ + { + "expression": "federated_graph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "slack_schema_update_event_configs_slack_integration_config_id_slack_integration_configs_id_fk": { + "name": "slack_schema_update_event_configs_slack_integration_config_id_slack_integration_configs_id_fk", + "tableFrom": "slack_schema_update_event_configs", + "tableTo": "slack_integration_configs", + "columnsFrom": [ + "slack_integration_config_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "slack_schema_update_event_configs_federated_graph_id_federated_graphs_id_fk": { + "name": "slack_schema_update_event_configs_federated_graph_id_federated_graphs_id_fk", + "tableFrom": "slack_schema_update_event_configs", + "tableTo": "federated_graphs", + "columnsFrom": [ + "federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "slack_schema_update_event_configs_slack_integration_config_id_federated_graph_id_pk": { + "name": "slack_schema_update_event_configs_slack_integration_config_id_federated_graph_id_pk", + "columns": [ + "slack_integration_config_id", + "federated_graph_id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.subgraph_members": { + "name": "subgraph_members", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "subgraph_id": { + "name": "subgraph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_subgraph_member_idx": { + "name": "unique_subgraph_member_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "subgraph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sm_user_id_idx": { + "name": "sm_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "sm_subgraph_id_idx": { + "name": "sm_subgraph_id_idx", + "columns": [ + { + "expression": "subgraph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "subgraph_members_user_id_users_id_fk": { + "name": "subgraph_members_user_id_users_id_fk", + "tableFrom": "subgraph_members", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "subgraph_members_subgraph_id_subgraphs_id_fk": { + "name": "subgraph_members_subgraph_id_subgraphs_id_fk", + "tableFrom": "subgraph_members", + "tableTo": "subgraphs", + "columnsFrom": [ + "subgraph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.subgraphs": { + "name": "subgraphs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "routing_url": { + "name": "routing_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "subscription_url": { + "name": "subscription_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "subscription_protocol": { + "name": "subscription_protocol", + "type": "subscription_protocol", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'ws'" + }, + "websocket_subprotocol": { + "name": "websocket_subprotocol", + "type": "websocket_subprotocol", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'auto'" + }, + "schema_version_id": { + "name": "schema_version_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "is_feature_subgraph": { + "name": "is_feature_subgraph", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_event_driven_graph": { + "name": "is_event_driven_graph", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "type": { + "name": "type", + "type": "subgraph_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'standard'" + } + }, + "indexes": { + "subgraphs_target_id_idx": { + "name": "subgraphs_target_id_idx", + "columns": [ + { + "expression": "target_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "subgraphs_schema_version_id_idx": { + "name": "subgraphs_schema_version_id_idx", + "columns": [ + { + "expression": "schema_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "subgraphs_schema_version_id_schema_versions_id_fk": { + "name": "subgraphs_schema_version_id_schema_versions_id_fk", + "tableFrom": "subgraphs", + "tableTo": "schema_versions", + "columnsFrom": [ + "schema_version_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "subgraphs_target_id_targets_id_fk": { + "name": "subgraphs_target_id_targets_id_fk", + "tableFrom": "subgraphs", + "tableTo": "targets", + "columnsFrom": [ + "target_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.federated_subgraphs": { + "name": "federated_subgraphs", + "schema": "", + "columns": { + "federated_graph_id": { + "name": "federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "subgraph_id": { + "name": "subgraph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "fs_federated_graph_id_idx": { + "name": "fs_federated_graph_id_idx", + "columns": [ + { + "expression": "federated_graph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "fs_subgraph_id_idx": { + "name": "fs_subgraph_id_idx", + "columns": [ + { + "expression": "subgraph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "federated_subgraphs_federated_graph_id_federated_graphs_id_fk": { + "name": "federated_subgraphs_federated_graph_id_federated_graphs_id_fk", + "tableFrom": "federated_subgraphs", + "tableTo": "federated_graphs", + "columnsFrom": [ + "federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "federated_subgraphs_subgraph_id_subgraphs_id_fk": { + "name": "federated_subgraphs_subgraph_id_subgraphs_id_fk", + "tableFrom": "federated_subgraphs", + "tableTo": "subgraphs", + "columnsFrom": [ + "subgraph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "federated_subgraphs_federated_graph_id_subgraph_id_pk": { + "name": "federated_subgraphs_federated_graph_id_subgraph_id_pk", + "columns": [ + "federated_graph_id", + "subgraph_id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.target_label_matchers": { + "name": "target_label_matchers", + "schema": "", + "columns": { + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "label_matcher": { + "name": "label_matcher", + "type": "text[]", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "tlm_target_id_idx": { + "name": "tlm_target_id_idx", + "columns": [ + { + "expression": "target_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "target_label_matchers_target_id_targets_id_fk": { + "name": "target_label_matchers_target_id_targets_id_fk", + "tableFrom": "target_label_matchers", + "tableTo": "targets", + "columnsFrom": [ + "target_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.targets": { + "name": "targets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "target_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "labels": { + "name": "labels", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "readme": { + "name": "readme", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "namespace_id": { + "name": "namespace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "organization_name_idx": { + "name": "organization_name_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "namespace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "targets_organization_id_idx": { + "name": "targets_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "targets_created_by_idx": { + "name": "targets_created_by_idx", + "columns": [ + { + "expression": "created_by", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "targets_namespace_id_idx": { + "name": "targets_namespace_id_idx", + "columns": [ + { + "expression": "namespace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "targets_organization_id_organizations_id_fk": { + "name": "targets_organization_id_organizations_id_fk", + "tableFrom": "targets", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "targets_created_by_users_id_fk": { + "name": "targets_created_by_users_id_fk", + "tableFrom": "targets", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "targets_namespace_id_namespaces_id_fk": { + "name": "targets_namespace_id_namespaces_id_fk", + "tableFrom": "targets", + "tableTo": "namespaces", + "columnsFrom": [ + "namespace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "checkConstraints": {} + }, + "public.webhook_deliveries": { + "name": "webhook_deliveries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by_id": { + "name": "created_by_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "webhook_delivery_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "endpoint": { + "name": "endpoint", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "event_name": { + "name": "event_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "payload": { + "name": "payload", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "request_headers": { + "name": "request_headers", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "response_headers": { + "name": "response_headers", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "response_status_code": { + "name": "response_status_code", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "response_error_code": { + "name": "response_error_code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "response_body": { + "name": "response_body", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "duration": { + "name": "duration", + "type": "real", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "original_delivery_id": { + "name": "original_delivery_id", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "webhd_organization_id_idx": { + "name": "webhd_organization_id_idx", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "webhd_created_by_id_idx": { + "name": "webhd_created_by_id_idx", + "columns": [ + { + "expression": "created_by_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "webhook_deliveries_created_by_id_users_id_fk": { + "name": "webhook_deliveries_created_by_id_users_id_fk", + "tableFrom": "webhook_deliveries", + "tableTo": "users", + "columnsFrom": [ + "created_by_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "webhook_deliveries_organization_id_organizations_id_fk": { + "name": "webhook_deliveries_organization_id_organizations_id_fk", + "tableFrom": "webhook_deliveries", + "tableTo": "organizations", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.webhook_graph_schema_update": { + "name": "webhook_graph_schema_update", + "schema": "", + "columns": { + "webhook_id": { + "name": "webhook_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "federated_graph_id": { + "name": "federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "wgsu_webhook_id_idx": { + "name": "wgsu_webhook_id_idx", + "columns": [ + { + "expression": "webhook_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "wgsu_federated_graph_id_idx": { + "name": "wgsu_federated_graph_id_idx", + "columns": [ + { + "expression": "federated_graph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "webhook_graph_schema_update_webhook_id_organization_webhook_configs_id_fk": { + "name": "webhook_graph_schema_update_webhook_id_organization_webhook_configs_id_fk", + "tableFrom": "webhook_graph_schema_update", + "tableTo": "organization_webhook_configs", + "columnsFrom": [ + "webhook_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "webhook_graph_schema_update_federated_graph_id_federated_graphs_id_fk": { + "name": "webhook_graph_schema_update_federated_graph_id_federated_graphs_id_fk", + "tableFrom": "webhook_graph_schema_update", + "tableTo": "federated_graphs", + "columnsFrom": [ + "federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "webhook_graph_schema_update_webhook_id_federated_graph_id_pk": { + "name": "webhook_graph_schema_update_webhook_id_federated_graph_id_pk", + "columns": [ + "webhook_id", + "federated_graph_id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "public.webhook_proposal_state_update": { + "name": "webhook_proposal_state_update", + "schema": "", + "columns": { + "webhook_id": { + "name": "webhook_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "federated_graph_id": { + "name": "federated_graph_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "wpsu_webhook_id_idx": { + "name": "wpsu_webhook_id_idx", + "columns": [ + { + "expression": "webhook_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "wpsu_federated_graph_id_idx": { + "name": "wpsu_federated_graph_id_idx", + "columns": [ + { + "expression": "federated_graph_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "webhook_proposal_state_update_webhook_id_organization_webhook_configs_id_fk": { + "name": "webhook_proposal_state_update_webhook_id_organization_webhook_configs_id_fk", + "tableFrom": "webhook_proposal_state_update", + "tableTo": "organization_webhook_configs", + "columnsFrom": [ + "webhook_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "webhook_proposal_state_update_federated_graph_id_federated_graphs_id_fk": { + "name": "webhook_proposal_state_update_federated_graph_id_federated_graphs_id_fk", + "tableFrom": "webhook_proposal_state_update", + "tableTo": "federated_graphs", + "columnsFrom": [ + "federated_graph_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "webhook_proposal_state_update_webhook_id_federated_graph_id_pk": { + "name": "webhook_proposal_state_update_webhook_id_federated_graph_id_pk", + "columns": [ + "webhook_id", + "federated_graph_id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "enums": { + "public.git_installation_type": { + "name": "git_installation_type", + "schema": "public", + "values": [ + "PERSONAL", + "ORGANIZATION" + ] + }, + "public.graph_composition_subgraph_change_type": { + "name": "graph_composition_subgraph_change_type", + "schema": "public", + "values": [ + "added", + "removed", + "updated", + "unchanged" + ] + }, + "public.graph_pruning_rules": { + "name": "graph_pruning_rules", + "schema": "public", + "values": [ + "UNUSED_FIELDS", + "DEPRECATED_FIELDS", + "REQUIRE_DEPRECATION_BEFORE_DELETION" + ] + }, + "public.integration_type": { + "name": "integration_type", + "schema": "public", + "values": [ + "slack" + ] + }, + "public.lint_severity": { + "name": "lint_severity", + "schema": "public", + "values": [ + "warn", + "error" + ] + }, + "public.member_role": { + "name": "member_role", + "schema": "public", + "values": [ + "admin", + "developer", + "viewer" + ] + }, + "public.organization_role": { + "name": "organization_role", + "schema": "public", + "values": [ + "organization-admin", + "organization-developer", + "organization-viewer", + "organization-apikey-manager", + "namespace-admin", + "namespace-viewer", + "graph-admin", + "graph-viewer", + "subgraph-admin", + "subgraph-publisher", + "subgraph-checker", + "subgraph-viewer" + ] + }, + "public.playground_script_type": { + "name": "playground_script_type", + "schema": "public", + "values": [ + "pre-flight", + "pre-operation", + "post-operation" + ] + }, + "public.proposal_match": { + "name": "proposal_match", + "schema": "public", + "values": [ + "success", + "warn", + "error" + ] + }, + "public.proposal_origin": { + "name": "proposal_origin", + "schema": "public", + "values": [ + "INTERNAL", + "EXTERNAL" + ] + }, + "public.proposal_state": { + "name": "proposal_state", + "schema": "public", + "values": [ + "DRAFT", + "APPROVED", + "PUBLISHED", + "CLOSED" + ] + }, + "public.schema_change_type": { + "name": "schema_change_type", + "schema": "public", + "values": [ + "FIELD_ARGUMENT_DESCRIPTION_CHANGED", + "FIELD_ARGUMENT_DEFAULT_CHANGED", + "FIELD_ARGUMENT_TYPE_CHANGED", + "DIRECTIVE_REMOVED", + "DIRECTIVE_ADDED", + "DIRECTIVE_DESCRIPTION_CHANGED", + "DIRECTIVE_LOCATION_ADDED", + "DIRECTIVE_LOCATION_REMOVED", + "DIRECTIVE_ARGUMENT_ADDED", + "DIRECTIVE_ARGUMENT_REMOVED", + "DIRECTIVE_ARGUMENT_DESCRIPTION_CHANGED", + "DIRECTIVE_ARGUMENT_DEFAULT_VALUE_CHANGED", + "DIRECTIVE_ARGUMENT_TYPE_CHANGED", + "ENUM_VALUE_REMOVED", + "ENUM_VALUE_ADDED", + "ENUM_VALUE_DESCRIPTION_CHANGED", + "ENUM_VALUE_DEPRECATION_REASON_CHANGED", + "ENUM_VALUE_DEPRECATION_REASON_ADDED", + "ENUM_VALUE_DEPRECATION_REASON_REMOVED", + "FIELD_REMOVED", + "FIELD_ADDED", + "FIELD_DESCRIPTION_CHANGED", + "FIELD_DESCRIPTION_ADDED", + "FIELD_DESCRIPTION_REMOVED", + "FIELD_DEPRECATION_ADDED", + "FIELD_DEPRECATION_REMOVED", + "FIELD_DEPRECATION_REASON_CHANGED", + "FIELD_DEPRECATION_REASON_ADDED", + "FIELD_DEPRECATION_REASON_REMOVED", + "FIELD_TYPE_CHANGED", + "FIELD_ARGUMENT_ADDED", + "FIELD_ARGUMENT_REMOVED", + "INPUT_FIELD_REMOVED", + "INPUT_FIELD_ADDED", + "INPUT_FIELD_DESCRIPTION_ADDED", + "INPUT_FIELD_DESCRIPTION_REMOVED", + "INPUT_FIELD_DESCRIPTION_CHANGED", + "INPUT_FIELD_DEFAULT_VALUE_CHANGED", + "INPUT_FIELD_TYPE_CHANGED", + "OBJECT_TYPE_INTERFACE_ADDED", + "OBJECT_TYPE_INTERFACE_REMOVED", + "SCHEMA_QUERY_TYPE_CHANGED", + "SCHEMA_MUTATION_TYPE_CHANGED", + "SCHEMA_SUBSCRIPTION_TYPE_CHANGED", + "TYPE_REMOVED", + "TYPE_ADDED", + "TYPE_KIND_CHANGED", + "TYPE_DESCRIPTION_CHANGED", + "TYPE_DESCRIPTION_REMOVED", + "TYPE_DESCRIPTION_ADDED", + "UNION_MEMBER_REMOVED", + "UNION_MEMBER_ADDED", + "DIRECTIVE_USAGE_UNION_MEMBER_ADDED", + "DIRECTIVE_USAGE_UNION_MEMBER_REMOVED", + "DIRECTIVE_USAGE_ENUM_ADDED", + "DIRECTIVE_USAGE_ENUM_REMOVED", + "DIRECTIVE_USAGE_ENUM_VALUE_ADDED", + "DIRECTIVE_USAGE_ENUM_VALUE_REMOVED", + "DIRECTIVE_USAGE_INPUT_OBJECT_ADDED", + "DIRECTIVE_USAGE_INPUT_OBJECT_REMOVED", + "DIRECTIVE_USAGE_FIELD_ADDED", + "DIRECTIVE_USAGE_FIELD_REMOVED", + "DIRECTIVE_USAGE_SCALAR_ADDED", + "DIRECTIVE_USAGE_SCALAR_REMOVED", + "DIRECTIVE_USAGE_OBJECT_ADDED", + "DIRECTIVE_USAGE_OBJECT_REMOVED", + "DIRECTIVE_USAGE_INTERFACE_ADDED", + "DIRECTIVE_USAGE_INTERFACE_REMOVED", + "DIRECTIVE_USAGE_ARGUMENT_DEFINITION_ADDED", + "DIRECTIVE_USAGE_ARGUMENT_DEFINITION_REMOVED", + "DIRECTIVE_USAGE_SCHEMA_ADDED", + "DIRECTIVE_USAGE_SCHEMA_REMOVED", + "DIRECTIVE_USAGE_FIELD_DEFINITION_ADDED", + "DIRECTIVE_USAGE_FIELD_DEFINITION_REMOVED", + "DIRECTIVE_USAGE_INPUT_FIELD_DEFINITION_ADDED", + "DIRECTIVE_USAGE_INPUT_FIELD_DEFINITION_REMOVED" + ] + }, + "public.subgraph_type": { + "name": "subgraph_type", + "schema": "public", + "values": [ + "standard", + "grpc_plugin", + "grpc_service" + ] + }, + "public.subscription_protocol": { + "name": "subscription_protocol", + "schema": "public", + "values": [ + "ws", + "sse", + "sse_post" + ] + }, + "public.status": { + "name": "status", + "schema": "public", + "values": [ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused" + ] + }, + "public.target_type": { + "name": "target_type", + "schema": "public", + "values": [ + "federated", + "subgraph" + ] + }, + "public.webhook_delivery_type": { + "name": "webhook_delivery_type", + "schema": "public", + "values": [ + "webhook", + "slack", + "admission", + "check-extension" + ] + }, + "public.websocket_subprotocol": { + "name": "websocket_subprotocol", + "schema": "public", + "values": [ + "auto", + "graphql-ws", + "graphql-transport-ws" + ] + } + }, + "schemas": {}, + "sequences": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/controlplane/migrations/meta/_journal.json b/controlplane/migrations/meta/_journal.json index 20203a0544..aafbd61ed4 100644 --- a/controlplane/migrations/meta/_journal.json +++ b/controlplane/migrations/meta/_journal.json @@ -960,6 +960,13 @@ "when": 1772187315878, "tag": "0136_eminent_vermin", "breakpoints": true + }, + { + "idx": 137, + "version": "7", + "when": 1775221107271, + "tag": "0137_peaceful_marauders", + "breakpoints": true } ] } \ No newline at end of file diff --git a/controlplane/src/core/bufservices/feature-flag/deleteFeatureFlag.ts b/controlplane/src/core/bufservices/feature-flag/deleteFeatureFlag.ts index 089cae5d45..120d3f3be0 100644 --- a/controlplane/src/core/bufservices/feature-flag/deleteFeatureFlag.ts +++ b/controlplane/src/core/bufservices/feature-flag/deleteFeatureFlag.ts @@ -14,6 +14,7 @@ import { AuditLogRepository } from '../../repositories/AuditLogRepository.js'; import { FeatureFlagRepository } from '../../repositories/FeatureFlagRepository.js'; import { FederatedGraphRepository } from '../../repositories/FederatedGraphRepository.js'; import { DefaultNamespace, NamespaceRepository } from '../../repositories/NamespaceRepository.js'; +import { OperationsRepository } from '../../repositories/OperationsRepository.js'; import { OrganizationRepository } from '../../repositories/OrganizationRepository.js'; import type { RouterOptions } from '../../routes.js'; import { enrichLogger, getLogger, handleError } from '../../util.js'; @@ -157,6 +158,21 @@ export function deleteFeatureFlag( compositionWarnings.push(...composition.compositionWarnings); }); + // Regenerate PQL manifests so that operations only valid on the deleted FF + // are excluded. Junction entries are cascade-deleted by the FK. + for (const graph of federatedGraphs) { + const opsRepo = new OperationsRepository(opts.db, graph.id); + try { + await opsRepo.generateAndUploadManifest({ + organizationId: authContext.organizationId, + blobStorage: opts.blobStorage, + logger, + }); + } catch (e) { + logger.error(e, `Failed to regenerate PQL manifest for graph ${graph.name}`); + } + } + for (const graph of federatedGraphs) { orgWebhooks.send( { diff --git a/controlplane/src/core/bufservices/feature-flag/enableFeatureFlag.ts b/controlplane/src/core/bufservices/feature-flag/enableFeatureFlag.ts index 909932ce44..10f28db88b 100644 --- a/controlplane/src/core/bufservices/feature-flag/enableFeatureFlag.ts +++ b/controlplane/src/core/bufservices/feature-flag/enableFeatureFlag.ts @@ -14,6 +14,7 @@ import { AuditLogRepository } from '../../repositories/AuditLogRepository.js'; import { FeatureFlagRepository } from '../../repositories/FeatureFlagRepository.js'; import { FederatedGraphRepository } from '../../repositories/FederatedGraphRepository.js'; import { DefaultNamespace, NamespaceRepository } from '../../repositories/NamespaceRepository.js'; +import { OperationsRepository } from '../../repositories/OperationsRepository.js'; import { OrganizationRepository } from '../../repositories/OrganizationRepository.js'; import type { RouterOptions } from '../../routes.js'; import { enrichLogger, getLogger, handleError } from '../../util.js'; @@ -140,6 +141,21 @@ export function enableFeatureFlag( compositionWarnings.push(...composition.compositionWarnings); }); + // Regenerate PQL manifests for affected graphs so that FF-only operations + // are included/excluded based on the feature flag's new enabled state. + for (const graph of federatedGraphs) { + const opsRepo = new OperationsRepository(opts.db, graph.id); + try { + await opsRepo.generateAndUploadManifest({ + organizationId: authContext.organizationId, + blobStorage: opts.blobStorage, + logger, + }); + } catch (e) { + logger.error(e, `Failed to regenerate PQL manifest for graph ${graph.name}`); + } + } + for (const graph of federatedGraphs) { orgWebhooks.send( { diff --git a/controlplane/src/core/bufservices/persisted-operation/publishPersistedOperations.ts b/controlplane/src/core/bufservices/persisted-operation/publishPersistedOperations.ts index f4e24ceebd..2530c3260b 100644 --- a/controlplane/src/core/bufservices/persisted-operation/publishPersistedOperations.ts +++ b/controlplane/src/core/bufservices/persisted-operation/publishPersistedOperations.ts @@ -4,13 +4,13 @@ import pLimit from 'p-limit'; import { HandlerContext } from '@connectrpc/connect'; import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common/common_pb'; import { + PersistedOperation, PublishedOperation, PublishedOperationStatus, PublishPersistedOperationsRequest, PublishPersistedOperationsResponse, - PersistedOperation, } from '@wundergraph/cosmo-connect/dist/platform/v1/platform_pb'; -import { buildASTSchema as graphQLBuildASTSchema, DocumentNode, parse, validate } from 'graphql'; +import { buildASTSchema as graphQLBuildASTSchema, DocumentNode, GraphQLSchema, parse, validate } from 'graphql'; import { PublishedOperationData, UpdatedPersistedOperation } from '../../../types/index.js'; import { FederatedGraphRepository } from '../../repositories/FederatedGraphRepository.js'; import { DefaultNamespace } from '../../repositories/NamespaceRepository.js'; @@ -118,10 +118,16 @@ export function publishPersistedOperations( operations: [], }; } - const graphAST = parse(schema.schema); - const graphSchema = graphQLBuildASTSchema(graphAST); + // Validate all operations against the base graph first. + // Only fetch feature flag schemas if any operation fails base validation. + const baseGraphSchema = graphQLBuildASTSchema(parse(schema.schema)); + + // Track which schemas each operation is valid on (for manifest filtering). + const operationValidity = new Map(); + + const baseFailedOperations: { operation: (typeof req.operations)[number]; ast: DocumentNode; error: string }[] = []; + for (const operation of req.operations) { - const contents = operation.contents; let opAST: DocumentNode; try { opAST = parse(operation.contents); @@ -129,24 +135,81 @@ export function publishPersistedOperations( return { response: { code: EnumStatusCode.ERR, - details: `Operation ${operation.id} (${contents}) is not valid: ${e}`, + details: `Operation ${operation.id} (${operation.contents}) is not valid: ${e}`, }, operations: [], }; } - const errors = validate(graphSchema, opAST, undefined, { maxErrors: 1 }); - if (errors.length > 0) { - const errorDetails = errors.map((e) => `${e.toString()}`).join(', '); - return { - response: { - code: EnumStatusCode.ERR, - details: `Operation ${operation.id} ("${contents}") is not valid: ${errorDetails}`, - }, - operations: [], - }; + + const errors = validate(baseGraphSchema, opAST, undefined, { maxErrors: 1 }); + if (errors.length === 0) { + operationValidity.set(operation.id, { validOnBaseGraph: true, validOnFeatureFlagIds: [] }); + } else { + baseFailedOperations.push({ + operation, + ast: opAST, + error: errors.map((e) => e.toString()).join(', '), + }); } } + // If all operations are valid on the base graph, skip FF schema lookup entirely. + if (baseFailedOperations.length > 0 && schema.schemaVersionId) { + const ffSchemas = await federatedGraphRepo.getFeatureFlagSchemaVersions({ + baseSchemaVersionId: schema.schemaVersionId, + }); + + const ffValidationSchemas: { name: string; id: string; schema: GraphQLSchema }[] = []; + for (const ff of ffSchemas) { + if (!ff.schemaSDL || !ff.featureFlagName || !ff.featureFlagId) { + continue; + } + try { + ffValidationSchemas.push({ + name: `feature flag "${ff.featureFlagName}"`, + id: ff.featureFlagId, + schema: graphQLBuildASTSchema(parse(ff.schemaSDL)), + }); + } catch { + // Skip FF schemas that fail to parse — don't block PO upload + } + } + + // Check each base-failed operation against FF schemas + for (const { operation, ast, error: baseError } of baseFailedOperations) { + const validFfIds: string[] = []; + for (const s of ffValidationSchemas) { + const errors = validate(s.schema, ast, undefined, { maxErrors: 1 }); + if (errors.length === 0) { + validFfIds.push(s.id); + } + } + + if (validFfIds.length === 0) { + const schemaNames = ['base graph', ...ffValidationSchemas.map((s) => s.name)].join(', '); + return { + response: { + code: EnumStatusCode.ERR, + details: `Operation ${operation.id} ("${operation.contents}") is not valid on any schema (checked: ${schemaNames}): ${baseError}`, + }, + operations: [], + }; + } + + operationValidity.set(operation.id, { validOnBaseGraph: false, validOnFeatureFlagIds: validFfIds }); + } + } else if (baseFailedOperations.length > 0) { + // No FF schemas to check — report the base graph error + const { operation, error } = baseFailedOperations[0]; + return { + response: { + code: EnumStatusCode.ERR, + details: `Operation ${operation.id} ("${operation.contents}") is not valid: ${error}`, + }, + operations: [], + }; + } + const operationsRepo = new OperationsRepository(opts.db, federatedGraph.id); const clientId = await operationsRepo.registerClient(req.clientName, userId); @@ -170,7 +233,7 @@ export function publishPersistedOperations( return { response: { code: EnumStatusCode.ERR, - details: `Operation limit exceeded: adding ${newOperationCount} new operations would bring the total to ${allExistingOperations.length + newOperationCount}, which exceeds the maximum of ${MAX_MANIFEST_OPERATIONS} operations per graph`, + details: `Operation limit exceeded: adding ${newOperationCount} new operations would bring the total to ${allExistingOperations.length + newOperationCount}, which exceeds the maximum of ${MAX_MANIFEST_OPERATIONS} operations per graph. Delete unused operations before publishing new ones.`, }, operations: [], }; @@ -207,12 +270,15 @@ export function publishPersistedOperations( clientName, operationId, }); + const validity = operationValidity.get(operationId) ?? { validOnBaseGraph: true, validOnFeatureFlagIds: [] }; const updatedOp: UpdatedPersistedOperation = { operationId, hash: operationHash, filePath: path, contents: operation.contents, operationNames, + validOnBaseGraph: validity.validOnBaseGraph, + validOnFeatureFlagIds: validity.validOnFeatureFlagIds, }; if (prev === undefined) { diff --git a/controlplane/src/core/repositories/FederatedGraphRepository.ts b/controlplane/src/core/repositories/FederatedGraphRepository.ts index 6a4e6a5137..dbd6e97c51 100644 --- a/controlplane/src/core/repositories/FederatedGraphRepository.ts +++ b/controlplane/src/core/repositories/FederatedGraphRepository.ts @@ -34,6 +34,7 @@ import { uid } from 'uid/secure'; import { CompositionOptions, Warning } from '@wundergraph/composition'; import * as schema from '../../db/schema.js'; import { + featureFlags, federatedGraphs, federatedGraphsToFeatureFlagSchemaVersions, graphApiTokens, @@ -57,8 +58,8 @@ import { import { BlobStorage } from '../blobstorage/index.js'; import { BaseCompositionData, - CompositionSubgraphRecord, Composer, + CompositionSubgraphRecord, ContractBaseCompositionData, routerConfigToFeatureFlagExecutionConfig, RouterConfigUploadError, @@ -955,6 +956,37 @@ export class FederatedGraphRepository { }; } + // Returns the schema SDL for all enabled feature flag compositions linked to a base schema version. + // Used during persisted operation publishing to validate operations against FF schemas. + // Only enabled FFs are included because disabled FFs are removed from the router execution config, + // so the router has no mux to serve operations that are only valid on a disabled FF's schema. + public async getFeatureFlagSchemaVersions(data: { baseSchemaVersionId: string }) { + return await this.db + .select({ + schemaSDL: schemaVersion.schemaSDL, + featureFlagName: featureFlags.name, + featureFlagId: featureFlags.id, + }) + .from(federatedGraphsToFeatureFlagSchemaVersions) + .innerJoin( + schemaVersion, + eq(schemaVersion.id, federatedGraphsToFeatureFlagSchemaVersions.composedSchemaVersionId), + ) + .innerJoin(graphCompositions, eq(graphCompositions.schemaVersionId, schemaVersion.id)) + // innerJoin: exclude compositions for deleted FFs (featureFlagId set to NULL on deletion) + .innerJoin(featureFlags, eq(featureFlags.id, federatedGraphsToFeatureFlagSchemaVersions.featureFlagId)) + .where( + and( + eq(federatedGraphsToFeatureFlagSchemaVersions.baseCompositionSchemaVersionId, data.baseSchemaVersionId), + eq(schemaVersion.organizationId, this.organizationId), + eq(graphCompositions.isComposable, true), + eq(graphCompositions.isFeatureFlagComposition, true), + eq(featureFlags.isEnabled, true), + ), + ) + .execute(); + } + public async getSchemaVersionById(data: { schemaVersionId: string }) { const latestValidVersion = await this.db .select({ diff --git a/controlplane/src/core/repositories/OperationsRepository.ts b/controlplane/src/core/repositories/OperationsRepository.ts index ab999bc3f8..c50ec5aa90 100644 --- a/controlplane/src/core/repositories/OperationsRepository.ts +++ b/controlplane/src/core/repositories/OperationsRepository.ts @@ -1,12 +1,18 @@ import crypto from 'node:crypto'; import { OverrideChange } from '@wundergraph/cosmo-connect/dist/platform/v1/platform_pb'; -import { aliasedTable, and, asc, count, desc, eq, isNull, sql } from 'drizzle-orm'; +import { aliasedTable, and, asc, count, desc, eq, exists, inArray, isNull, or, sql } from 'drizzle-orm'; import { PostgresJsDatabase } from 'drizzle-orm/postgres-js'; import { PlainMessage } from '@bufbuild/protobuf'; import { FastifyBaseLogger } from 'fastify'; import { DBSchemaChangeType } from '../../db/models.js'; import * as schema from '../../db/schema.js'; -import { federatedGraphClients, federatedGraphPersistedOperations, users } from '../../db/schema.js'; +import { + featureFlags, + federatedGraphClients, + federatedGraphPersistedOperations, + persistedOperationToFeatureFlags, + users, +} from '../../db/schema.js'; import type { BlobStorage } from '../blobstorage/index.js'; import { createManifestBlobStoragePath } from '../bufservices/persisted-operation/utils.js'; import { @@ -62,6 +68,7 @@ export class OperationsRepository { createdById: userId, operationContent: operation.contents, operationNames: operation.operationNames, + validOnBaseGraph: operation.validOnBaseGraph ?? true, }; }); @@ -69,7 +76,7 @@ export class OperationsRepository { return; } - await this.db + const inserted = await this.db .insert(federatedGraphPersistedOperations) .values(inserts) .onConflictDoUpdate({ @@ -78,8 +85,33 @@ export class OperationsRepository { federatedGraphPersistedOperations.clientId, federatedGraphPersistedOperations.operationId, ], - set: { updatedAt: now, updatedById: userId }, + set: { updatedAt: now, updatedById: userId, validOnBaseGraph: sql`excluded.valid_on_base_graph` }, + }) + .returning({ + id: federatedGraphPersistedOperations.id, + operationId: federatedGraphPersistedOperations.operationId, }); + + // Replace feature flag validity links for the affected persisted operations + const insertedIds = inserted.map((row) => row.id); + const ffInserts: (typeof persistedOperationToFeatureFlags.$inferInsert)[] = []; + for (const row of inserted) { + const op = operations.find((o) => o.operationId === row.operationId); + if (op) { + for (const ffId of op.validOnFeatureFlagIds ?? []) { + ffInserts.push({ persistedOperationId: row.id, featureFlagId: ffId }); + } + } + } + // Delete stale links before inserting the current set + if (insertedIds.length > 0) { + await this.db + .delete(persistedOperationToFeatureFlags) + .where(inArray(persistedOperationToFeatureFlags.persistedOperationId, insertedIds)); + } + if (ffInserts.length > 0) { + await this.db.insert(persistedOperationToFeatureFlags).values(ffInserts).onConflictDoNothing(); + } } public async getPersistedOperations( @@ -240,6 +272,26 @@ export class OperationsRepository { return result!.id; } + // Returns true if an operation is servable by the router: + // valid on the base graph, or linked to at least one enabled feature flag. + private isServableOperation() { + return or( + eq(federatedGraphPersistedOperations.validOnBaseGraph, true), + exists( + this.db + .select({ one: sql`1` }) + .from(persistedOperationToFeatureFlags) + .innerJoin(featureFlags, eq(featureFlags.id, persistedOperationToFeatureFlags.featureFlagId)) + .where( + and( + eq(persistedOperationToFeatureFlags.persistedOperationId, federatedGraphPersistedOperations.id), + eq(featureFlags.isEnabled, true), + ), + ), + ), + ); + } + public async getAllPersistedOperationsForGraph(): Promise< Array<{ hash: string; @@ -259,7 +311,9 @@ export class OperationsRepository { }) .from(federatedGraphPersistedOperations) .innerJoin(federatedGraphClients, eq(federatedGraphClients.id, federatedGraphPersistedOperations.clientId)) - .where(eq(federatedGraphPersistedOperations.federatedGraphId, this.federatedGraphId)); + .where( + and(eq(federatedGraphPersistedOperations.federatedGraphId, this.federatedGraphId), this.isServableOperation()), + ); return results .filter((r) => r.operationContent != null) diff --git a/controlplane/src/db/schema.ts b/controlplane/src/db/schema.ts index 80d68dd9cf..2b69fd1142 100644 --- a/controlplane/src/db/schema.ts +++ b/controlplane/src/db/schema.ts @@ -179,6 +179,9 @@ export const federatedGraphPersistedOperations = pgTable( updatedById: uuid('updated_by_id').references(() => users.id, { onDelete: 'set null', }), + // Whether this operation is valid on the base federated graph schema. + // Operations only valid on feature flag schemas have this set to false. + validOnBaseGraph: boolean('valid_on_base_graph').notNull().default(true), }, (t) => ({ uniqueFederatedGraphClientIdOperationId: unique('federated_graph_operation_id').on( @@ -192,6 +195,28 @@ export const federatedGraphPersistedOperations = pgTable( }), ); +// Tracks which feature flags each persisted operation is valid on. +// Used to filter the manifest: an operation is included if validOnBaseGraph=true +// OR it is linked to at least one enabled feature flag via this table. +export const persistedOperationToFeatureFlags = pgTable( + 'persisted_operation_to_feature_flags', // po2ff + { + persistedOperationId: uuid('persisted_operation_id') + .notNull() + .references(() => federatedGraphPersistedOperations.id, { + onDelete: 'cascade', + }), + featureFlagId: uuid('feature_flag_id') + .notNull() + .references(() => featureFlags.id, { + onDelete: 'cascade', + }), + }, + (t) => ({ + pk: primaryKey({ columns: [t.persistedOperationId, t.featureFlagId] }), + }), +); + export const federatedGraphPersistedOperationsRelations = relations( federatedGraphPersistedOperations, ({ many, one }) => ({ @@ -203,6 +228,7 @@ export const federatedGraphPersistedOperationsRelations = relations( fields: [federatedGraphPersistedOperations.updatedById], references: [users.id], }), + featureFlags: many(persistedOperationToFeatureFlags), }), ); diff --git a/controlplane/src/types/index.ts b/controlplane/src/types/index.ts index 3cf35cf690..ab19a025ef 100644 --- a/controlplane/src/types/index.ts +++ b/controlplane/src/types/index.ts @@ -583,6 +583,8 @@ export interface UpdatedPersistedOperation { filePath: string; contents: string; operationNames: string[]; + validOnBaseGraph?: boolean; + validOnFeatureFlagIds?: string[]; } export interface GraphCompositionDTO { diff --git a/controlplane/test/persisted-operations.test.ts b/controlplane/test/persisted-operations.test.ts index ee2b0c700d..c0d3117332 100644 --- a/controlplane/test/persisted-operations.test.ts +++ b/controlplane/test/persisted-operations.test.ts @@ -1,20 +1,29 @@ import crypto from 'node:crypto'; import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common/common_pb'; import { joinLabel } from '@wundergraph/cosmo-shared'; -import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test, vi, type Mock } from 'vitest'; +import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, type Mock, test, vi } from 'vitest'; import { ClickHouseClient } from '../src/core/clickhouse/index.js'; +import { persistedOperationToFeatureFlags } from '../src/db/schema.js'; +import { FeatureFlagRepository } from '../src/core/repositories/FeatureFlagRepository.js'; import { FederatedGraphRepository } from '../src/core/repositories/FederatedGraphRepository.js'; +import { NamespaceRepository } from '../src/core/repositories/NamespaceRepository.js'; import { MAX_MANIFEST_OPERATIONS, OperationsRepository } from '../src/core/repositories/OperationsRepository.js'; import { afterAllSetup, beforeAllSetup, + createTestGroup, + createTestRBACEvaluator, genID, genUniqueLabel, TestUser, - createTestRBACEvaluator, - createTestGroup, } from '../src/core/test-util.js'; -import { SetupTest } from './test-util.js'; +import { + createFeatureFlag, + deleteFeatureFlag, + featureFlagIntegrationTestSetUp, + SetupTest, + toggleFeatureFlag, +} from './test-util.js'; let dbname = ''; @@ -27,6 +36,30 @@ vi.mock('../src/core/clickhouse/index.js', () => { return { ClickHouseClient }; }); +// Reads the PQL manifest from blob storage +const readManifest = async (blobStorage: Awaited>['blobStorage']) => { + const manifestKey = blobStorage.keys().find((key) => key.endsWith('/operations/manifest.json')); + if (!manifestKey) { + throw new Error('Manifest not found in blob storage'); + } + const blob = await blobStorage.getObject({ key: manifestKey }); + return JSON.parse(await new Response(blob.stream).text()); +}; + +// Sets up a federated graph with a feature flag subgraph and an enabled feature flag. +// Returns the graph name and FF name for use in tests. +const setupFederatedGraphWithFeatureFlag = async (client: Client) => { + const labels = [{ key: 'team', value: genID('label') }]; + const fedGraphName = genID('fedGraph'); + + await featureFlagIntegrationTestSetUp(client, [{ name: 'users', hasFeatureSubgraph: true }], fedGraphName, labels); + + const featureFlagName = genID('flag'); + await createFeatureFlag(client, featureFlagName, labels, ['users-feature'], 'default', true); + + return { fedGraphName, featureFlagName }; +}; + const setupFederatedGraph = async (fedGraphName: string, client: Client) => { const subgraph1Name = genID('subgraph1'); const label = genUniqueLabel(); @@ -344,6 +377,146 @@ describe('Persisted operations', (ctx) => { }); }); + // Base schema: User { id, name, email, isPremium } + // Feature subgraph adds: User { username, basket }, Mutation { addProductToUserBasket } + describe('feature flag schema validation', () => { + test('Should accept operation valid only on a feature flag schema', async (testContext) => { + const { client, server } = await SetupTest({ dbname, chClient }); + testContext.onTestFinished(() => server.close()); + + const { fedGraphName } = await setupFederatedGraphWithFeatureFlag(client); + + // "username" only exists on the FF schema + const resp = await client.publishPersistedOperations({ + fedGraphName, + namespace: 'default', + clientName: 'test-client', + operations: [{ id: genID('op'), contents: `query { users { id username } }` }], + }); + expect(resp.response?.code).toBe(EnumStatusCode.OK); + }); + + test('Should accept operation valid on base schema even with feature flags', async (testContext) => { + const { client, server } = await SetupTest({ dbname, chClient }); + testContext.onTestFinished(() => server.close()); + + const { fedGraphName } = await setupFederatedGraphWithFeatureFlag(client); + + const resp = await client.publishPersistedOperations({ + fedGraphName, + namespace: 'default', + clientName: 'test-client', + operations: [{ id: genID('op'), contents: `query { users { id name } }` }], + }); + expect(resp.response?.code).toBe(EnumStatusCode.OK); + }); + + test('Should reject operation invalid on all schemas', async (testContext) => { + const { client, server } = await SetupTest({ dbname, chClient }); + testContext.onTestFinished(() => server.close()); + + const { fedGraphName } = await setupFederatedGraphWithFeatureFlag(client); + + const resp = await client.publishPersistedOperations({ + fedGraphName, + namespace: 'default', + clientName: 'test-client', + operations: [{ id: genID('op'), contents: `query { users { id nonExistentField } }` }], + }); + expect(resp.response?.code).toBe(EnumStatusCode.ERR); + expect(resp.response?.details).toContain('not valid on any schema'); + expect(resp.response?.details).toContain('nonExistentField'); + }); + + test('Should replace stale feature flag links when re-publishing operations', async (testContext) => { + const { client, server, users } = await SetupTest({ dbname, chClient }); + testContext.onTestFinished(() => server.close()); + + const labels = [{ key: 'team', value: genID('label') }]; + const fedGraphName = genID('fedGraph'); + + await featureFlagIntegrationTestSetUp( + client, + [{ name: 'users', hasFeatureSubgraph: true }], + fedGraphName, + labels, + ); + + // Create two feature flags + const ff1Name = genID('flag1'); + const ff2Name = genID('flag2'); + await createFeatureFlag(client, ff1Name, labels, ['users-feature'], 'default', true); + await createFeatureFlag(client, ff2Name, labels, ['users-feature'], 'default', true); + + const user = users.adminAliceCompanyA; + const db = server.db; + const logger = server.log; + + // Resolve IDs + const fedGraphRepo = new FederatedGraphRepository(logger, db, user.organizationId); + const fedGraph = await fedGraphRepo.byName(fedGraphName, 'default'); + expect(fedGraph).toBeDefined(); + + const namespaceRepo = new NamespaceRepository(db, user.organizationId); + const namespace = await namespaceRepo.byName('default'); + expect(namespace).toBeDefined(); + + const ffRepo = new FeatureFlagRepository(logger, db, user.organizationId); + const ff1 = await ffRepo.getFeatureFlagByName({ featureFlagName: ff1Name, namespaceId: namespace!.id }); + const ff2 = await ffRepo.getFeatureFlagByName({ featureFlagName: ff2Name, namespaceId: namespace!.id }); + expect(ff1).toBeDefined(); + expect(ff2).toBeDefined(); + + const opsRepo = new OperationsRepository(db, fedGraph!.id); + const clientId = await opsRepo.registerClient('test-client', user.userId); + + const opId = genID('op'); + const makeOp = (ffIds: string[]) => ({ + operationId: opId, + hash: crypto.createHash('sha256').update(opId).digest('hex'), + filePath: `${opId}.graphql`, + contents: `query { users { id username } }`, + operationNames: ['Users'], + validOnBaseGraph: false, + validOnFeatureFlagIds: ffIds, + }); + + // First publish: link to FF1 + await opsRepo.updatePersistedOperations(clientId, user.userId, [makeOp([ff1!.id])]); + + // Query the junction table to get the persisted operation ID + const linksAfterFirst = await db.select().from(persistedOperationToFeatureFlags); + + // Filter to only links for our feature flags + const relevantLinksFirst = linksAfterFirst.filter( + (l) => l.featureFlagId === ff1!.id || l.featureFlagId === ff2!.id, + ); + expect(relevantLinksFirst).toHaveLength(1); + expect(relevantLinksFirst[0].featureFlagId).toBe(ff1!.id); + + // Second publish: change link to FF2 (should remove FF1 link) + await opsRepo.updatePersistedOperations(clientId, user.userId, [makeOp([ff2!.id])]); + + const linksAfterSecond = await db.select().from(persistedOperationToFeatureFlags); + + const relevantLinksSecond = linksAfterSecond.filter( + (l) => l.featureFlagId === ff1!.id || l.featureFlagId === ff2!.id, + ); + expect(relevantLinksSecond).toHaveLength(1); + expect(relevantLinksSecond[0].featureFlagId).toBe(ff2!.id); + + // Third publish: no feature flags (should remove all links) + await opsRepo.updatePersistedOperations(clientId, user.userId, [makeOp([])]); + + const linksAfterThird = await db.select().from(persistedOperationToFeatureFlags); + + const relevantLinksThird = linksAfterThird.filter( + (l) => l.featureFlagId === ff1!.id || l.featureFlagId === ff2!.id, + ); + expect(relevantLinksThird).toHaveLength(0); + }); + }); + describe('deleting', () => { test('Should be able to delete a persisted operation', async (testContext) => { const { client, server } = await SetupTest({ dbname, chClient }); @@ -727,6 +900,106 @@ describe('Persisted operations', (ctx) => { expect(manifest2.revision).toBe(manifest1.revision); }); + test('Should exclude FF-only operation from manifest when FF is disabled', async (testContext) => { + const { client, server, blobStorage } = await SetupTest({ dbname, chClient }); + testContext.onTestFinished(() => server.close()); + + const { fedGraphName, featureFlagName } = await setupFederatedGraphWithFeatureFlag(client); + + const resp = await client.publishPersistedOperations({ + fedGraphName, + namespace: 'default', + clientName: 'test-client', + operations: [ + { id: genID('base-op'), contents: `query { users { id name } }` }, + { id: genID('ff-op'), contents: `query { users { id username } }` }, + ], + }); + expect(resp.response?.code).toBe(EnumStatusCode.OK); + + let manifest = await readManifest(blobStorage); + expect(Object.keys(manifest.operations).length).toBe(2); + + await toggleFeatureFlag(client, featureFlagName, false); + + manifest = await readManifest(blobStorage); + expect(Object.keys(manifest.operations).length).toBe(1); + const remainingOp = Object.values(manifest.operations)[0] as string; + expect(remainingOp).toContain('name'); + expect(remainingOp).not.toContain('username'); + }); + + test('Should restore FF-only operation in manifest when FF is re-enabled', async (testContext) => { + const { client, server, blobStorage } = await SetupTest({ dbname, chClient }); + testContext.onTestFinished(() => server.close()); + + const { fedGraphName, featureFlagName } = await setupFederatedGraphWithFeatureFlag(client); + + const resp = await client.publishPersistedOperations({ + fedGraphName, + namespace: 'default', + clientName: 'test-client', + operations: [ + { id: genID('base-op'), contents: `query { users { id name } }` }, + { id: genID('ff-op'), contents: `query { users { id username } }` }, + ], + }); + expect(resp.response?.code).toBe(EnumStatusCode.OK); + + await toggleFeatureFlag(client, featureFlagName, false); + expect(Object.keys((await readManifest(blobStorage)).operations).length).toBe(1); + + await toggleFeatureFlag(client, featureFlagName, true); + expect(Object.keys((await readManifest(blobStorage)).operations).length).toBe(2); + }); + + test('Should exclude FF-only operation from manifest when FF is deleted', async (testContext) => { + const { client, server, blobStorage } = await SetupTest({ dbname, chClient }); + testContext.onTestFinished(() => server.close()); + + const { fedGraphName, featureFlagName } = await setupFederatedGraphWithFeatureFlag(client); + + const resp = await client.publishPersistedOperations({ + fedGraphName, + namespace: 'default', + clientName: 'test-client', + operations: [ + { id: genID('base-op'), contents: `query { users { id name } }` }, + { id: genID('ff-op'), contents: `query { users { id username } }` }, + ], + }); + expect(resp.response?.code).toBe(EnumStatusCode.OK); + expect(Object.keys((await readManifest(blobStorage)).operations).length).toBe(2); + + await deleteFeatureFlag(client, featureFlagName); + expect(Object.keys((await readManifest(blobStorage)).operations).length).toBe(1); + }); + + test('Should keep base-valid operations in manifest regardless of FF state', async (testContext) => { + const { client, server, blobStorage } = await SetupTest({ dbname, chClient }); + testContext.onTestFinished(() => server.close()); + + const { fedGraphName, featureFlagName } = await setupFederatedGraphWithFeatureFlag(client); + + const resp = await client.publishPersistedOperations({ + fedGraphName, + namespace: 'default', + clientName: 'test-client', + operations: [ + { id: genID('op1'), contents: `query { users { id } }` }, + { id: genID('op2'), contents: `query { users { id name } }` }, + ], + }); + expect(resp.response?.code).toBe(EnumStatusCode.OK); + expect(Object.keys((await readManifest(blobStorage)).operations).length).toBe(2); + + await toggleFeatureFlag(client, featureFlagName, false); + expect(Object.keys((await readManifest(blobStorage)).operations).length).toBe(2); + + await deleteFeatureFlag(client, featureFlagName); + expect(Object.keys((await readManifest(blobStorage)).operations).length).toBe(2); + }); + test('Should reject publish when operation limit would be exceeded', async (testContext) => { const { client, server, blobStorage, users } = await SetupTest({ dbname, diff --git a/docs-website/cli/feature-flags/disable-feature-flag.mdx b/docs-website/cli/feature-flags/disable-feature-flag.mdx index 36230d9939..ab441b9708 100644 --- a/docs-website/cli/feature-flags/disable-feature-flag.mdx +++ b/docs-website/cli/feature-flags/disable-feature-flag.mdx @@ -29,6 +29,10 @@ The alias for `feature-flag` is `ff`. Note that unless specified by the `--namespace` parameter, the namespace will be automatically passed as "default". + + Disabling a feature flag regenerates the [PQL manifest](/router/persisted-queries/persisted-operations#pql-manifest) for all affected federated graphs. Persisted operations that are only valid on this feature flag's schema are removed from the manifest until the flag is re-enabled. + + ## Parameters * ``: The name of the feature flag to disable. Returns an error if the feature flag does not exist in the specified (otherwise "default") namespace. @@ -39,7 +43,7 @@ Note that unless specified by the `--namespace` parameter, the namespace will be ## Examples -Enable the existing feature flag "my-flag" in the namespace "prod": +Disable the existing feature flag "my-flag" in the namespace "prod": ```bash wgc feature-flag disable my-flag -n prod diff --git a/docs-website/cli/feature-flags/enable-feature-flag.mdx b/docs-website/cli/feature-flags/enable-feature-flag.mdx index ca471ccad2..daaecdc640 100644 --- a/docs-website/cli/feature-flags/enable-feature-flag.mdx +++ b/docs-website/cli/feature-flags/enable-feature-flag.mdx @@ -33,6 +33,10 @@ Note that unless specified by the `--namespace` parameter, the namespace will be If either the base composition (the federated graph with the original subgraphs) or the feature flag composition fail, the router execution config will not be updated with the feature flag configuration. + + Enabling a feature flag regenerates the [PQL manifest](/router/persisted-queries/persisted-operations#pql-manifest) for all affected federated graphs. Persisted operations that are only valid on this feature flag's schema are restored in the manifest. + + ## Parameters * ``: The name of the feature flag to enable. Returns an error if the feature flag does not exist in the specified (otherwise "default") namespace. diff --git a/docs-website/cli/operations/push.mdx b/docs-website/cli/operations/push.mdx index a2009ada48..a8d4c32ef8 100644 --- a/docs-website/cli/operations/push.mdx +++ b/docs-website/cli/operations/push.mdx @@ -20,7 +20,7 @@ The operations file might be one of the following formats: - An [Apollo operation manifest](https://www.apollographql.com/docs/kotlin/advanced/persisted-queries/#1-generate-operation-manifest) - A [Relay Query Map](https://relay.dev/docs/guides/persisted-queries/) -The operations are validated against the graph schema before registering them. If any of the operations is invalid, no operations will be registered. +Each operation is validated against the base graph schema and all enabled [feature flag](/router/feature-flags) composition schemas. An operation is accepted if it is valid on at least one schema. If any operation is invalid on all schemas, the entire push is rejected. ### Options diff --git a/docs-website/router/feature-flags.mdx b/docs-website/router/feature-flags.mdx index 72eaf9e562..cc92bd8b0a 100644 --- a/docs-website/router/feature-flags.mdx +++ b/docs-website/router/feature-flags.mdx @@ -51,3 +51,26 @@ X-Feature-Flag: test_checkout ``` When the router receives `X-Feature-Flag: test_checkout`, it composes the operation against the replacement schema and forwards traffic to the routing URLs declared in the flag configuration. + +## Persisted operations + +Feature flags work with [persisted operations](/router/persisted-queries/persisted-operations) and the [PQL manifest](/router/persisted-queries/persisted-operations#pql-manifest). + +### Upload validation + +When you push persisted operations with `wgc operations push`, the control plane validates each operation against the base graph schema **and** all enabled feature flag composition schemas. An operation is accepted if it is valid on at least one schema. This allows you to persist operations that use fields introduced by a feature flag subgraph. + +### Manifest filtering + +The PQL manifest only includes operations the router can serve: + +- Operations valid on the base graph are always included. +- Operations valid only on a feature flag schema are included while that feature flag is enabled. +- When a feature flag is disabled, its operations are removed from the manifest. When re-enabled, they reappear. +- When a feature flag is deleted, its operations are permanently removed from the manifest. + +The manifest is regenerated automatically when a feature flag is enabled, disabled, or deleted. + +### Router behavior + +Each feature flag has its own schema and plan cache. Operations in the manifest are validated per feature flag. An operation targeting one feature flag may be invalid on another. The router handles this gracefully. diff --git a/docs-website/router/persisted-queries/persisted-operations.mdx b/docs-website/router/persisted-queries/persisted-operations.mdx index aa763378f6..26322efa71 100644 --- a/docs-website/router/persisted-queries/persisted-operations.mdx +++ b/docs-website/router/persisted-queries/persisted-operations.mdx @@ -19,6 +19,8 @@ This not only saves bandwidth but can also help reduce the attack surface by all Persisted operations are usually registered within Cosmo during your release pipeline, which pushes them to the control plane. This allows you to use GraphQL queries without previously registering them in development while allowing only trusted operations in production. +Each operation is validated against the base graph schema and all enabled [feature flag](/router/feature-flags) composition schemas. An operation is accepted if it is valid on at least one schema. This allows you to persist operations that use fields introduced by a feature flag subgraph. + The control plane replicates these operations in the Cosmo CDN, where the routers can fetch them. All operations in the CDN are protected and only readable by routers running the federated graph to which the operations were registered. ## Using persisted operations @@ -128,6 +130,8 @@ persisted_operations: The manifest is automatically updated in the Cosmo CDN whenever operations are added or deleted via `wgc operations push` or Studio. The router polls for updates using `poll_interval` and `poll_jitter`, picking up changes without requiring a restart. You can also load the manifest from a custom [storage provider](#using-a-custom-storage-provider). +The manifest is also regenerated when a [feature flag](/router/feature-flags#persisted-operations) is enabled, disabled, or deleted. Operations that are only valid on a feature flag schema are included in the manifest while that flag is enabled and removed when it is disabled. + When the manifest is enabled, it is **authoritative** — the router does not fall back to fetching individual operations from the CDN. Unknown operation hashes are rejected immediately. diff --git a/router-tests/operations/pql_manifest_test.go b/router-tests/operations/pql_manifest_test.go index fc0c22c85f..dc1607a161 100644 --- a/router-tests/operations/pql_manifest_test.go +++ b/router-tests/operations/pql_manifest_test.go @@ -16,6 +16,8 @@ import ( "github.com/wundergraph/cosmo/router-tests/testutils" "github.com/wundergraph/cosmo/router/core" "github.com/wundergraph/cosmo/router/pkg/config" + "github.com/wundergraph/cosmo/router/pkg/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.uber.org/zap/zapcore" @@ -38,6 +40,18 @@ func getCDNRequests(t *testing.T, cdnURL string) []string { return requests } +// countDataPointsWithAttribute counts histogram data points that have the given attribute. +func countDataPointsWithAttribute(dataPoints []metricdata.HistogramDataPoint[float64], attr attribute.KeyValue) int { + count := 0 + for _, dp := range dataPoints { + val, ok := dp.Attributes.Value(attr.Key) + if ok && val == attr.Value { + count++ + } + } + return count +} + func TestPQLManifest(t *testing.T) { t.Parallel() @@ -106,6 +120,139 @@ func TestPQLManifest(t *testing.T) { }) }) + t.Run("feature flag mux resolves persisted operation from manifest", func(t *testing.T) { + t.Parallel() + testenv.Run(t, &testenv.Config{ + RouterOptions: []core.Option{ + core.WithPersistedOperationsConfig(manifestConfig), + }, + }, func(t *testing.T, xEnv *testenv.Environment) { + header := make(http.Header) + header.Add("graphql-client-name", "my-client") + header.Add("X-Feature-Flag", "myff") + + res, err := xEnv.MakeGraphQLRequest(testenv.GraphQLRequest{ + OperationName: []byte(`"Employees"`), + Extensions: []byte(`{"persistedQuery": {"version": 1, "sha256Hash": "dc67510fb4289672bea757e862d6b00e83db5d3cbbcfb15260601b6f29bb2b8f"}}`), + Header: header, + }) + require.NoError(t, err) + require.Equal(t, "myff", res.Response.Header.Get("X-Feature-Flag")) + require.Equal(t, expectedEmployeesBody, res.Body) + }) + }) + + t.Run("feature flag mux rejects unknown hash when manifest is authoritative", func(t *testing.T) { + t.Parallel() + testenv.Run(t, &testenv.Config{ + RouterOptions: []core.Option{ + core.WithPersistedOperationsConfig(manifestConfig), + }, + }, func(t *testing.T, xEnv *testenv.Environment) { + header := make(http.Header) + header.Add("X-Feature-Flag", "myff") + + res := xEnv.MakeGraphQLRequestOK(testenv.GraphQLRequest{ + Extensions: []byte(`{"persistedQuery": {"version": 1, "sha256Hash": "0000000000000000000000000000000000000000000000000000000000000000"}}`), + Header: header, + }) + require.Equal(t, "myff", res.Response.Header.Get("X-Feature-Flag")) + require.Equal(t, persistedNotFoundResp, res.Body) + }) + }) + + t.Run("manifest operation valid only on feature flag schema succeeds on FF mux and fails on base", func(t *testing.T) { + t.Parallel() + + // productCount exists on the "myff" FF schema (products_fg subgraph) but NOT on the base schema. + // The controlplane accepts this operation during upload because it validates against all FF + // compositions. At runtime, the manifest is shared across all muxes, so the operation resolves + // on both — but per-mux schema validation is the safety net that rejects it on the base mux. + universalHash := "dc67510fb4289672bea757e862d6b00e83db5d3cbbcfb15260601b6f29bb2b8f" + universalQuery := "query Employees {\n employees {\n id\n }\n}" + ffOnlyHash := "aa00000000000000000000000000000000000000000000000000000000000001" + ffOnlyQuery := "query EmployeesWithProductCount { employees { id productCount } }" + + manifest, _ := json.Marshal(map[string]interface{}{ + "version": 1, + "revision": "rev-ff-test", + "generatedAt": "2024-01-01T00:00:00Z", + "operations": map[string]string{ + universalHash: universalQuery, + ffOnlyHash: ffOnlyQuery, + }, + }) + + cdnServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if strings.HasSuffix(r.URL.Path, "/operations/manifest.json") { + w.Header().Set("Content-Type", "application/json") + w.Header().Set("ETag", `"rev-ff-test"`) + _, _ = w.Write(manifest) + return + } + w.WriteHeader(http.StatusNotFound) + })) + defer cdnServer.Close() + + testenv.Run(t, &testenv.Config{ + CdnSever: cdnServer, + RouterOptions: []core.Option{ + core.WithPersistedOperationsConfig(config.PersistedOperationsConfig{ + Manifest: config.PQLManifestConfig{ + Enabled: true, + PollInterval: 10 * time.Second, + PollJitter: 5 * time.Second, + }, + }), + }, + }, func(t *testing.T, xEnv *testenv.Environment) { + // 1. Universal operation works on both muxes + header := make(http.Header) + header.Add("graphql-client-name", "my-client") + + res, err := xEnv.MakeGraphQLRequest(testenv.GraphQLRequest{ + OperationName: []byte(`"Employees"`), + Extensions: []byte(`{"persistedQuery": {"version": 1, "sha256Hash": "` + universalHash + `"}}`), + Header: header, + }) + require.NoError(t, err) + require.Equal(t, expectedEmployeesBody, res.Body) + + ffHeader := make(http.Header) + ffHeader.Add("graphql-client-name", "my-client") + ffHeader.Add("X-Feature-Flag", "myff") + + res, err = xEnv.MakeGraphQLRequest(testenv.GraphQLRequest{ + OperationName: []byte(`"Employees"`), + Extensions: []byte(`{"persistedQuery": {"version": 1, "sha256Hash": "` + universalHash + `"}}`), + Header: ffHeader, + }) + require.NoError(t, err) + require.Equal(t, "myff", res.Response.Header.Get("X-Feature-Flag")) + require.Equal(t, expectedEmployeesBody, res.Body) + + // 2. FF-only operation succeeds on the feature flag mux + res, err = xEnv.MakeGraphQLRequest(testenv.GraphQLRequest{ + OperationName: []byte(`"EmployeesWithProductCount"`), + Extensions: []byte(`{"persistedQuery": {"version": 1, "sha256Hash": "` + ffOnlyHash + `"}}`), + Header: ffHeader, + }) + require.NoError(t, err) + require.Equal(t, "myff", res.Response.Header.Get("X-Feature-Flag")) + require.Contains(t, res.Body, `"productCount"`) + require.Contains(t, res.Body, `"data"`) + + // 3. FF-only operation fails validation on the base mux + res, err = xEnv.MakeGraphQLRequest(testenv.GraphQLRequest{ + OperationName: []byte(`"EmployeesWithProductCount"`), + Extensions: []byte(`{"persistedQuery": {"version": 1, "sha256Hash": "` + ffOnlyHash + `"}}`), + Header: header, + }) + require.NoError(t, err) + require.Contains(t, res.Body, `Cannot query field \"productCount\" on type \"Employee\"`) + }) + }) + t.Run("no CDN requests for individual operations", func(t *testing.T) { t.Parallel() testenv.Run(t, &testenv.Config{ @@ -574,6 +721,35 @@ func TestPQLManifest(t *testing.T) { }) }) + t.Run("manifest warmup serves first feature flag request from cache", func(t *testing.T) { + t.Parallel() + testenv.Run(t, &testenv.Config{ + RouterOptions: []core.Option{ + core.WithPersistedOperationsConfig(manifestConfigWithWarmup), + }, + }, func(t *testing.T, xEnv *testenv.Environment) { + header := make(http.Header) + header.Add("graphql-client-name", "my-client") + header.Add("X-Feature-Flag", "myff") + + // The very first request through the feature flag mux should hit all caches + // because manifest warmup pre-processed operations for each mux independently. + res, err := xEnv.MakeGraphQLRequest(testenv.GraphQLRequest{ + OperationName: []byte(`"Employees"`), + Extensions: []byte(`{"persistedQuery": {"version": 1, "sha256Hash": "dc67510fb4289672bea757e862d6b00e83db5d3cbbcfb15260601b6f29bb2b8f"}}`), + Header: header, + }) + require.NoError(t, err) + require.Equal(t, "myff", res.Response.Header.Get("X-Feature-Flag")) + require.Equal(t, expectedEmployeesBody, res.Body) + require.Equal(t, "HIT", res.Response.Header.Get(core.PersistedOperationCacheHeader)) + require.Equal(t, "HIT", res.Response.Header.Get(core.NormalizationCacheHeader)) + require.Equal(t, "HIT", res.Response.Header.Get(core.VariablesNormalizationCacheHeader)) + require.Equal(t, "HIT", res.Response.Header.Get(core.VariablesRemappingCacheHeader)) + require.Equal(t, "HIT", res.Response.Header.Get(core.ExecutionPlanCacheHeader)) + }) + }) + t.Run("manifest warmup cache hit is independent of client name", func(t *testing.T) { t.Parallel() testenv.Run(t, &testenv.Config{ @@ -943,6 +1119,172 @@ func TestPQLManifest(t *testing.T) { }) }) + t.Run("manifest warmup emits correct feature flag attribute", func(t *testing.T) { + t.Parallel() + + metricReader := metric.NewManualReader() + + testenv.Run(t, &testenv.Config{ + MetricReader: metricReader, + RouterOptions: []core.Option{ + core.WithPersistedOperationsConfig(manifestConfigWithWarmup), + }, + }, func(t *testing.T, xEnv *testenv.Environment) { + // Collect metrics emitted by manifest warmup at startup (no requests needed). + rm := metricdata.ResourceMetrics{} + err := metricReader.Collect(context.Background(), &rm) + require.NoError(t, err) + + metricScope := testutils.GetMetricScopeByName(rm.ScopeMetrics, "cosmo.router") + require.NotNil(t, metricScope) + + m := testutils.GetMetricByName(metricScope, "router.graphql.operation.planning_time") + require.NotNil(t, m, "planning_time metric should be emitted during manifest warmup") + + dataPoints := m.Data.(metricdata.Histogram[float64]).DataPoints + require.NotEmpty(t, dataPoints) + + // The base mux warmup should emit data points with wg.feature_flag = "" + require.True(t, + testutils.HasHistogramDataPointWithAttribute(dataPoints, otel.WgFeatureFlag.String("")), + "expected planning_time data point with wg.feature_flag=\"\" for base mux warmup", + ) + + // The feature flag mux warmup should emit data points with wg.feature_flag = "myff" + require.True(t, + testutils.HasHistogramDataPointWithAttribute(dataPoints, otel.WgFeatureFlag.String("myff")), + "expected planning_time data point with wg.feature_flag=\"myff\" for feature flag mux warmup", + ) + }) + }) + + t.Run("manifest re-warm fires for feature flag muxes", func(t *testing.T) { + t.Parallel() + + employeesHash := "dc67510fb4289672bea757e862d6b00e83db5d3cbbcfb15260601b6f29bb2b8f" + employeesQuery := "query Employees {\n employees {\n id\n }\n}" + + manifestV1, _ := json.Marshal(map[string]interface{}{ + "version": 1, + "revision": "rev-v1", + "generatedAt": "2024-01-01T00:00:00Z", + "operations": map[string]string{ + employeesHash: employeesQuery, + }, + }) + // v2 adds a second operation — the re-warm should plan it for all muxes + typenameHash := "ecf4edb46db40b5132295c0291d62fb65d6759a9eedfa4d5d612dd5ec54a6b38" + manifestV2, _ := json.Marshal(map[string]interface{}{ + "version": 1, + "revision": "rev-v2", + "generatedAt": "2024-01-02T00:00:00Z", + "operations": map[string]string{ + employeesHash: employeesQuery, + typenameHash: "{__typename}", + }, + }) + + var currentManifest atomic.Value + currentManifest.Store(manifestV1) + + var manifestFetchCount atomic.Int32 + + cdnServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if strings.HasSuffix(r.URL.Path, "/operations/manifest.json") { + manifest := currentManifest.Load().([]byte) + + var m struct { + Revision string `json:"revision"` + } + _ = json.Unmarshal(manifest, &m) + + ifNoneMatch := r.Header.Get("If-None-Match") + if ifNoneMatch == `"`+m.Revision+`"` { + w.Header().Set("ETag", ifNoneMatch) + w.WriteHeader(http.StatusNotModified) + return + } + + manifestFetchCount.Add(1) + w.Header().Set("Content-Type", "application/json") + w.Header().Set("ETag", `"`+m.Revision+`"`) + w.WriteHeader(http.StatusOK) + _, _ = w.Write(manifest) + return + } + + w.WriteHeader(http.StatusNotFound) + })) + defer cdnServer.Close() + + metricReader := metric.NewManualReader() + + testenv.Run(t, &testenv.Config{ + CdnSever: cdnServer, + MetricReader: metricReader, + RouterOptions: []core.Option{ + core.WithPersistedOperationsConfig(config.PersistedOperationsConfig{ + Manifest: config.PQLManifestConfig{ + Enabled: true, + PollInterval: 100 * time.Millisecond, + PollJitter: 5 * time.Millisecond, + Warmup: config.PQLManifestWarmupConfig{ + Enabled: true, + Workers: 4, + Timeout: 30 * time.Second, + }, + }, + }), + }, + }, func(t *testing.T, xEnv *testenv.Environment) { + // 1. Count initial warmup planning_time data points for the FF mux + initialRM := metricdata.ResourceMetrics{} + err := metricReader.Collect(context.Background(), &initialRM) + require.NoError(t, err) + + initialScope := testutils.GetMetricScopeByName(initialRM.ScopeMetrics, "cosmo.router") + require.NotNil(t, initialScope) + initialMetric := testutils.GetMetricByName(initialScope, "router.graphql.operation.planning_time") + require.NotNil(t, initialMetric) + + initialFFDataPoints := countDataPointsWithAttribute( + initialMetric.Data.(metricdata.Histogram[float64]).DataPoints, + otel.WgFeatureFlag.String("myff"), + ) + + // 2. Swap to manifest v2 which adds {__typename} + currentManifest.Store(manifestV2) + + // 3. Wait for the poller to pick up the new manifest + require.Eventually(t, func() bool { + return manifestFetchCount.Load() >= 2 + }, 5*time.Second, 50*time.Millisecond) + + // 4. Wait for the re-warm to produce new planning_time metrics for the FF mux. + // This proves the warmup callback ran for the FF mux — no request-based caching involved. + require.Eventually(t, func() bool { + rm := metricdata.ResourceMetrics{} + if collectErr := metricReader.Collect(context.Background(), &rm); collectErr != nil { + return false + } + scope := testutils.GetMetricScopeByName(rm.ScopeMetrics, "cosmo.router") + if scope == nil { + return false + } + m := testutils.GetMetricByName(scope, "router.graphql.operation.planning_time") + if m == nil { + return false + } + currentFFDataPoints := countDataPointsWithAttribute( + m.Data.(metricdata.Histogram[float64]).DataPoints, + otel.WgFeatureFlag.String("myff"), + ) + return currentFFDataPoints > initialFFDataPoints + }, 5*time.Second, 100*time.Millisecond, + "feature flag mux should have emitted new planning_time metrics after manifest re-warm") + }) + }) + t.Run("fails to start when initial CDN manifest fetch fails", func(t *testing.T) { t.Parallel() diff --git a/router/core/graph_server.go b/router/core/graph_server.go index f478e53590..9aec84eafc 100644 --- a/router/core/graph_server.go +++ b/router/core/graph_server.go @@ -324,6 +324,29 @@ func newGraphServer(ctx context.Context, r *Router, routerConfig *nodev1.RouterC return nil, fmt.Errorf("failed to build feature flag handler: %w", err) } + // Register a single composed manifest re-warm callback for all muxes (base + feature flags). + // On config reload, the new graphServer replaces the old callback — correct by design. + if s.persistedOperationClient != nil { + if pqlStore := s.persistedOperationClient.PQLStore(); pqlStore != nil && pqlStore.IsLoaded() { + s.graphMuxListLock.Lock() + rewarmFns := make([]func(), 0, len(s.graphMuxList)) + for _, m := range s.graphMuxList { + if m.manifestRewarmFn != nil { + rewarmFns = append(rewarmFns, m.manifestRewarmFn) + } + } + s.graphMuxListLock.Unlock() + + if len(rewarmFns) > 0 { + pqlStore.SetOnUpdate(func() { + for _, fn := range rewarmFns { + fn() + } + }) + } + } + } + wrapper, err := gzhttp.NewWrapper( gzhttp.MinSize(int(s.routerTrafficConfig.ResponseCompressionMinSize)), gzhttp.CompressionLevel(gzip.DefaultCompression), @@ -556,6 +579,8 @@ type graphMux struct { validationCache *ristretto.Cache[uint64, bool] operationHashCache *ristretto.Cache[uint64, string] + manifestRewarmFn func() // called by Store worker on manifest update; nil if warmup disabled + accessLogsFileLogger *logging.BufferedLogger metricStore rmetric.Store prometheusCacheMetrics *rmetric.CacheMetrics @@ -1528,10 +1553,9 @@ func (s *graphServer) buildGraphMux( s.logger.Error("Failed to warmup PQL manifest operations", zap.Error(err)) } - // Re-warm when the manifest is updated by the poller. - // The store handles coalescing — if a re-warm is already running or pending, - // new signals are dropped. The worker always reads the latest manifest. - pqlStore.SetOnUpdate(func() { + // Store the rewarm function so the caller can compose a single callback + // for all muxes (base + feature flags) after they're all built. + gm.manifestRewarmFn = func() { rewarmConfig := &CacheWarmupConfig{ Log: s.logger, Processor: manifestProcessor, @@ -1545,7 +1569,7 @@ func (s *graphServer) buildGraphMux( if rewarmErr := WarmupCaches(ctx, rewarmConfig); rewarmErr != nil { s.logger.Error("Failed to re-warm PQL manifest operations after update", zap.Error(rewarmErr)) } - }) + } } } @@ -1983,6 +2007,7 @@ func (s *graphServer) Shutdown(ctx context.Context) error { } // Shutdown all graphs muxes to release resources + // Each mux removes its own manifest listener during shutdown. // e.g. planner cache s.graphMuxListLock.Lock() defer s.graphMuxListLock.Unlock() diff --git a/router/internal/persistedoperation/pqlmanifest/store.go b/router/internal/persistedoperation/pqlmanifest/store.go index 9c06b655f1..80a743d6fb 100644 --- a/router/internal/persistedoperation/pqlmanifest/store.go +++ b/router/internal/persistedoperation/pqlmanifest/store.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "os" - "sync" "sync/atomic" "go.uber.org/zap" @@ -18,48 +17,45 @@ type Manifest struct { } type Store struct { - manifest atomic.Pointer[Manifest] - updateCh chan struct{} - onUpdate atomic.Value // stores func() - startOnce sync.Once - logger *zap.Logger + manifest atomic.Pointer[Manifest] + updateCh chan struct{} + onUpdate atomic.Value // stores func() + logger *zap.Logger } func NewStore(logger *zap.Logger) *Store { - return &Store{ + s := &Store{ logger: logger, updateCh: make(chan struct{}, 1), } + go s.run() + return s +} + +// run is the single worker goroutine that processes manifest update signals +// and calls the registered callback. +func (s *Store) run() { + for range s.updateCh { + if fn, ok := s.onUpdate.Load().(func()); ok && fn != nil { + fn() + } + } } // SetOnUpdate registers a callback that is invoked after the manifest is updated via Load. -// The callback runs on a dedicated worker goroutine that processes signals sequentially. -// If an update arrives while the callback is still running, it is coalesced into a single -// pending signal — at most one signal is buffered, so rapid updates don't queue up. -// Safe to call multiple times (e.g. on config reload): the callback is swapped atomically. +// The callback runs on a dedicated worker goroutine with coalescing — if the worker is busy, +// new signals are dropped so rapid updates don't queue unbounded work. +// Safe to call multiple times: the callback is swapped atomically. On config reload, +// the new graphServer replaces the old callback, which is correct by design. func (s *Store) SetOnUpdate(fn func()) { s.onUpdate.Store(fn) - s.startOnce.Do(func() { - go func() { - for range s.updateCh { - if f, ok := s.onUpdate.Load().(func()); ok && f != nil { - f() - } - } - }() - }) -} - -// Load swaps the manifest atomically and signals the update worker if a callback is registered. -// If the worker is busy processing a previous update, the signal is dropped (coalesced) -// so back-to-back manifest updates don't queue unbounded work. +} + +// Load swaps the manifest atomically and signals the worker goroutine. +// If the worker is busy, the signal is coalesced (dropped). func (s *Store) Load(manifest *Manifest) { s.manifest.Store(manifest) - if s.onUpdate.Load() == nil { - return - } - select { case s.updateCh <- struct{}{}: default: @@ -67,7 +63,7 @@ func (s *Store) Load(manifest *Manifest) { } } -// Close stops the update worker goroutine. +// Close stops the worker goroutine. func (s *Store) Close() { close(s.updateCh) } diff --git a/router/internal/persistedoperation/pqlmanifest/store_test.go b/router/internal/persistedoperation/pqlmanifest/store_test.go index 4ca95a5f5b..2d6559ecaa 100644 --- a/router/internal/persistedoperation/pqlmanifest/store_test.go +++ b/router/internal/persistedoperation/pqlmanifest/store_test.go @@ -1,7 +1,6 @@ package pqlmanifest import ( - "fmt" "os" "path/filepath" "sync/atomic" @@ -108,6 +107,7 @@ func TestStore(t *testing.T) { t.Run("SetOnUpdate callback is invoked on Load", func(t *testing.T) { store := NewStore(zap.NewNop()) + defer store.Close() var called atomic.Bool store.SetOnUpdate(func() { @@ -121,56 +121,16 @@ func TestStore(t *testing.T) { }, time.Second, 10*time.Millisecond) }) - t.Run("SetOnUpdate not called when no callback set", func(t *testing.T) { + t.Run("no callback does not panic", func(t *testing.T) { store := NewStore(zap.NewNop()) - // Should not panic + defer store.Close() store.Load(&Manifest{Version: 1, Revision: "rev-1", Operations: map[string]string{"a": "query { a }"}}) }) - t.Run("SetOnUpdate runs callbacks sequentially", func(t *testing.T) { - store := NewStore(zap.NewNop()) - - var concurrent atomic.Int32 - var maxConcurrent atomic.Int32 - var totalCalls atomic.Int32 - - store.SetOnUpdate(func() { - c := concurrent.Add(1) - // Track the max concurrency observed - for { - old := maxConcurrent.Load() - if c <= old || maxConcurrent.CompareAndSwap(old, c) { - break - } - } - time.Sleep(10 * time.Millisecond) - totalCalls.Add(1) - concurrent.Add(-1) - }) - - // Fire multiple updates; channel coalescing means not all will be processed, - // but those that are must run sequentially (max concurrency = 1). - for i := 0; i < 5; i++ { - store.Load(&Manifest{ - Version: 1, - Revision: fmt.Sprintf("rev-%d", i), - Operations: map[string]string{"a": "q"}, - }) - } - - require.Eventually(t, func() bool { - return totalCalls.Load() >= 1 - }, 2*time.Second, 10*time.Millisecond) - - // Wait for any in-flight callback to finish - time.Sleep(50 * time.Millisecond) - - require.Equal(t, int32(1), maxConcurrent.Load(), "callbacks must run sequentially, never concurrently") - }) - t.Run("rapid loads coalesce signals when worker is busy", func(t *testing.T) { core, logs := observer.New(zap.DebugLevel) store := NewStore(zap.New(core)) + defer store.Close() processing := make(chan struct{}) proceed := make(chan struct{}) @@ -178,101 +138,80 @@ func TestStore(t *testing.T) { store.SetOnUpdate(func() { totalCalls.Add(1) - processing <- struct{}{} // signal that we started - <-proceed // block until test says go + processing <- struct{}{} + <-proceed }) - // First Load — worker picks it up store.Load(&Manifest{Version: 1, Revision: "rev-1", Operations: map[string]string{"a": "q"}}) - <-processing // wait until worker is busy + <-processing - // Second Load — fills the channel buffer (1 pending signal) store.Load(&Manifest{Version: 1, Revision: "rev-2", Operations: map[string]string{"a": "q"}}) - - // Third and fourth Loads — should be dropped (channel full, worker busy) store.Load(&Manifest{Version: 1, Revision: "rev-3", Operations: map[string]string{"a": "q"}}) store.Load(&Manifest{Version: 1, Revision: "rev-4", Operations: map[string]string{"a": "q"}}) - // Verify drop messages were logged dropCount := logs.FilterMessage("Skipping PQL manifest update signal, worker is busy").Len() require.GreaterOrEqual(t, dropCount, 2, "at least 2 signals should have been dropped") - // Let the first callback finish proceed <- struct{}{} - - // Second callback starts (the one pending signal) <-processing proceed <- struct{}{} - // Wait for everything to settle time.Sleep(50 * time.Millisecond) - - // Exactly 2 callbacks: the first + the one that was buffered. The rest were dropped. require.Equal(t, int32(2), totalCalls.Load()) }) t.Run("manifest is updated even when signal is dropped", func(t *testing.T) { store := NewStore(zap.NewNop()) + defer store.Close() block := make(chan struct{}) store.SetOnUpdate(func() { <-block }) - // First load — worker picks it up and blocks store.Load(&Manifest{Version: 1, Revision: "rev-1", Operations: map[string]string{"a": "q1"}}) time.Sleep(20 * time.Millisecond) - // Second load — queued in channel store.Load(&Manifest{Version: 1, Revision: "rev-2", Operations: map[string]string{"b": "q2"}}) - - // Third load — signal dropped, but manifest IS updated atomically store.Load(&Manifest{Version: 1, Revision: "rev-3", Operations: map[string]string{"c": "q3"}}) - // Even though the signal was dropped, the manifest pointer should reflect the latest load require.Equal(t, "rev-3", store.Revision()) body, found := store.LookupByHash("c") require.True(t, found) require.Equal(t, "q3", string(body)) - // Old operations should be gone _, found = store.LookupByHash("a") require.False(t, found) close(block) }) - t.Run("SetOnUpdate can be called multiple times without leaking goroutines", func(t *testing.T) { + t.Run("SetOnUpdate replaces previous callback", func(t *testing.T) { store := NewStore(zap.NewNop()) + defer store.Close() - var firstCalls atomic.Int32 - var secondCalls atomic.Int32 + var calls1 atomic.Int32 + var calls2 atomic.Int32 - // Register first callback - store.SetOnUpdate(func() { - firstCalls.Add(1) - }) + store.SetOnUpdate(func() { calls1.Add(1) }) store.Load(&Manifest{Version: 1, Revision: "rev-1", Operations: map[string]string{"a": "q"}}) require.Eventually(t, func() bool { - return firstCalls.Load() >= 1 + return calls1.Load() >= 1 }, time.Second, 10*time.Millisecond) - // Replace with second callback — old worker should stop - store.SetOnUpdate(func() { - secondCalls.Add(1) - }) + // Replace callback + store.SetOnUpdate(func() { calls2.Add(1) }) - firstCountBefore := firstCalls.Load() + calls1Before := calls1.Load() - // New loads should only trigger the second callback store.Load(&Manifest{Version: 1, Revision: "rev-2", Operations: map[string]string{"a": "q"}}) require.Eventually(t, func() bool { - return secondCalls.Load() >= 1 + return calls2.Load() >= 1 }, time.Second, 10*time.Millisecond) - // First callback should not have been called again - require.Equal(t, firstCountBefore, firstCalls.Load()) + // Old callback should not have been called again + require.Equal(t, calls1Before, calls1.Load()) }) }