keiro-migrations-0.12.0.0: expected-schema/native/keiro-v18.txt
column keiro_awakeables.awakeable_id uuid not null
column keiro_awakeables.completed_at timestamp with time zone
column keiro_awakeables.created_at timestamp with time zone not null default now()
column keiro_awakeables.owner_workflow_id text not null
column keiro_awakeables.owner_workflow_name text not null
column keiro_awakeables.payload jsonb
column keiro_awakeables.status text not null default 'pending'::text
column keiro_awakeables.updated_at timestamp with time zone not null default now()
column keiro_dead_letters.attempt_count integer not null
column keiro_dead_letters.correlation_id text not null
column keiro_dead_letters.created_at timestamp with time zone not null default now()
column keiro_dead_letters.dead_letter_id bigint not null default nextval('keiro.keiro_dead_letters_dead_letter_id_seq'::regclass)
column keiro_dead_letters.dispatcher_kind text not null
column keiro_dead_letters.dispatcher_name text not null
column keiro_dead_letters.emit_index integer not null
column keiro_dead_letters.error_class text not null
column keiro_dead_letters.error_detail text not null
column keiro_dead_letters.source_event_id uuid not null
column keiro_dead_letters.source_global_position bigint not null
column keiro_dead_letters.target_stream_name text not null
column keiro_external_read_contracts.argument_names text[] not null default ARRAY[]::text[]
column keiro_external_read_contracts.argument_types text[] not null default ARRAY[]::text[]
column keiro_external_read_contracts.compatible_revision_ids text[] not null
column keiro_external_read_contracts.contract_id text not null
column keiro_external_read_contracts.contract_kind text not null
column keiro_external_read_contracts.contract_version integer not null
column keiro_external_read_contracts.created_at timestamp with time zone not null default now()
column keiro_external_read_contracts.definition_hash text not null
column keiro_external_read_contracts.group_id text not null
column keiro_external_read_contracts.immutable_signature_hash text not null
column keiro_external_read_contracts.private_implementation text
column keiro_external_read_contracts.private_implementation_version integer
column keiro_external_read_contracts.public_function_name text not null
column keiro_external_read_contracts.query_model_id text not null
column keiro_external_read_contracts.result_shape_hash text not null
column keiro_external_read_contracts.result_type text not null
column keiro_external_read_contracts.retired_at timestamp with time zone
column keiro_external_read_contracts.serving_shape_hash text
column keiro_external_read_contracts.state text not null
column keiro_external_read_contracts.surface_generation integer not null
column keiro_external_read_contracts.updated_at timestamp with time zone not null default now()
column keiro_inbox.attempt_count bigint not null default 0
column keiro_inbox.attributes jsonb
column keiro_inbox.causation_id uuid
column keiro_inbox.completed_at timestamp with time zone
column keiro_inbox.content_type text not null
column keiro_inbox.correlation_id uuid
column keiro_inbox.dedupe_key text not null
column keiro_inbox.destination text
column keiro_inbox.event_type text
column keiro_inbox.failed_at timestamp with time zone
column keiro_inbox.kafka_offset bigint
column keiro_inbox.kafka_partition bigint
column keiro_inbox.kafka_topic text
column keiro_inbox.last_error text
column keiro_inbox.message_id text
column keiro_inbox.occurred_at timestamp with time zone
column keiro_inbox.payload_bytes bytea not null
column keiro_inbox.received_at timestamp with time zone not null default now()
column keiro_inbox.schema_fingerprint text
column keiro_inbox.schema_id bigint
column keiro_inbox.schema_registry text
column keiro_inbox.schema_subject text
column keiro_inbox.schema_version bigint
column keiro_inbox.schema_version_ref bigint
column keiro_inbox.source text not null
column keiro_inbox.source_event_id uuid
column keiro_inbox.source_global_position bigint
column keiro_inbox.status text not null default 'processing'::text
column keiro_inbox.traceparent text
column keiro_inbox.tracestate text
column keiro_managed_read_objects.contract_id text
column keiro_managed_read_objects.contract_version integer
column keiro_managed_read_objects.created_at timestamp with time zone not null default now()
column keiro_managed_read_objects.definition_hash text not null
column keiro_managed_read_objects.managed_by text not null
column keiro_managed_read_objects.object_kind text not null
column keiro_managed_read_objects.object_name text not null
column keiro_managed_read_objects.object_schema text not null
column keiro_managed_read_objects.object_signature text not null default ''::text
column keiro_managed_read_objects.retired_at timestamp with time zone
column keiro_managed_read_objects.state text not null
column keiro_managed_read_objects.surface_generation integer not null
column keiro_managed_read_objects.updated_at timestamp with time zone not null default now()
column keiro_outbox.attempt_count bigint not null default 0
column keiro_outbox.attributes jsonb
column keiro_outbox.causation_id uuid
column keiro_outbox.content_type text not null
column keiro_outbox.correlation_id uuid
column keiro_outbox.created_at timestamp with time zone not null default now()
column keiro_outbox.destination text not null
column keiro_outbox.event_type text not null
column keiro_outbox.last_error text
column keiro_outbox.message_id text not null
column keiro_outbox.message_key text
column keiro_outbox.next_attempt_at timestamp with time zone not null default now()
column keiro_outbox.occurred_at timestamp with time zone not null
column keiro_outbox.outbox_id uuid not null
column keiro_outbox.payload_bytes bytea not null
column keiro_outbox.published_at timestamp with time zone
column keiro_outbox.schema_fingerprint text
column keiro_outbox.schema_id bigint
column keiro_outbox.schema_registry text
column keiro_outbox.schema_subject text
column keiro_outbox.schema_version bigint not null
column keiro_outbox.schema_version_ref bigint
column keiro_outbox.source text not null
column keiro_outbox.source_event_id uuid
column keiro_outbox.source_global_position bigint
column keiro_outbox.status text not null default 'pending'::text
column keiro_outbox.traceparent text
column keiro_outbox.tracestate text
column keiro_outbox.updated_at timestamp with time zone not null default now()
column keiro_projection_dedup.applied_at timestamp with time zone not null default now()
column keiro_projection_dedup.event_id uuid not null
column keiro_projection_dedup.projection_name text not null
column keiro_projection_group_cursors.group_id text not null
column keiro_projection_group_cursors.position_basis text not null
column keiro_projection_group_cursors.subscription_names text[] not null default ARRAY[]::text[]
column keiro_projection_group_cursors.updated_at timestamp with time zone not null default now()
column keiro_projection_rebuild_adapters.adapter_order integer not null
column keiro_projection_rebuild_adapters.apply_count bigint not null default 0
column keiro_projection_rebuild_adapters.completed_through bigint
column keiro_projection_rebuild_adapters.evaluation_count bigint not null default 0
column keiro_projection_rebuild_adapters.projection_id text not null
column keiro_projection_rebuild_adapters.run_id text not null
column keiro_projection_rebuild_adapters.source_id text not null
column keiro_projection_rebuild_adapters.updated_at timestamp with time zone not null default now()
column keiro_projection_rebuild_dedup_stage.event_id uuid not null
column keiro_projection_rebuild_dedup_stage.global_position bigint not null
column keiro_projection_rebuild_dedup_stage.projection_name text not null
column keiro_projection_rebuild_dedup_stage.run_id text not null
column keiro_projection_rebuild_dedup_stage.subscription_name text not null
column keiro_projection_rebuild_groups.active_run_id text
column keiro_projection_rebuild_groups.completed_at timestamp with time zone
column keiro_projection_rebuild_groups.created_at timestamp with time zone not null default now()
column keiro_projection_rebuild_groups.failed_at timestamp with time zone
column keiro_projection_rebuild_groups.failure_code text
column keiro_projection_rebuild_groups.failure_detail text
column keiro_projection_rebuild_groups.group_id text not null
column keiro_projection_rebuild_groups.reads_allowed boolean not null default true
column keiro_projection_rebuild_groups.request_reason text
column keiro_projection_rebuild_groups.requested_by text
column keiro_projection_rebuild_groups.serving_epoch bigint not null default 0
column keiro_projection_rebuild_groups.serving_revision_id text
column keiro_projection_rebuild_groups.slice_fingerprint text not null
column keiro_projection_rebuild_groups.started_at timestamp with time zone
column keiro_projection_rebuild_groups.status text not null
column keiro_projection_rebuild_groups.updated_at timestamp with time zone not null default now()
column keiro_projection_rebuild_groups.writes_allowed boolean not null default true
column keiro_projection_rebuild_promotion_objects.canonical_name text not null
column keiro_projection_rebuild_promotion_objects.generation_name text not null
column keiro_projection_rebuild_promotion_objects.object_kind text not null
column keiro_projection_rebuild_promotion_objects.object_order integer not null
column keiro_projection_rebuild_promotion_objects.run_id text not null
column keiro_projection_rebuild_promotion_objects.target_id text not null
column keiro_projection_rebuild_run_targets.candidate_generation_id uuid not null
column keiro_projection_rebuild_run_targets.run_id text not null
column keiro_projection_rebuild_run_targets.target_id text not null
column keiro_projection_rebuild_run_targets.target_mode text not null
column keiro_projection_rebuild_runs.abandoned_at timestamp with time zone
column keiro_projection_rebuild_runs.candidate_revision_id text
column keiro_projection_rebuild_runs.captured_head bigint not null
column keiro_projection_rebuild_runs.catalog_fingerprint text not null
column keiro_projection_rebuild_runs.contract_fingerprint text not null
column keiro_projection_rebuild_runs.cutover_lock_timeout_ms bigint
column keiro_projection_rebuild_runs.cutover_threshold bigint
column keiro_projection_rebuild_runs.dedup_provisional_head bigint
column keiro_projection_rebuild_runs.failed_at timestamp with time zone
column keiro_projection_rebuild_runs.failure_code text
column keiro_projection_rebuild_runs.failure_detail text
column keiro_projection_rebuild_runs.failure_position bigint
column keiro_projection_rebuild_runs.failure_projection_id text
column keiro_projection_rebuild_runs.failure_source_id text
column keiro_projection_rebuild_runs.group_id text not null
column keiro_projection_rebuild_runs.group_slice_fingerprint text not null
column keiro_projection_rebuild_runs.history_retention_expires_at timestamp with time zone
column keiro_projection_rebuild_runs.history_retention_lease_id uuid
column keiro_projection_rebuild_runs.history_retention_lease_owner text
column keiro_projection_rebuild_runs.history_retention_protected_through bigint
column keiro_projection_rebuild_runs.history_retention_released_at timestamp with time zone
column keiro_projection_rebuild_runs.history_retention_renewed_at timestamp with time zone
column keiro_projection_rebuild_runs.page_size integer not null
column keiro_projection_rebuild_runs.promoted_at timestamp with time zone
column keiro_projection_rebuild_runs.promotion_dedup_limit bigint
column keiro_projection_rebuild_runs.promotion_prepared_at timestamp with time zone
column keiro_projection_rebuild_runs.rebuild_mode text not null default 'offline'::text
column keiro_projection_rebuild_runs.run_id text not null
column keiro_projection_rebuild_runs.runner_format text not null
column keiro_projection_rebuild_runs.started_at timestamp with time zone not null default now()
column keiro_projection_rebuild_runs.status text not null default 'running'::text
column keiro_projection_rebuild_runs.updated_at timestamp with time zone not null default now()
column keiro_projection_rebuild_runs.verified_at timestamp with time zone
column keiro_projection_rebuild_sources.category text
column keiro_projection_rebuild_sources.cursor_position bigint not null default 0
column keiro_projection_rebuild_sources.event_count bigint not null default 0
column keiro_projection_rebuild_sources.exhausted_through bigint
column keiro_projection_rebuild_sources.run_id text not null
column keiro_projection_rebuild_sources.source_id text not null
column keiro_projection_rebuild_sources.source_scope text not null
column keiro_projection_rebuild_sources.target_position bigint not null
column keiro_projection_rebuild_sources.updated_at timestamp with time zone not null default now()
column keiro_projection_rebuild_verifications.completed_at timestamp with time zone
column keiro_projection_rebuild_verifications.detail text
column keiro_projection_rebuild_verifications.run_id text not null
column keiro_projection_rebuild_verifications.status text not null default 'pending'::text
column keiro_projection_rebuild_verifications.verification_id text not null
column keiro_projection_rebuild_verifications.verification_version text not null
column keiro_projection_revisions.group_id text not null
column keiro_projection_revisions.group_slice_fingerprint text not null
column keiro_projection_revisions.registered_at timestamp with time zone not null default now()
column keiro_projection_revisions.revision_id text not null
column keiro_projection_revisions.updated_at timestamp with time zone not null default now()
column keiro_projection_target_generations.created_at timestamp with time zone not null default now()
column keiro_projection_target_generations.created_by_run_id text
column keiro_projection_target_generations.dropped_at timestamp with time zone
column keiro_projection_target_generations.expected_shape_id text not null
column keiro_projection_target_generations.generation_id uuid not null
column keiro_projection_target_generations.group_id text not null
column keiro_projection_target_generations.lifecycle text not null
column keiro_projection_target_generations.observed_catalog_snapshot text not null
column keiro_projection_target_generations.observed_shape_fingerprint text not null
column keiro_projection_target_generations.relation_name text not null
column keiro_projection_target_generations.relation_oid bigint not null
column keiro_projection_target_generations.retired_at timestamp with time zone
column keiro_projection_target_generations.revision_id text not null
column keiro_projection_target_generations.schema_name text not null
column keiro_projection_target_generations.schema_version text not null
column keiro_projection_target_generations.served_at timestamp with time zone
column keiro_projection_target_generations.target_id text not null
column keiro_read_models.last_built_at timestamp with time zone
column keiro_read_models.name text not null
column keiro_read_models.rebuild_group_id text not null
column keiro_read_models.shape_hash text not null
column keiro_read_models.status text not null
column keiro_read_models.updated_at timestamp with time zone not null default now()
column keiro_read_models.version bigint not null
column keiro_snapshots.created_at timestamp with time zone not null default now()
column keiro_snapshots.regfile_shape_hash text not null
column keiro_snapshots.state jsonb not null
column keiro_snapshots.state_codec_version bigint not null
column keiro_snapshots.state_shape_hash text not null default ''::text
column keiro_snapshots.stream_id bigint not null
column keiro_snapshots.stream_version bigint not null
column keiro_snapshots.updated_at timestamp with time zone not null default now()
column keiro_subscription_shards.bucket integer not null
column keiro_subscription_shards.heartbeat_at timestamp with time zone
column keiro_subscription_shards.lease_expires_at timestamp with time zone
column keiro_subscription_shards.owner_worker_id uuid
column keiro_subscription_shards.shard_count integer not null
column keiro_subscription_shards.subscription_name text not null
column keiro_subscription_shards.updated_at timestamp with time zone not null default now()
column keiro_timers.attempts bigint not null default 0
column keiro_timers.correlation_id text not null
column keiro_timers.created_at timestamp with time zone not null default now()
column keiro_timers.fire_at timestamp with time zone not null
column keiro_timers.fired_event_id uuid
column keiro_timers.last_error text
column keiro_timers.payload jsonb not null
column keiro_timers.process_manager_name text not null
column keiro_timers.status text not null default 'scheduled'::text
column keiro_timers.timer_id uuid not null
column keiro_timers.updated_at timestamp with time zone not null default now()
column keiro_workflow_children.await_step text not null
column keiro_workflow_children.child_id text not null
column keiro_workflow_children.child_name text not null
column keiro_workflow_children.completed_at timestamp with time zone
column keiro_workflow_children.created_at timestamp with time zone not null default now()
column keiro_workflow_children.failure_reason text
column keiro_workflow_children.parent_id text not null
column keiro_workflow_children.parent_name text not null
column keiro_workflow_children.result jsonb
column keiro_workflow_children.status text not null default 'running'::text
column keiro_workflow_children.updated_at timestamp with time zone not null default now()
column keiro_workflow_steps.generation integer not null default 0
column keiro_workflow_steps.recorded_at timestamp with time zone not null default now()
column keiro_workflow_steps.result jsonb not null
column keiro_workflow_steps.step_name text not null
column keiro_workflow_steps.workflow_id text not null
column keiro_workflow_steps.workflow_name text not null
column keiro_workflows.attempts integer not null default 0
column keiro_workflows.completed_at timestamp with time zone
column keiro_workflows.created_at timestamp with time zone not null default now()
column keiro_workflows.generation integer not null default 0
column keiro_workflows.last_error text
column keiro_workflows.lease_expires_at timestamp with time zone
column keiro_workflows.leased_by text
column keiro_workflows.next_attempt_at timestamp with time zone
column keiro_workflows.status text not null default 'running'::text
column keiro_workflows.updated_at timestamp with time zone not null default now()
column keiro_workflows.wake_after timestamp with time zone
column keiro_workflows.workflow_id text not null
column keiro_workflows.workflow_name text not null
constraint keiro_awakeables.keiro_awakeables_awakeable_id_not_null NOT NULL awakeable_id
constraint keiro_awakeables.keiro_awakeables_created_at_not_null NOT NULL created_at
constraint keiro_awakeables.keiro_awakeables_owner_workflow_id_not_null NOT NULL owner_workflow_id
constraint keiro_awakeables.keiro_awakeables_owner_workflow_name_not_null NOT NULL owner_workflow_name
constraint keiro_awakeables.keiro_awakeables_pkey PRIMARY KEY (awakeable_id)
constraint keiro_awakeables.keiro_awakeables_status_chk CHECK ((status = ANY (ARRAY['pending'::text, 'completed'::text, 'cancelled'::text])))
constraint keiro_awakeables.keiro_awakeables_status_not_null NOT NULL status
constraint keiro_awakeables.keiro_awakeables_updated_at_not_null NOT NULL updated_at
constraint keiro_dead_letters.keiro_dead_letters_attempt_count_chk CHECK ((attempt_count >= 1))
constraint keiro_dead_letters.keiro_dead_letters_attempt_count_not_null NOT NULL attempt_count
constraint keiro_dead_letters.keiro_dead_letters_correlation_id_not_null NOT NULL correlation_id
constraint keiro_dead_letters.keiro_dead_letters_created_at_not_null NOT NULL created_at
constraint keiro_dead_letters.keiro_dead_letters_dead_letter_id_not_null NOT NULL dead_letter_id
constraint keiro_dead_letters.keiro_dead_letters_dispatcher_kind_chk CHECK ((dispatcher_kind = ANY (ARRAY['process-manager'::text, 'router'::text])))
constraint keiro_dead_letters.keiro_dead_letters_dispatcher_kind_not_null NOT NULL dispatcher_kind
constraint keiro_dead_letters.keiro_dead_letters_dispatcher_name_not_null NOT NULL dispatcher_name
constraint keiro_dead_letters.keiro_dead_letters_dispatcher_name_source_event_id_emit_ind_key UNIQUE (dispatcher_name, source_event_id, emit_index)
constraint keiro_dead_letters.keiro_dead_letters_emit_index_not_null NOT NULL emit_index
constraint keiro_dead_letters.keiro_dead_letters_error_class_not_null NOT NULL error_class
constraint keiro_dead_letters.keiro_dead_letters_error_detail_not_null NOT NULL error_detail
constraint keiro_dead_letters.keiro_dead_letters_pkey PRIMARY KEY (dead_letter_id)
constraint keiro_dead_letters.keiro_dead_letters_source_event_id_not_null NOT NULL source_event_id
constraint keiro_dead_letters.keiro_dead_letters_source_global_position_not_null NOT NULL source_global_position
constraint keiro_dead_letters.keiro_dead_letters_target_stream_name_not_null NOT NULL target_stream_name
constraint keiro_external_read_contracts.keiro_external_read_contracts_argument_names_not_null NOT NULL argument_names
constraint keiro_external_read_contracts.keiro_external_read_contracts_argument_types_not_null NOT NULL argument_types
constraint keiro_external_read_contracts.keiro_external_read_contracts_compatible_revision_ids_not_null NOT NULL compatible_revision_ids
constraint keiro_external_read_contracts.keiro_external_read_contracts_contract_id_not_null NOT NULL contract_id
constraint keiro_external_read_contracts.keiro_external_read_contracts_contract_kind_not_null NOT NULL contract_kind
constraint keiro_external_read_contracts.keiro_external_read_contracts_contract_version_not_null NOT NULL contract_version
constraint keiro_external_read_contracts.keiro_external_read_contracts_created_at_not_null NOT NULL created_at
constraint keiro_external_read_contracts.keiro_external_read_contracts_definition_hash_not_null NOT NULL definition_hash
constraint keiro_external_read_contracts.keiro_external_read_contracts_group_id_fkey FOREIGN KEY (group_id) REFERENCES keiro.keiro_projection_rebuild_groups(group_id)
constraint keiro_external_read_contracts.keiro_external_read_contracts_group_id_not_null NOT NULL group_id
constraint keiro_external_read_contracts.keiro_external_read_contracts_identity_chk CHECK (((length(contract_id) > 0) AND (contract_version > 0) AND (length(query_model_id) > 0) AND (length(group_id) > 0) AND (length(public_function_name) > 0) AND (length(result_type) > 0) AND (length(result_shape_hash) > 0) AND (length(immutable_signature_hash) > 0) AND (length(definition_hash) > 0) AND (surface_generation > 0) AND (cardinality(compatible_revision_ids) > 0) AND (array_position(compatible_revision_ids, NULL::text) IS NULL) AND (array_position(argument_names, NULL::text) IS NULL) AND (array_position(argument_types, NULL::text) IS NULL) AND (cardinality(argument_names) = cardinality(argument_types))))
constraint keiro_external_read_contracts.keiro_external_read_contracts_immutable_signature_hash_not_null NOT NULL immutable_signature_hash
constraint keiro_external_read_contracts.keiro_external_read_contracts_implementation_chk CHECK ((((contract_kind = 'all-rows'::text) AND (cardinality(argument_names) = 0) AND (private_implementation IS NULL) AND (private_implementation_version IS NULL)) OR ((contract_kind = 'keyed'::text) AND (private_implementation IS NOT NULL) AND (length(private_implementation) > 0) AND (private_implementation_version > 0))))
constraint keiro_external_read_contracts.keiro_external_read_contracts_kind_chk CHECK ((contract_kind = ANY (ARRAY['all-rows'::text, 'keyed'::text])))
constraint keiro_external_read_contracts.keiro_external_read_contracts_pkey PRIMARY KEY (contract_id, contract_version)
constraint keiro_external_read_contracts.keiro_external_read_contracts_public_function_name_argument_key UNIQUE (public_function_name, argument_types)
constraint keiro_external_read_contracts.keiro_external_read_contracts_public_function_name_not_null NOT NULL public_function_name
constraint keiro_external_read_contracts.keiro_external_read_contracts_query_model_id_not_null NOT NULL query_model_id
constraint keiro_external_read_contracts.keiro_external_read_contracts_result_shape_hash_not_null NOT NULL result_shape_hash
constraint keiro_external_read_contracts.keiro_external_read_contracts_result_type_not_null NOT NULL result_type
constraint keiro_external_read_contracts.keiro_external_read_contracts_retired_chk CHECK ((((state = 'retired'::text) AND (retired_at IS NOT NULL)) OR ((state <> 'retired'::text) AND (retired_at IS NULL))))
constraint keiro_external_read_contracts.keiro_external_read_contracts_state_chk CHECK ((state = ANY (ARRAY['candidate'::text, 'active'::text, 'pending-retirement'::text, 'retired'::text])))
constraint keiro_external_read_contracts.keiro_external_read_contracts_state_not_null NOT NULL state
constraint keiro_external_read_contracts.keiro_external_read_contracts_surface_generation_not_null NOT NULL surface_generation
constraint keiro_external_read_contracts.keiro_external_read_contracts_updated_at_not_null NOT NULL updated_at
constraint keiro_inbox.keiro_inbox_attempt_count_not_null NOT NULL attempt_count
constraint keiro_inbox.keiro_inbox_content_type_not_null NOT NULL content_type
constraint keiro_inbox.keiro_inbox_dedupe_key_not_null NOT NULL dedupe_key
constraint keiro_inbox.keiro_inbox_payload_bytes_not_null NOT NULL payload_bytes
constraint keiro_inbox.keiro_inbox_pkey PRIMARY KEY (source, dedupe_key)
constraint keiro_inbox.keiro_inbox_received_at_not_null NOT NULL received_at
constraint keiro_inbox.keiro_inbox_source_not_null NOT NULL source
constraint keiro_inbox.keiro_inbox_status_not_null NOT NULL status
constraint keiro_managed_read_objects.keiro_managed_read_objects_contract_id_contract_version_fkey FOREIGN KEY (contract_id, contract_version) REFERENCES keiro.keiro_external_read_contracts(contract_id, contract_version)
constraint keiro_managed_read_objects.keiro_managed_read_objects_created_at_not_null NOT NULL created_at
constraint keiro_managed_read_objects.keiro_managed_read_objects_definition_hash_not_null NOT NULL definition_hash
constraint keiro_managed_read_objects.keiro_managed_read_objects_identity_chk CHECK (((length(object_schema) > 0) AND (length(object_name) > 0) AND (length(object_kind) > 0) AND (length(managed_by) > 0) AND (length(definition_hash) > 0) AND (surface_generation > 0) AND (((contract_id IS NULL) AND (contract_version IS NULL)) OR ((contract_id IS NOT NULL) AND (contract_version IS NOT NULL)))))
constraint keiro_managed_read_objects.keiro_managed_read_objects_kind_chk CHECK ((object_kind = ANY (ARRAY['guard-function'::text, 'binding-view'::text, 'wrapper-function'::text, 'contract-type'::text])))
constraint keiro_managed_read_objects.keiro_managed_read_objects_managed_by_not_null NOT NULL managed_by
constraint keiro_managed_read_objects.keiro_managed_read_objects_object_kind_not_null NOT NULL object_kind
constraint keiro_managed_read_objects.keiro_managed_read_objects_object_name_not_null NOT NULL object_name
constraint keiro_managed_read_objects.keiro_managed_read_objects_object_schema_not_null NOT NULL object_schema
constraint keiro_managed_read_objects.keiro_managed_read_objects_object_signature_not_null NOT NULL object_signature
constraint keiro_managed_read_objects.keiro_managed_read_objects_owner_chk CHECK ((managed_by = ANY (ARRAY['keiro'::text, 'consumer'::text])))
constraint keiro_managed_read_objects.keiro_managed_read_objects_pkey PRIMARY KEY (object_schema, object_name, object_kind, object_signature)
constraint keiro_managed_read_objects.keiro_managed_read_objects_retired_chk CHECK ((((state = 'retired'::text) AND (retired_at IS NOT NULL)) OR ((state <> 'retired'::text) AND (retired_at IS NULL))))
constraint keiro_managed_read_objects.keiro_managed_read_objects_state_chk CHECK ((state = ANY (ARRAY['active'::text, 'pending-retirement'::text, 'retired'::text])))
constraint keiro_managed_read_objects.keiro_managed_read_objects_state_not_null NOT NULL state
constraint keiro_managed_read_objects.keiro_managed_read_objects_surface_generation_not_null NOT NULL surface_generation
constraint keiro_managed_read_objects.keiro_managed_read_objects_updated_at_not_null NOT NULL updated_at
constraint keiro_outbox.keiro_outbox_attempt_count_not_null NOT NULL attempt_count
constraint keiro_outbox.keiro_outbox_content_type_not_null NOT NULL content_type
constraint keiro_outbox.keiro_outbox_created_at_not_null NOT NULL created_at
constraint keiro_outbox.keiro_outbox_destination_not_null NOT NULL destination
constraint keiro_outbox.keiro_outbox_event_type_not_null NOT NULL event_type
constraint keiro_outbox.keiro_outbox_message_id_not_null NOT NULL message_id
constraint keiro_outbox.keiro_outbox_next_attempt_at_not_null NOT NULL next_attempt_at
constraint keiro_outbox.keiro_outbox_occurred_at_not_null NOT NULL occurred_at
constraint keiro_outbox.keiro_outbox_outbox_id_not_null NOT NULL outbox_id
constraint keiro_outbox.keiro_outbox_payload_bytes_not_null NOT NULL payload_bytes
constraint keiro_outbox.keiro_outbox_pkey PRIMARY KEY (outbox_id)
constraint keiro_outbox.keiro_outbox_schema_version_not_null NOT NULL schema_version
constraint keiro_outbox.keiro_outbox_source_message_id_key UNIQUE (source, message_id)
constraint keiro_outbox.keiro_outbox_source_not_null NOT NULL source
constraint keiro_outbox.keiro_outbox_status_not_null NOT NULL status
constraint keiro_outbox.keiro_outbox_updated_at_not_null NOT NULL updated_at
constraint keiro_projection_dedup.keiro_projection_dedup_applied_at_not_null NOT NULL applied_at
constraint keiro_projection_dedup.keiro_projection_dedup_event_id_not_null NOT NULL event_id
constraint keiro_projection_dedup.keiro_projection_dedup_pkey PRIMARY KEY (projection_name, event_id)
constraint keiro_projection_dedup.keiro_projection_dedup_projection_name_not_null NOT NULL projection_name
constraint keiro_projection_group_cursors.keiro_projection_group_cursors_basis_chk CHECK ((position_basis = ANY (ARRAY['append'::text, 'checkpoint'::text, 'unmanaged'::text])))
constraint keiro_projection_group_cursors.keiro_projection_group_cursors_group_id_fkey FOREIGN KEY (group_id) REFERENCES keiro.keiro_projection_rebuild_groups(group_id) ON DELETE CASCADE
constraint keiro_projection_group_cursors.keiro_projection_group_cursors_group_id_not_null NOT NULL group_id
constraint keiro_projection_group_cursors.keiro_projection_group_cursors_pkey PRIMARY KEY (group_id)
constraint keiro_projection_group_cursors.keiro_projection_group_cursors_position_basis_not_null NOT NULL position_basis
constraint keiro_projection_group_cursors.keiro_projection_group_cursors_subscription_names_chk CHECK (((array_position(subscription_names, NULL::text) IS NULL) AND (((position_basis = 'checkpoint'::text) AND (cardinality(subscription_names) > 0)) OR ((position_basis = ANY (ARRAY['append'::text, 'unmanaged'::text])) AND (cardinality(subscription_names) = 0)))))
constraint keiro_projection_group_cursors.keiro_projection_group_cursors_subscription_names_not_null NOT NULL subscription_names
constraint keiro_projection_group_cursors.keiro_projection_group_cursors_updated_at_not_null NOT NULL updated_at
constraint keiro_projection_rebuild_adapters.keiro_projection_rebuild_adapters_adapter_order_not_null NOT NULL adapter_order
constraint keiro_projection_rebuild_adapters.keiro_projection_rebuild_adapters_apply_count_not_null NOT NULL apply_count
constraint keiro_projection_rebuild_adapters.keiro_projection_rebuild_adapters_completed_chk CHECK (((completed_through IS NULL) OR (completed_through >= 0)))
constraint keiro_projection_rebuild_adapters.keiro_projection_rebuild_adapters_counts_chk CHECK (((evaluation_count >= 0) AND (apply_count >= 0) AND (apply_count <= evaluation_count)))
constraint keiro_projection_rebuild_adapters.keiro_projection_rebuild_adapters_evaluation_count_not_null NOT NULL evaluation_count
constraint keiro_projection_rebuild_adapters.keiro_projection_rebuild_adapters_order_chk CHECK ((adapter_order >= 0))
constraint keiro_projection_rebuild_adapters.keiro_projection_rebuild_adapters_pkey PRIMARY KEY (run_id, source_id, projection_id)
constraint keiro_projection_rebuild_adapters.keiro_projection_rebuild_adapters_projection_id_not_null NOT NULL projection_id
constraint keiro_projection_rebuild_adapters.keiro_projection_rebuild_adapters_run_id_adapter_order_key UNIQUE (run_id, adapter_order)
constraint keiro_projection_rebuild_adapters.keiro_projection_rebuild_adapters_run_id_not_null NOT NULL run_id
constraint keiro_projection_rebuild_adapters.keiro_projection_rebuild_adapters_run_id_source_id_fkey FOREIGN KEY (run_id, source_id) REFERENCES keiro.keiro_projection_rebuild_sources(run_id, source_id) ON DELETE CASCADE
constraint keiro_projection_rebuild_adapters.keiro_projection_rebuild_adapters_source_id_not_null NOT NULL source_id
constraint keiro_projection_rebuild_adapters.keiro_projection_rebuild_adapters_updated_at_not_null NOT NULL updated_at
constraint keiro_projection_rebuild_dedup_stage.keiro_projection_rebuild_dedup_stage_event_id_not_null NOT NULL event_id
constraint keiro_projection_rebuild_dedup_stage.keiro_projection_rebuild_dedup_stage_global_position_not_null NOT NULL global_position
constraint keiro_projection_rebuild_dedup_stage.keiro_projection_rebuild_dedup_stage_names_chk CHECK (((length(subscription_name) > 0) AND (length(projection_name) > 0)))
constraint keiro_projection_rebuild_dedup_stage.keiro_projection_rebuild_dedup_stage_pkey PRIMARY KEY (run_id, projection_name, event_id)
constraint keiro_projection_rebuild_dedup_stage.keiro_projection_rebuild_dedup_stage_position_chk CHECK ((global_position > 0))
constraint keiro_projection_rebuild_dedup_stage.keiro_projection_rebuild_dedup_stage_projection_name_not_null NOT NULL projection_name
constraint keiro_projection_rebuild_dedup_stage.keiro_projection_rebuild_dedup_stage_run_id_fkey FOREIGN KEY (run_id) REFERENCES keiro.keiro_projection_rebuild_runs(run_id) ON DELETE CASCADE
constraint keiro_projection_rebuild_dedup_stage.keiro_projection_rebuild_dedup_stage_run_id_not_null NOT NULL run_id
constraint keiro_projection_rebuild_dedup_stage.keiro_projection_rebuild_dedup_stage_subscription_name_not_null NOT NULL subscription_name
constraint keiro_projection_rebuild_groups.keiro_projection_rebuild_groups_active_run_chk CHECK ((((status = ANY (ARRAY['live'::text, 'serving-versioned'::text])) AND (active_run_id IS NULL)) OR ((status = ANY (ARRAY['rebuilding'::text, 'failed'::text, 'rebuilding-versioned'::text, 'cutover-versioned'::text, 'failed-versioned'::text])) AND (active_run_id IS NOT NULL))))
constraint keiro_projection_rebuild_groups.keiro_projection_rebuild_groups_availability_chk CHECK ((((status = 'live'::text) AND reads_allowed AND writes_allowed) OR ((status = ANY (ARRAY['rebuilding'::text, 'failed'::text])) AND (NOT reads_allowed) AND (NOT writes_allowed)) OR ((status = ANY (ARRAY['serving-versioned'::text, 'rebuilding-versioned'::text])) AND reads_allowed AND writes_allowed) OR ((status = ANY (ARRAY['cutover-versioned'::text, 'failed-versioned'::text])) AND reads_allowed AND (NOT writes_allowed))))
constraint keiro_projection_rebuild_groups.keiro_projection_rebuild_groups_catalog_fingerprint_not_null NOT NULL slice_fingerprint
constraint keiro_projection_rebuild_groups.keiro_projection_rebuild_groups_created_at_not_null NOT NULL created_at
constraint keiro_projection_rebuild_groups.keiro_projection_rebuild_groups_group_id_not_null NOT NULL group_id
constraint keiro_projection_rebuild_groups.keiro_projection_rebuild_groups_pkey PRIMARY KEY (group_id)
constraint keiro_projection_rebuild_groups.keiro_projection_rebuild_groups_reads_allowed_not_null NOT NULL reads_allowed
constraint keiro_projection_rebuild_groups.keiro_projection_rebuild_groups_revision_phase_chk CHECK ((((status = ANY (ARRAY['live'::text, 'rebuilding'::text, 'failed'::text])) AND (serving_revision_id IS NULL) AND (serving_epoch = 0)) OR ((status = ANY (ARRAY['serving-versioned'::text, 'rebuilding-versioned'::text, 'cutover-versioned'::text, 'failed-versioned'::text])) AND (serving_revision_id IS NOT NULL) AND (serving_epoch >= 0))))
constraint keiro_projection_rebuild_groups.keiro_projection_rebuild_groups_serving_epoch_not_null NOT NULL serving_epoch
constraint keiro_projection_rebuild_groups.keiro_projection_rebuild_groups_serving_revision_fk FOREIGN KEY (group_id, serving_revision_id) REFERENCES keiro.keiro_projection_revisions(group_id, revision_id)
constraint keiro_projection_rebuild_groups.keiro_projection_rebuild_groups_status_chk CHECK ((status = ANY (ARRAY['live'::text, 'rebuilding'::text, 'failed'::text, 'serving-versioned'::text, 'rebuilding-versioned'::text, 'cutover-versioned'::text, 'failed-versioned'::text])))
constraint keiro_projection_rebuild_groups.keiro_projection_rebuild_groups_status_not_null NOT NULL status
constraint keiro_projection_rebuild_groups.keiro_projection_rebuild_groups_updated_at_not_null NOT NULL updated_at
constraint keiro_projection_rebuild_groups.keiro_projection_rebuild_groups_writes_allowed_not_null NOT NULL writes_allowed
constraint keiro_projection_rebuild_promotion_objects.keiro_projection_rebuild_prom_run_id_target_id_canonical_na_key UNIQUE (run_id, target_id, canonical_name)
constraint keiro_projection_rebuild_promotion_objects.keiro_projection_rebuild_prom_run_id_target_id_generation_n_key UNIQUE (run_id, target_id, generation_name)
constraint keiro_projection_rebuild_promotion_objects.keiro_projection_rebuild_promotion_obj_generation_name_not_null NOT NULL generation_name
constraint keiro_projection_rebuild_promotion_objects.keiro_projection_rebuild_promotion_obje_canonical_name_not_null NOT NULL canonical_name
constraint keiro_projection_rebuild_promotion_objects.keiro_projection_rebuild_promotion_object_object_order_not_null NOT NULL object_order
constraint keiro_projection_rebuild_promotion_objects.keiro_projection_rebuild_promotion_object_run_id_target_id_fkey FOREIGN KEY (run_id, target_id) REFERENCES keiro.keiro_projection_rebuild_run_targets(run_id, target_id) ON DELETE CASCADE
constraint keiro_projection_rebuild_promotion_objects.keiro_projection_rebuild_promotion_objects_kind_chk CHECK ((object_kind = ANY (ARRAY['index'::text, 'constraint'::text, 'owned-sequence'::text])))
constraint keiro_projection_rebuild_promotion_objects.keiro_projection_rebuild_promotion_objects_names_chk CHECK (((length(generation_name) > 0) AND (length(canonical_name) > 0)))
constraint keiro_projection_rebuild_promotion_objects.keiro_projection_rebuild_promotion_objects_object_kind_not_null NOT NULL object_kind
constraint keiro_projection_rebuild_promotion_objects.keiro_projection_rebuild_promotion_objects_order_chk CHECK ((object_order >= 0))
constraint keiro_projection_rebuild_promotion_objects.keiro_projection_rebuild_promotion_objects_pkey PRIMARY KEY (run_id, target_id, object_order)
constraint keiro_projection_rebuild_promotion_objects.keiro_projection_rebuild_promotion_objects_run_id_not_null NOT NULL run_id
constraint keiro_projection_rebuild_promotion_objects.keiro_projection_rebuild_promotion_objects_target_id_not_null NOT NULL target_id
constraint keiro_projection_rebuild_run_targets.keiro_projection_rebuild_run__candidate_generation_id_run__fkey FOREIGN KEY (candidate_generation_id, run_id, target_id) REFERENCES keiro.keiro_projection_target_generations(generation_id, created_by_run_id, target_id)
constraint keiro_projection_rebuild_run_targets.keiro_projection_rebuild_run_t_candidate_generation_id_not_null NOT NULL candidate_generation_id
constraint keiro_projection_rebuild_run_targets.keiro_projection_rebuild_run_target_candidate_generation_id_key UNIQUE (candidate_generation_id)
constraint keiro_projection_rebuild_run_targets.keiro_projection_rebuild_run_targets_mode_chk CHECK ((target_mode = ANY (ARRAY['application'::text, 'clone'::text])))
constraint keiro_projection_rebuild_run_targets.keiro_projection_rebuild_run_targets_pkey PRIMARY KEY (run_id, target_id)
constraint keiro_projection_rebuild_run_targets.keiro_projection_rebuild_run_targets_run_id_fkey FOREIGN KEY (run_id) REFERENCES keiro.keiro_projection_rebuild_runs(run_id) ON DELETE CASCADE
constraint keiro_projection_rebuild_run_targets.keiro_projection_rebuild_run_targets_run_id_not_null NOT NULL run_id
constraint keiro_projection_rebuild_run_targets.keiro_projection_rebuild_run_targets_target_id_not_null NOT NULL target_id
constraint keiro_projection_rebuild_run_targets.keiro_projection_rebuild_run_targets_target_mode_not_null NOT NULL target_mode
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_abandoned_chk CHECK ((((status = 'abandoned'::text) AND (abandoned_at IS NOT NULL)) OR ((status <> 'abandoned'::text) AND (abandoned_at IS NULL))))
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_candidate_revision_fk FOREIGN KEY (group_id, candidate_revision_id) REFERENCES keiro.keiro_projection_revisions(group_id, revision_id)
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_captured_head_not_null NOT NULL captured_head
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_catalog_fingerprint_not_null NOT NULL catalog_fingerprint
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_contract_fingerprint_not_null NOT NULL contract_fingerprint
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_failure_chk CHECK ((((status = 'failed'::text) AND (failure_code IS NOT NULL) AND (failed_at IS NOT NULL)) OR ((status <> 'failed'::text) AND (failure_code IS NULL) AND (failed_at IS NULL))))
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_group_id_fkey FOREIGN KEY (group_id) REFERENCES keiro.keiro_projection_rebuild_groups(group_id)
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_group_id_not_null NOT NULL group_id
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_group_slice_fingerprint_not_null NOT NULL group_slice_fingerprint
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_head_chk CHECK ((captured_head >= 0))
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_mode_chk CHECK ((((rebuild_mode = 'offline'::text) AND (candidate_revision_id IS NULL) AND (cutover_threshold IS NULL) AND (cutover_lock_timeout_ms IS NULL) AND (promotion_dedup_limit IS NULL) AND (dedup_provisional_head IS NULL) AND (promotion_prepared_at IS NULL) AND (history_retention_lease_id IS NULL) AND (history_retention_lease_owner IS NULL) AND (history_retention_protected_through IS NULL) AND (history_retention_expires_at IS NULL) AND (history_retention_renewed_at IS NULL) AND (history_retention_released_at IS NULL)) OR ((rebuild_mode = 'versioned'::text) AND (candidate_revision_id IS NOT NULL) AND (cutover_threshold IS NOT NULL) AND (cutover_threshold >= 0) AND (cutover_lock_timeout_ms IS NOT NULL) AND (cutover_lock_timeout_ms > 0) AND (promotion_dedup_limit IS NOT NULL) AND (promotion_dedup_limit > 0) AND ((dedup_provisional_head IS NULL) OR (dedup_provisional_head >= 0)) AND (history_retention_lease_id IS NOT NULL) AND (history_retention_lease_owner IS NOT NULL) AND (length(history_retention_lease_owner) > 0) AND (history_retention_protected_through IS NOT NULL) AND (history_retention_protected_through >= 0) AND (history_retention_expires_at IS NOT NULL) AND (history_retention_renewed_at IS NOT NULL))))
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_page_size_chk CHECK ((page_size > 0))
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_page_size_not_null NOT NULL page_size
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_pkey PRIMARY KEY (run_id)
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_rebuild_mode_not_null NOT NULL rebuild_mode
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_run_id_not_null NOT NULL run_id
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_runner_format_not_null NOT NULL runner_format
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_started_at_not_null NOT NULL started_at
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_status_chk CHECK ((status = ANY (ARRAY['running'::text, 'failed'::text, 'verified'::text, 'cutover'::text, 'promoted'::text, 'abandoned'::text])))
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_status_not_null NOT NULL status
constraint keiro_projection_rebuild_runs.keiro_projection_rebuild_runs_updated_at_not_null NOT NULL updated_at
constraint keiro_projection_rebuild_sources.keiro_projection_rebuild_sources_count_chk CHECK ((event_count >= 0))
constraint keiro_projection_rebuild_sources.keiro_projection_rebuild_sources_cursor_chk CHECK (((cursor_position >= 0) AND (cursor_position <= target_position)))
constraint keiro_projection_rebuild_sources.keiro_projection_rebuild_sources_cursor_position_not_null NOT NULL cursor_position
constraint keiro_projection_rebuild_sources.keiro_projection_rebuild_sources_event_count_not_null NOT NULL event_count
constraint keiro_projection_rebuild_sources.keiro_projection_rebuild_sources_exhausted_chk CHECK (((exhausted_through IS NULL) OR (exhausted_through = target_position)))
constraint keiro_projection_rebuild_sources.keiro_projection_rebuild_sources_pkey PRIMARY KEY (run_id, source_id)
constraint keiro_projection_rebuild_sources.keiro_projection_rebuild_sources_run_id_fkey FOREIGN KEY (run_id) REFERENCES keiro.keiro_projection_rebuild_runs(run_id) ON DELETE CASCADE
constraint keiro_projection_rebuild_sources.keiro_projection_rebuild_sources_run_id_not_null NOT NULL run_id
constraint keiro_projection_rebuild_sources.keiro_projection_rebuild_sources_scope_chk CHECK ((((source_scope = 'all'::text) AND (category IS NULL)) OR ((source_scope = 'category'::text) AND (category IS NOT NULL))))
constraint keiro_projection_rebuild_sources.keiro_projection_rebuild_sources_source_id_not_null NOT NULL source_id
constraint keiro_projection_rebuild_sources.keiro_projection_rebuild_sources_source_scope_not_null NOT NULL source_scope
constraint keiro_projection_rebuild_sources.keiro_projection_rebuild_sources_target_chk CHECK ((target_position >= 0))
constraint keiro_projection_rebuild_sources.keiro_projection_rebuild_sources_target_position_not_null NOT NULL target_position
constraint keiro_projection_rebuild_sources.keiro_projection_rebuild_sources_updated_at_not_null NOT NULL updated_at
constraint keiro_projection_rebuild_verifications.keiro_projection_rebuild_verifica_verification_version_not_null NOT NULL verification_version
constraint keiro_projection_rebuild_verifications.keiro_projection_rebuild_verifications_completion_chk CHECK ((((status = 'pending'::text) AND (completed_at IS NULL)) OR ((status = ANY (ARRAY['passed'::text, 'failed'::text])) AND (completed_at IS NOT NULL))))
constraint keiro_projection_rebuild_verifications.keiro_projection_rebuild_verifications_pkey PRIMARY KEY (run_id, verification_id)
constraint keiro_projection_rebuild_verifications.keiro_projection_rebuild_verifications_run_id_fkey FOREIGN KEY (run_id) REFERENCES keiro.keiro_projection_rebuild_runs(run_id) ON DELETE CASCADE
constraint keiro_projection_rebuild_verifications.keiro_projection_rebuild_verifications_run_id_not_null NOT NULL run_id
constraint keiro_projection_rebuild_verifications.keiro_projection_rebuild_verifications_status_chk CHECK ((status = ANY (ARRAY['pending'::text, 'passed'::text, 'failed'::text])))
constraint keiro_projection_rebuild_verifications.keiro_projection_rebuild_verifications_status_not_null NOT NULL status
constraint keiro_projection_rebuild_verifications.keiro_projection_rebuild_verifications_verification_id_not_null NOT NULL verification_id
constraint keiro_projection_revisions.keiro_projection_revisions_group_id_fkey FOREIGN KEY (group_id) REFERENCES keiro.keiro_projection_rebuild_groups(group_id)
constraint keiro_projection_revisions.keiro_projection_revisions_group_id_not_null NOT NULL group_id
constraint keiro_projection_revisions.keiro_projection_revisions_group_slice_fingerprint_not_null NOT NULL group_slice_fingerprint
constraint keiro_projection_revisions.keiro_projection_revisions_identity_chk CHECK (((length(group_id) > 0) AND (length(revision_id) > 0) AND (length(group_slice_fingerprint) > 0)))
constraint keiro_projection_revisions.keiro_projection_revisions_pkey PRIMARY KEY (group_id, revision_id)
constraint keiro_projection_revisions.keiro_projection_revisions_registered_at_not_null NOT NULL registered_at
constraint keiro_projection_revisions.keiro_projection_revisions_revision_id_key UNIQUE (revision_id)
constraint keiro_projection_revisions.keiro_projection_revisions_revision_id_not_null NOT NULL revision_id
constraint keiro_projection_revisions.keiro_projection_revisions_updated_at_not_null NOT NULL updated_at
constraint keiro_projection_target_generations.keiro_projection_target_gen_observed_shape_fingerprint_not_null NOT NULL observed_shape_fingerprint
constraint keiro_projection_target_generations.keiro_projection_target_gene_observed_catalog_snapshot_not_null NOT NULL observed_catalog_snapshot
constraint keiro_projection_target_generations.keiro_projection_target_gener_generation_id_created_by_run__key UNIQUE (generation_id, created_by_run_id, target_id)
constraint keiro_projection_target_generations.keiro_projection_target_generations_created_at_not_null NOT NULL created_at
constraint keiro_projection_target_generations.keiro_projection_target_generations_created_by_run_id_fkey FOREIGN KEY (created_by_run_id) REFERENCES keiro.keiro_projection_rebuild_runs(run_id)
constraint keiro_projection_target_generations.keiro_projection_target_generations_expected_shape_id_not_null NOT NULL expected_shape_id
constraint keiro_projection_target_generations.keiro_projection_target_generations_generation_id_not_null NOT NULL generation_id
constraint keiro_projection_target_generations.keiro_projection_target_generations_group_id_not_null NOT NULL group_id
constraint keiro_projection_target_generations.keiro_projection_target_generations_group_id_revision_id_fkey FOREIGN KEY (group_id, revision_id) REFERENCES keiro.keiro_projection_revisions(group_id, revision_id)
constraint keiro_projection_target_generations.keiro_projection_target_generations_identity_chk CHECK (((length(target_id) > 0) AND (length(schema_name) > 0) AND (length(relation_name) > 0) AND (relation_oid > 0) AND (length(schema_version) > 0) AND (length(expected_shape_id) > 0) AND (length(observed_shape_fingerprint) > 0)))
constraint keiro_projection_target_generations.keiro_projection_target_generations_lifecycle_chk CHECK ((lifecycle = ANY (ARRAY['staging'::text, 'serving'::text, 'retired'::text, 'dropped'::text])))
constraint keiro_projection_target_generations.keiro_projection_target_generations_lifecycle_not_null NOT NULL lifecycle
constraint keiro_projection_target_generations.keiro_projection_target_generations_pkey PRIMARY KEY (generation_id)
constraint keiro_projection_target_generations.keiro_projection_target_generations_relation_name_not_null NOT NULL relation_name
constraint keiro_projection_target_generations.keiro_projection_target_generations_relation_oid_not_null NOT NULL relation_oid
constraint keiro_projection_target_generations.keiro_projection_target_generations_revision_id_not_null NOT NULL revision_id
constraint keiro_projection_target_generations.keiro_projection_target_generations_schema_name_not_null NOT NULL schema_name
constraint keiro_projection_target_generations.keiro_projection_target_generations_schema_version_not_null NOT NULL schema_version
constraint keiro_projection_target_generations.keiro_projection_target_generations_target_id_not_null NOT NULL target_id
constraint keiro_projection_target_generations.keiro_projection_target_generations_transition_evidence_chk CHECK ((((lifecycle = 'staging'::text) AND (created_by_run_id IS NOT NULL) AND (served_at IS NULL) AND (retired_at IS NULL) AND (dropped_at IS NULL)) OR ((lifecycle = 'serving'::text) AND (served_at IS NOT NULL) AND (retired_at IS NULL) AND (dropped_at IS NULL)) OR ((lifecycle = 'retired'::text) AND (served_at IS NOT NULL) AND (retired_at IS NOT NULL) AND (dropped_at IS NULL)) OR ((lifecycle = 'dropped'::text) AND (dropped_at IS NOT NULL) AND (((served_at IS NULL) AND (retired_at IS NULL)) OR ((served_at IS NOT NULL) AND (retired_at IS NOT NULL))))))
constraint keiro_read_models.keiro_read_models_name_not_null NOT NULL name
constraint keiro_read_models.keiro_read_models_pkey PRIMARY KEY (name)
constraint keiro_read_models.keiro_read_models_rebuild_group_fk FOREIGN KEY (rebuild_group_id) REFERENCES keiro.keiro_projection_rebuild_groups(group_id)
constraint keiro_read_models.keiro_read_models_rebuild_group_id_not_null NOT NULL rebuild_group_id
constraint keiro_read_models.keiro_read_models_shape_hash_not_null NOT NULL shape_hash
constraint keiro_read_models.keiro_read_models_status_not_null NOT NULL status
constraint keiro_read_models.keiro_read_models_updated_at_not_null NOT NULL updated_at
constraint keiro_read_models.keiro_read_models_version_not_null NOT NULL version
constraint keiro_snapshots.keiro_snapshots_created_at_not_null NOT NULL created_at
constraint keiro_snapshots.keiro_snapshots_pkey PRIMARY KEY (stream_id)
constraint keiro_snapshots.keiro_snapshots_regfile_shape_hash_not_null NOT NULL regfile_shape_hash
constraint keiro_snapshots.keiro_snapshots_state_codec_version_not_null NOT NULL state_codec_version
constraint keiro_snapshots.keiro_snapshots_state_not_null NOT NULL state
constraint keiro_snapshots.keiro_snapshots_state_shape_hash_not_null NOT NULL state_shape_hash
constraint keiro_snapshots.keiro_snapshots_stream_id_not_null NOT NULL stream_id
constraint keiro_snapshots.keiro_snapshots_stream_version_not_null NOT NULL stream_version
constraint keiro_snapshots.keiro_snapshots_updated_at_not_null NOT NULL updated_at
constraint keiro_subscription_shards.keiro_subscription_shards_bucket_not_null NOT NULL bucket
constraint keiro_subscription_shards.keiro_subscription_shards_bucket_range_chk CHECK (((bucket >= 0) AND (bucket < shard_count)))
constraint keiro_subscription_shards.keiro_subscription_shards_count_chk CHECK ((shard_count >= 1))
constraint keiro_subscription_shards.keiro_subscription_shards_pkey PRIMARY KEY (subscription_name, bucket)
constraint keiro_subscription_shards.keiro_subscription_shards_shard_count_not_null NOT NULL shard_count
constraint keiro_subscription_shards.keiro_subscription_shards_subscription_name_not_null NOT NULL subscription_name
constraint keiro_subscription_shards.keiro_subscription_shards_updated_at_not_null NOT NULL updated_at
constraint keiro_timers.keiro_timers_attempts_not_null NOT NULL attempts
constraint keiro_timers.keiro_timers_correlation_id_not_null NOT NULL correlation_id
constraint keiro_timers.keiro_timers_created_at_not_null NOT NULL created_at
constraint keiro_timers.keiro_timers_fire_at_not_null NOT NULL fire_at
constraint keiro_timers.keiro_timers_payload_not_null NOT NULL payload
constraint keiro_timers.keiro_timers_pkey PRIMARY KEY (timer_id)
constraint keiro_timers.keiro_timers_process_manager_name_not_null NOT NULL process_manager_name
constraint keiro_timers.keiro_timers_status_not_null NOT NULL status
constraint keiro_timers.keiro_timers_timer_id_not_null NOT NULL timer_id
constraint keiro_timers.keiro_timers_updated_at_not_null NOT NULL updated_at
constraint keiro_workflow_children.keiro_workflow_children_await_step_not_null NOT NULL await_step
constraint keiro_workflow_children.keiro_workflow_children_child_id_not_null NOT NULL child_id
constraint keiro_workflow_children.keiro_workflow_children_child_name_not_null NOT NULL child_name
constraint keiro_workflow_children.keiro_workflow_children_created_at_not_null NOT NULL created_at
constraint keiro_workflow_children.keiro_workflow_children_parent_id_not_null NOT NULL parent_id
constraint keiro_workflow_children.keiro_workflow_children_parent_name_not_null NOT NULL parent_name
constraint keiro_workflow_children.keiro_workflow_children_pkey PRIMARY KEY (child_id, child_name)
constraint keiro_workflow_children.keiro_workflow_children_status_chk CHECK ((status = ANY (ARRAY['running'::text, 'completed'::text, 'cancelled'::text, 'failed'::text])))
constraint keiro_workflow_children.keiro_workflow_children_status_not_null NOT NULL status
constraint keiro_workflow_children.keiro_workflow_children_updated_at_not_null NOT NULL updated_at
constraint keiro_workflow_steps.keiro_workflow_steps_generation_not_null NOT NULL generation
constraint keiro_workflow_steps.keiro_workflow_steps_pkey PRIMARY KEY (workflow_id, workflow_name, generation, step_name)
constraint keiro_workflow_steps.keiro_workflow_steps_recorded_at_not_null NOT NULL recorded_at
constraint keiro_workflow_steps.keiro_workflow_steps_result_not_null NOT NULL result
constraint keiro_workflow_steps.keiro_workflow_steps_step_name_not_null NOT NULL step_name
constraint keiro_workflow_steps.keiro_workflow_steps_workflow_id_not_null NOT NULL workflow_id
constraint keiro_workflow_steps.keiro_workflow_steps_workflow_name_not_null NOT NULL workflow_name
constraint keiro_workflows.keiro_workflows_attempts_not_null NOT NULL attempts
constraint keiro_workflows.keiro_workflows_created_at_not_null NOT NULL created_at
constraint keiro_workflows.keiro_workflows_generation_not_null NOT NULL generation
constraint keiro_workflows.keiro_workflows_pkey PRIMARY KEY (workflow_id, workflow_name)
constraint keiro_workflows.keiro_workflows_status_chk CHECK ((status = ANY (ARRAY['running'::text, 'suspended'::text, 'completed'::text, 'cancelled'::text, 'failed'::text])))
constraint keiro_workflows.keiro_workflows_status_not_null NOT NULL status
constraint keiro_workflows.keiro_workflows_updated_at_not_null NOT NULL updated_at
constraint keiro_workflows.keiro_workflows_workflow_id_not_null NOT NULL workflow_id
constraint keiro_workflows.keiro_workflows_workflow_name_not_null NOT NULL workflow_name
index keiro_awakeables_owner_idx CREATE INDEX keiro_awakeables_owner_idx ON keiro.keiro_awakeables USING btree (owner_workflow_name, owner_workflow_id)
index keiro_awakeables_pending_idx CREATE INDEX keiro_awakeables_pending_idx ON keiro.keiro_awakeables USING btree (status) WHERE (status = 'pending'::text)
index keiro_awakeables_pkey CREATE UNIQUE INDEX keiro_awakeables_pkey ON keiro.keiro_awakeables USING btree (awakeable_id)
index keiro_dead_letters_dispatcher_created_at_idx CREATE INDEX keiro_dead_letters_dispatcher_created_at_idx ON keiro.keiro_dead_letters USING btree (dispatcher_name, created_at DESC)
index keiro_dead_letters_dispatcher_name_source_event_id_emit_ind_key CREATE UNIQUE INDEX keiro_dead_letters_dispatcher_name_source_event_id_emit_ind_key ON keiro.keiro_dead_letters USING btree (dispatcher_name, source_event_id, emit_index)
index keiro_dead_letters_pkey CREATE UNIQUE INDEX keiro_dead_letters_pkey ON keiro.keiro_dead_letters USING btree (dead_letter_id)
index keiro_external_read_contracts_group_idx CREATE INDEX keiro_external_read_contracts_group_idx ON keiro.keiro_external_read_contracts USING btree (group_id, state)
index keiro_external_read_contracts_pkey CREATE UNIQUE INDEX keiro_external_read_contracts_pkey ON keiro.keiro_external_read_contracts USING btree (contract_id, contract_version)
index keiro_external_read_contracts_public_function_name_argument_key CREATE UNIQUE INDEX keiro_external_read_contracts_public_function_name_argument_key ON keiro.keiro_external_read_contracts USING btree (public_function_name, argument_types)
index keiro_inbox_backlog_idx CREATE INDEX keiro_inbox_backlog_idx ON keiro.keiro_inbox USING btree (status) WHERE (status = ANY (ARRAY['processing'::text, 'failed'::text]))
index keiro_inbox_completed_idx CREATE INDEX keiro_inbox_completed_idx ON keiro.keiro_inbox USING btree (completed_at) WHERE (status = 'completed'::text)
index keiro_inbox_pkey CREATE UNIQUE INDEX keiro_inbox_pkey ON keiro.keiro_inbox USING btree (source, dedupe_key)
index keiro_managed_read_objects_contract_idx CREATE INDEX keiro_managed_read_objects_contract_idx ON keiro.keiro_managed_read_objects USING btree (contract_id, contract_version)
index keiro_managed_read_objects_pkey CREATE UNIQUE INDEX keiro_managed_read_objects_pkey ON keiro.keiro_managed_read_objects USING btree (object_schema, object_name, object_kind, object_signature)
index keiro_outbox_claim_order_idx CREATE INDEX keiro_outbox_claim_order_idx ON keiro.keiro_outbox USING btree (created_at, outbox_id) WHERE (status = ANY (ARRAY['pending'::text, 'failed'::text]))
index keiro_outbox_head_of_line_idx CREATE INDEX keiro_outbox_head_of_line_idx ON keiro.keiro_outbox USING btree (source, message_key, created_at) WHERE ((status <> ALL (ARRAY['sent'::text, 'dead'::text])) AND (message_key IS NOT NULL))
index keiro_outbox_pending_idx CREATE INDEX keiro_outbox_pending_idx ON keiro.keiro_outbox USING btree (status, next_attempt_at, created_at)
index keiro_outbox_pkey CREATE UNIQUE INDEX keiro_outbox_pkey ON keiro.keiro_outbox USING btree (outbox_id)
index keiro_outbox_sent_gc_idx CREATE INDEX keiro_outbox_sent_gc_idx ON keiro.keiro_outbox USING btree (published_at) WHERE (status = 'sent'::text)
index keiro_outbox_source_message_id_key CREATE UNIQUE INDEX keiro_outbox_source_message_id_key ON keiro.keiro_outbox USING btree (source, message_id)
index keiro_outbox_source_order_idx CREATE INDEX keiro_outbox_source_order_idx ON keiro.keiro_outbox USING btree (source, created_at, outbox_id) WHERE (status <> ALL (ARRAY['sent'::text, 'dead'::text]))
index keiro_projection_dedup_applied_at_idx CREATE INDEX keiro_projection_dedup_applied_at_idx ON keiro.keiro_projection_dedup USING btree (applied_at)
index keiro_projection_dedup_pkey CREATE UNIQUE INDEX keiro_projection_dedup_pkey ON keiro.keiro_projection_dedup USING btree (projection_name, event_id)
index keiro_projection_group_cursors_pkey CREATE UNIQUE INDEX keiro_projection_group_cursors_pkey ON keiro.keiro_projection_group_cursors USING btree (group_id)
index keiro_projection_rebuild_adapters_pkey CREATE UNIQUE INDEX keiro_projection_rebuild_adapters_pkey ON keiro.keiro_projection_rebuild_adapters USING btree (run_id, source_id, projection_id)
index keiro_projection_rebuild_adapters_run_id_adapter_order_key CREATE UNIQUE INDEX keiro_projection_rebuild_adapters_run_id_adapter_order_key ON keiro.keiro_projection_rebuild_adapters USING btree (run_id, adapter_order)
index keiro_projection_rebuild_dedup_stage_pkey CREATE UNIQUE INDEX keiro_projection_rebuild_dedup_stage_pkey ON keiro.keiro_projection_rebuild_dedup_stage USING btree (run_id, projection_name, event_id)
index keiro_projection_rebuild_dedup_stage_run_position_idx CREATE INDEX keiro_projection_rebuild_dedup_stage_run_position_idx ON keiro.keiro_projection_rebuild_dedup_stage USING btree (run_id, subscription_name, global_position)
index keiro_projection_rebuild_groups_pkey CREATE UNIQUE INDEX keiro_projection_rebuild_groups_pkey ON keiro.keiro_projection_rebuild_groups USING btree (group_id)
index keiro_projection_rebuild_prom_run_id_target_id_canonical_na_key CREATE UNIQUE INDEX keiro_projection_rebuild_prom_run_id_target_id_canonical_na_key ON keiro.keiro_projection_rebuild_promotion_objects USING btree (run_id, target_id, canonical_name)
index keiro_projection_rebuild_prom_run_id_target_id_generation_n_key CREATE UNIQUE INDEX keiro_projection_rebuild_prom_run_id_target_id_generation_n_key ON keiro.keiro_projection_rebuild_promotion_objects USING btree (run_id, target_id, generation_name)
index keiro_projection_rebuild_promotion_objects_pkey CREATE UNIQUE INDEX keiro_projection_rebuild_promotion_objects_pkey ON keiro.keiro_projection_rebuild_promotion_objects USING btree (run_id, target_id, object_order)
index keiro_projection_rebuild_run_target_candidate_generation_id_key CREATE UNIQUE INDEX keiro_projection_rebuild_run_target_candidate_generation_id_key ON keiro.keiro_projection_rebuild_run_targets USING btree (candidate_generation_id)
index keiro_projection_rebuild_run_targets_pkey CREATE UNIQUE INDEX keiro_projection_rebuild_run_targets_pkey ON keiro.keiro_projection_rebuild_run_targets USING btree (run_id, target_id)
index keiro_projection_rebuild_runs_group_idx CREATE INDEX keiro_projection_rebuild_runs_group_idx ON keiro.keiro_projection_rebuild_runs USING btree (group_id, started_at DESC)
index keiro_projection_rebuild_runs_pkey CREATE UNIQUE INDEX keiro_projection_rebuild_runs_pkey ON keiro.keiro_projection_rebuild_runs USING btree (run_id)
index keiro_projection_rebuild_sources_pkey CREATE UNIQUE INDEX keiro_projection_rebuild_sources_pkey ON keiro.keiro_projection_rebuild_sources USING btree (run_id, source_id)
index keiro_projection_rebuild_verifications_pkey CREATE UNIQUE INDEX keiro_projection_rebuild_verifications_pkey ON keiro.keiro_projection_rebuild_verifications USING btree (run_id, verification_id)
index keiro_projection_revisions_pkey CREATE UNIQUE INDEX keiro_projection_revisions_pkey ON keiro.keiro_projection_revisions USING btree (group_id, revision_id)
index keiro_projection_revisions_revision_id_key CREATE UNIQUE INDEX keiro_projection_revisions_revision_id_key ON keiro.keiro_projection_revisions USING btree (revision_id)
index keiro_projection_target_gener_generation_id_created_by_run__key CREATE UNIQUE INDEX keiro_projection_target_gener_generation_id_created_by_run__key ON keiro.keiro_projection_target_generations USING btree (generation_id, created_by_run_id, target_id)
index keiro_projection_target_generations_pkey CREATE UNIQUE INDEX keiro_projection_target_generations_pkey ON keiro.keiro_projection_target_generations USING btree (generation_id)
index keiro_projection_target_generations_relation_idx CREATE UNIQUE INDEX keiro_projection_target_generations_relation_idx ON keiro.keiro_projection_target_generations USING btree (schema_name, relation_name) WHERE (lifecycle <> 'dropped'::text)
index keiro_projection_target_generations_serving_idx CREATE UNIQUE INDEX keiro_projection_target_generations_serving_idx ON keiro.keiro_projection_target_generations USING btree (group_id, target_id) WHERE (lifecycle = 'serving'::text)
index keiro_read_models_pkey CREATE UNIQUE INDEX keiro_read_models_pkey ON keiro.keiro_read_models USING btree (name)
index keiro_read_models_rebuild_group_idx CREATE INDEX keiro_read_models_rebuild_group_idx ON keiro.keiro_read_models USING btree (rebuild_group_id)
index keiro_snapshots_compat_idx CREATE INDEX keiro_snapshots_compat_idx ON keiro.keiro_snapshots USING btree (stream_id, state_codec_version, regfile_shape_hash, stream_version DESC)
index keiro_snapshots_pkey CREATE UNIQUE INDEX keiro_snapshots_pkey ON keiro.keiro_snapshots USING btree (stream_id)
index keiro_subscription_shards_lease_idx CREATE INDEX keiro_subscription_shards_lease_idx ON keiro.keiro_subscription_shards USING btree (subscription_name, lease_expires_at)
index keiro_subscription_shards_owner_idx CREATE INDEX keiro_subscription_shards_owner_idx ON keiro.keiro_subscription_shards USING btree (subscription_name, owner_worker_id)
index keiro_subscription_shards_pkey CREATE UNIQUE INDEX keiro_subscription_shards_pkey ON keiro.keiro_subscription_shards USING btree (subscription_name, bucket)
index keiro_timers_due_idx CREATE INDEX keiro_timers_due_idx ON keiro.keiro_timers USING btree (status, fire_at, process_manager_name) WHERE (status = ANY (ARRAY['scheduled'::text, 'firing'::text]))
index keiro_timers_pkey CREATE UNIQUE INDEX keiro_timers_pkey ON keiro.keiro_timers USING btree (timer_id)
index keiro_workflow_children_parent_idx CREATE INDEX keiro_workflow_children_parent_idx ON keiro.keiro_workflow_children USING btree (parent_id, parent_name)
index keiro_workflow_children_pkey CREATE UNIQUE INDEX keiro_workflow_children_pkey ON keiro.keiro_workflow_children USING btree (child_id, child_name)
index keiro_workflow_children_running_idx CREATE INDEX keiro_workflow_children_running_idx ON keiro.keiro_workflow_children USING btree (status) WHERE (status = 'running'::text)
index keiro_workflow_steps_pkey CREATE UNIQUE INDEX keiro_workflow_steps_pkey ON keiro.keiro_workflow_steps USING btree (workflow_id, workflow_name, generation, step_name)
index keiro_workflow_steps_workflow_idx CREATE INDEX keiro_workflow_steps_workflow_idx ON keiro.keiro_workflow_steps USING btree (workflow_id, workflow_name, generation)
index keiro_workflows_active_idx CREATE INDEX keiro_workflows_active_idx ON keiro.keiro_workflows USING btree (status, wake_after) WHERE (status = ANY (ARRAY['running'::text, 'suspended'::text]))
index keiro_workflows_gc_idx CREATE INDEX keiro_workflows_gc_idx ON keiro.keiro_workflows USING btree (status, completed_at)
index keiro_workflows_pkey CREATE UNIQUE INDEX keiro_workflows_pkey ON keiro.keiro_workflows USING btree (workflow_id, workflow_name)
table keiro_awakeables kind=r
table keiro_dead_letters kind=r
table keiro_external_read_contracts kind=r
table keiro_inbox kind=r
table keiro_managed_read_objects kind=r
table keiro_outbox kind=r
table keiro_projection_dedup kind=r
table keiro_projection_group_cursors kind=r
table keiro_projection_rebuild_adapters kind=r
table keiro_projection_rebuild_dedup_stage kind=r
table keiro_projection_rebuild_groups kind=r
table keiro_projection_rebuild_promotion_objects kind=r
table keiro_projection_rebuild_run_targets kind=r
table keiro_projection_rebuild_runs kind=r
table keiro_projection_rebuild_sources kind=r
table keiro_projection_rebuild_verifications kind=r
table keiro_projection_revisions kind=r
table keiro_projection_target_generations kind=r
table keiro_read_models kind=r
table keiro_snapshots kind=r
table keiro_subscription_shards kind=r
table keiro_timers kind=r
table keiro_workflow_children kind=r
table keiro_workflow_steps kind=r
table keiro_workflows kind=r
view keiro_read.projection_group_status_v1 columns=1:group_id text,2:lifecycle_phase text,3:reads_allowed boolean,4:writes_allowed boolean,5:serving_revision_id text,6:serving_epoch bigint,7:serving_position_basis text,8:serving_applied_position bigint,9:active_run_id text,10:candidate_revision_id text,11:candidate_rebuild_position bigint,12:candidate_rebuild_head bigint,13:query_models text[],14:rebuild_started_at timestamp with time zone,15:last_promoted_at timestamp with time zone,16:failed_at timestamp with time zone,17:failure_code text,18:failure_detail text