migrate

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// WithGlobalUniqueID sets the universal ids options to the migration.
	// If this option is enabled, ent migration will allocate a 1<<32 range
	// for the ids of each entity (table).
	// Note that this option cannot be applied on tables that already exist.
	WithGlobalUniqueID = schema.WithGlobalUniqueID
	// WithDropColumn sets the drop column option to the migration.
	// If this option is enabled, ent migration will drop old columns
	// that were used for both fields and edges. This defaults to false.
	WithDropColumn = schema.WithDropColumn
	// WithDropIndex sets the drop index option to the migration.
	// If this option is enabled, ent migration will drop old indexes
	// that were defined in the schema. This defaults to false.
	// Note that unique constraints are defined using `UNIQUE INDEX`,
	// and therefore, it's recommended to enable this option to get more
	// flexibility in the schema changes.
	WithDropIndex = schema.WithDropIndex
	// WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true.
	WithForeignKeys = schema.WithForeignKeys
)
View Source
var (
	// ActivityEventsColumns holds the columns for the "activity_events" table.
	ActivityEventsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "event_type", Type: field.TypeString},
		{Name: "message", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "metadata", Type: field.TypeJSON},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "agent_id", Type: field.TypeUUID, Nullable: true},
		{Name: "project_id", Type: field.TypeUUID},
		{Name: "ticket_id", Type: field.TypeUUID, Nullable: true},
	}
	// ActivityEventsTable holds the schema information for the "activity_events" table.
	ActivityEventsTable = &schema.Table{
		Name:       "activity_events",
		Columns:    ActivityEventsColumns,
		PrimaryKey: []*schema.Column{ActivityEventsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "activity_events_agents_activity_events",
				Columns:    []*schema.Column{ActivityEventsColumns[5]},
				RefColumns: []*schema.Column{AgentsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "activity_events_projects_activity_events",
				Columns:    []*schema.Column{ActivityEventsColumns[6]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "activity_events_tickets_activity_events",
				Columns:    []*schema.Column{ActivityEventsColumns[7]},
				RefColumns: []*schema.Column{TicketsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "activityevent_ticket_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{ActivityEventsColumns[7], ActivityEventsColumns[4]},
			},
			{
				Name:    "activityevent_project_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{ActivityEventsColumns[6], ActivityEventsColumns[4]},
			},
		},
	}
	// AgentsColumns holds the columns for the "agents" table.
	AgentsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "name", Type: field.TypeString},
		{Name: "runtime_control_state", Type: field.TypeEnum, Enums: []string{"active", "interrupt_requested", "pause_requested", "paused", "retired"}, Default: "active"},
		{Name: "total_tokens_used", Type: field.TypeInt64, Default: 0},
		{Name: "total_tickets_completed", Type: field.TypeInt, Default: 0},
		{Name: "provider_id", Type: field.TypeUUID},
		{Name: "project_id", Type: field.TypeUUID},
	}
	// AgentsTable holds the schema information for the "agents" table.
	AgentsTable = &schema.Table{
		Name:       "agents",
		Columns:    AgentsColumns,
		PrimaryKey: []*schema.Column{AgentsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "agents_agent_providers_agents",
				Columns:    []*schema.Column{AgentsColumns[5]},
				RefColumns: []*schema.Column{AgentProvidersColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agents_projects_agents",
				Columns:    []*schema.Column{AgentsColumns[6]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "agent_project_id_name",
				Unique:  true,
				Columns: []*schema.Column{AgentsColumns[6], AgentsColumns[1]},
			},
			{
				Name:    "agent_project_id_runtime_control_state",
				Unique:  false,
				Columns: []*schema.Column{AgentsColumns[6], AgentsColumns[2]},
			},
		},
	}
	// AgentActivityInstancesColumns holds the columns for the "agent_activity_instances" table.
	AgentActivityInstancesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "provider", Type: field.TypeString},
		{Name: "activity_kind", Type: field.TypeString},
		{Name: "activity_id", Type: field.TypeString},
		{Name: "id_source", Type: field.TypeString},
		{Name: "identity_confidence", Type: field.TypeString},
		{Name: "parent_activity_id", Type: field.TypeString, Nullable: true},
		{Name: "thread_id", Type: field.TypeString, Nullable: true},
		{Name: "turn_id", Type: field.TypeString, Nullable: true},
		{Name: "command", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "tool_name", Type: field.TypeString, Nullable: true},
		{Name: "title", Type: field.TypeString, Nullable: true},
		{Name: "status", Type: field.TypeString},
		{Name: "live_text", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "final_text", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "live_text_bytes", Type: field.TypeInt, Default: 0},
		{Name: "final_text_bytes", Type: field.TypeInt, Default: 0},
		{Name: "metadata", Type: field.TypeJSON},
		{Name: "started_at", Type: field.TypeTime, Nullable: true},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "completed_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "agent_id", Type: field.TypeUUID},
		{Name: "agent_run_id", Type: field.TypeUUID},
		{Name: "project_id", Type: field.TypeUUID},
		{Name: "ticket_id", Type: field.TypeUUID, Nullable: true},
	}
	// AgentActivityInstancesTable holds the schema information for the "agent_activity_instances" table.
	AgentActivityInstancesTable = &schema.Table{
		Name:       "agent_activity_instances",
		Columns:    AgentActivityInstancesColumns,
		PrimaryKey: []*schema.Column{AgentActivityInstancesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "agent_activity_instances_agents_agent_activity_instances",
				Columns:    []*schema.Column{AgentActivityInstancesColumns[22]},
				RefColumns: []*schema.Column{AgentsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_activity_instances_agent_runs_agent_activity_instances",
				Columns:    []*schema.Column{AgentActivityInstancesColumns[23]},
				RefColumns: []*schema.Column{AgentRunsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_activity_instances_projects_agent_activity_instances",
				Columns:    []*schema.Column{AgentActivityInstancesColumns[24]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_activity_instances_tickets_agent_activity_instances",
				Columns:    []*schema.Column{AgentActivityInstancesColumns[25]},
				RefColumns: []*schema.Column{TicketsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "agentactivityinstance_agent_run_id_activity_kind_activity_id",
				Unique:  true,
				Columns: []*schema.Column{AgentActivityInstancesColumns[23], AgentActivityInstancesColumns[2], AgentActivityInstancesColumns[3]},
			},
			{
				Name:    "agentactivityinstance_agent_run_id_updated_at",
				Unique:  false,
				Columns: []*schema.Column{AgentActivityInstancesColumns[23], AgentActivityInstancesColumns[19]},
			},
			{
				Name:    "agentactivityinstance_project_id_updated_at",
				Unique:  false,
				Columns: []*schema.Column{AgentActivityInstancesColumns[24], AgentActivityInstancesColumns[19]},
			},
			{
				Name:    "agentactivityinstance_ticket_id_updated_at",
				Unique:  false,
				Columns: []*schema.Column{AgentActivityInstancesColumns[25], AgentActivityInstancesColumns[19]},
			},
		},
	}
	// AgentProvidersColumns holds the columns for the "agent_providers" table.
	AgentProvidersColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "name", Type: field.TypeString},
		{Name: "adapter_type", Type: field.TypeEnum, Enums: []string{"claude-code-cli", "codex-app-server", "gemini-cli", "custom"}},
		{Name: "permission_profile", Type: field.TypeEnum, Enums: []string{"standard", "unrestricted"}, Default: "unrestricted"},
		{Name: "cli_command", Type: field.TypeString},
		{Name: "cli_args", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "text[]"}},
		{Name: "auth_config", Type: field.TypeJSON},
		{Name: "cli_rate_limit", Type: field.TypeJSON},
		{Name: "cli_rate_limit_updated_at", Type: field.TypeTime, Nullable: true},
		{Name: "model_name", Type: field.TypeString},
		{Name: "reasoning_effort", Type: field.TypeString, Nullable: true},
		{Name: "model_temperature", Type: field.TypeFloat64, Default: 0},
		{Name: "model_max_tokens", Type: field.TypeInt, Default: 16384},
		{Name: "max_parallel_runs", Type: field.TypeInt, Default: 0},
		{Name: "cost_per_input_token", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "numeric(18,8)"}},
		{Name: "cost_per_output_token", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "numeric(18,8)"}},
		{Name: "pricing_config", Type: field.TypeJSON},
		{Name: "machine_id", Type: field.TypeUUID},
		{Name: "organization_id", Type: field.TypeUUID},
	}
	// AgentProvidersTable holds the schema information for the "agent_providers" table.
	AgentProvidersTable = &schema.Table{
		Name:       "agent_providers",
		Columns:    AgentProvidersColumns,
		PrimaryKey: []*schema.Column{AgentProvidersColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "agent_providers_machines_providers",
				Columns:    []*schema.Column{AgentProvidersColumns[17]},
				RefColumns: []*schema.Column{MachinesColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_providers_organizations_providers",
				Columns:    []*schema.Column{AgentProvidersColumns[18]},
				RefColumns: []*schema.Column{OrganizationsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "agentprovider_organization_id_name",
				Unique:  true,
				Columns: []*schema.Column{AgentProvidersColumns[18], AgentProvidersColumns[1]},
			},
		},
	}
	// AgentRawEventsColumns holds the columns for the "agent_raw_events" table.
	AgentRawEventsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "dedup_key", Type: field.TypeString},
		{Name: "provider", Type: field.TypeString},
		{Name: "provider_event_kind", Type: field.TypeString},
		{Name: "provider_event_subtype", Type: field.TypeString, Nullable: true},
		{Name: "provider_event_id", Type: field.TypeString, Nullable: true},
		{Name: "thread_id", Type: field.TypeString, Nullable: true},
		{Name: "turn_id", Type: field.TypeString, Nullable: true},
		{Name: "activity_hint_id", Type: field.TypeString, Nullable: true},
		{Name: "occurred_at", Type: field.TypeTime},
		{Name: "payload", Type: field.TypeJSON},
		{Name: "text_excerpt", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "agent_id", Type: field.TypeUUID},
		{Name: "agent_run_id", Type: field.TypeUUID},
		{Name: "project_id", Type: field.TypeUUID},
		{Name: "ticket_id", Type: field.TypeUUID, Nullable: true},
	}
	// AgentRawEventsTable holds the schema information for the "agent_raw_events" table.
	AgentRawEventsTable = &schema.Table{
		Name:       "agent_raw_events",
		Columns:    AgentRawEventsColumns,
		PrimaryKey: []*schema.Column{AgentRawEventsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "agent_raw_events_agents_agent_raw_events",
				Columns:    []*schema.Column{AgentRawEventsColumns[13]},
				RefColumns: []*schema.Column{AgentsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_raw_events_agent_runs_agent_raw_events",
				Columns:    []*schema.Column{AgentRawEventsColumns[14]},
				RefColumns: []*schema.Column{AgentRunsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_raw_events_projects_agent_raw_events",
				Columns:    []*schema.Column{AgentRawEventsColumns[15]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_raw_events_tickets_agent_raw_events",
				Columns:    []*schema.Column{AgentRawEventsColumns[16]},
				RefColumns: []*schema.Column{TicketsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "agentrawevent_agent_run_id_dedup_key",
				Unique:  true,
				Columns: []*schema.Column{AgentRawEventsColumns[14], AgentRawEventsColumns[1]},
			},
			{
				Name:    "agentrawevent_agent_run_id_occurred_at_id",
				Unique:  false,
				Columns: []*schema.Column{AgentRawEventsColumns[14], AgentRawEventsColumns[9], AgentRawEventsColumns[0]},
			},
			{
				Name:    "agentrawevent_project_id_occurred_at",
				Unique:  false,
				Columns: []*schema.Column{AgentRawEventsColumns[15], AgentRawEventsColumns[9]},
			},
			{
				Name:    "agentrawevent_ticket_id_occurred_at",
				Unique:  false,
				Columns: []*schema.Column{AgentRawEventsColumns[16], AgentRawEventsColumns[9]},
			},
			{
				Name:    "agentrawevent_agent_id_occurred_at",
				Unique:  false,
				Columns: []*schema.Column{AgentRawEventsColumns[13], AgentRawEventsColumns[9]},
			},
		},
	}
	// AgentRunsColumns holds the columns for the "agent_runs" table.
	AgentRunsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "skill_version_ids", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "text[]"}},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"launching", "ready", "executing", "completed", "errored", "interrupted", "terminated"}},
		{Name: "session_id", Type: field.TypeString, Nullable: true},
		{Name: "runtime_started_at", Type: field.TypeTime, Nullable: true},
		{Name: "terminal_at", Type: field.TypeTime, Nullable: true},
		{Name: "snapshot_materialized_at", Type: field.TypeTime, Nullable: true},
		{Name: "last_error", Type: field.TypeString, Nullable: true},
		{Name: "last_heartbeat_at", Type: field.TypeTime, Nullable: true},
		{Name: "input_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "output_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "cached_input_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "cache_creation_input_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "reasoning_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "prompt_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "candidate_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "tool_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "total_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "current_step_status", Type: field.TypeString, Nullable: true},
		{Name: "current_step_summary", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "current_step_changed_at", Type: field.TypeTime, Nullable: true},
		{Name: "completion_summary_status", Type: field.TypeEnum, Nullable: true, Enums: []string{"pending", "completed", "failed"}},
		{Name: "completion_summary_markdown", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "completion_summary_json", Type: field.TypeJSON, Nullable: true},
		{Name: "completion_summary_input", Type: field.TypeJSON, Nullable: true},
		{Name: "completion_summary_generated_at", Type: field.TypeTime, Nullable: true},
		{Name: "completion_summary_error", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "agent_id", Type: field.TypeUUID},
		{Name: "provider_id", Type: field.TypeUUID},
		{Name: "ticket_id", Type: field.TypeUUID},
		{Name: "workflow_id", Type: field.TypeUUID},
		{Name: "workflow_version_id", Type: field.TypeUUID, Nullable: true},
	}
	// AgentRunsTable holds the schema information for the "agent_runs" table.
	AgentRunsTable = &schema.Table{
		Name:       "agent_runs",
		Columns:    AgentRunsColumns,
		PrimaryKey: []*schema.Column{AgentRunsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "agent_runs_agents_runs",
				Columns:    []*schema.Column{AgentRunsColumns[28]},
				RefColumns: []*schema.Column{AgentsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_runs_agent_providers_agent_runs",
				Columns:    []*schema.Column{AgentRunsColumns[29]},
				RefColumns: []*schema.Column{AgentProvidersColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_runs_tickets_agent_runs",
				Columns:    []*schema.Column{AgentRunsColumns[30]},
				RefColumns: []*schema.Column{TicketsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_runs_workflows_agent_runs",
				Columns:    []*schema.Column{AgentRunsColumns[31]},
				RefColumns: []*schema.Column{WorkflowsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_runs_workflow_versions_agent_runs",
				Columns:    []*schema.Column{AgentRunsColumns[32]},
				RefColumns: []*schema.Column{WorkflowVersionsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "agentrun_agent_id_status_last_heartbeat_at",
				Unique:  false,
				Columns: []*schema.Column{AgentRunsColumns[28], AgentRunsColumns[2], AgentRunsColumns[8]},
			},
			{
				Name:    "agentrun_provider_id_status",
				Unique:  false,
				Columns: []*schema.Column{AgentRunsColumns[29], AgentRunsColumns[2]},
			},
			{
				Name:    "agentrun_ticket_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{AgentRunsColumns[30], AgentRunsColumns[27]},
			},
			{
				Name:    "agentrun_ticket_id_terminal_at",
				Unique:  false,
				Columns: []*schema.Column{AgentRunsColumns[30], AgentRunsColumns[5]},
			},
		},
	}
	// AgentStepEventsColumns holds the columns for the "agent_step_events" table.
	AgentStepEventsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "step_status", Type: field.TypeString},
		{Name: "summary", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "agent_id", Type: field.TypeUUID},
		{Name: "agent_run_id", Type: field.TypeUUID},
		{Name: "source_trace_event_id", Type: field.TypeUUID, Nullable: true},
		{Name: "project_id", Type: field.TypeUUID},
		{Name: "ticket_id", Type: field.TypeUUID},
	}
	// AgentStepEventsTable holds the schema information for the "agent_step_events" table.
	AgentStepEventsTable = &schema.Table{
		Name:       "agent_step_events",
		Columns:    AgentStepEventsColumns,
		PrimaryKey: []*schema.Column{AgentStepEventsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "agent_step_events_agents_agent_step_events",
				Columns:    []*schema.Column{AgentStepEventsColumns[4]},
				RefColumns: []*schema.Column{AgentsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_step_events_agent_runs_agent_step_events",
				Columns:    []*schema.Column{AgentStepEventsColumns[5]},
				RefColumns: []*schema.Column{AgentRunsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_step_events_agent_trace_events_step_events",
				Columns:    []*schema.Column{AgentStepEventsColumns[6]},
				RefColumns: []*schema.Column{AgentTraceEventsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "agent_step_events_projects_agent_step_events",
				Columns:    []*schema.Column{AgentStepEventsColumns[7]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_step_events_tickets_agent_step_events",
				Columns:    []*schema.Column{AgentStepEventsColumns[8]},
				RefColumns: []*schema.Column{TicketsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "agentstepevent_agent_run_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{AgentStepEventsColumns[5], AgentStepEventsColumns[3]},
			},
			{
				Name:    "agentstepevent_ticket_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{AgentStepEventsColumns[8], AgentStepEventsColumns[3]},
			},
			{
				Name:    "agentstepevent_project_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{AgentStepEventsColumns[7], AgentStepEventsColumns[3]},
			},
		},
	}
	// AgentTokensColumns holds the columns for the "agent_tokens" table.
	AgentTokensColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "principal_kind", Type: field.TypeEnum, Enums: []string{"ticket_agent", "project_conversation"}},
		{Name: "principal_id", Type: field.TypeUUID},
		{Name: "principal_name", Type: field.TypeString},
		{Name: "token_hash", Type: field.TypeString},
		{Name: "scopes", Type: field.TypeJSON},
		{Name: "expires_at", Type: field.TypeTime},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "last_used_at", Type: field.TypeTime, Nullable: true},
		{Name: "agent_id", Type: field.TypeUUID, Nullable: true},
		{Name: "conversation_id", Type: field.TypeUUID, Nullable: true},
		{Name: "project_id", Type: field.TypeUUID},
		{Name: "ticket_id", Type: field.TypeUUID, Nullable: true},
	}
	// AgentTokensTable holds the schema information for the "agent_tokens" table.
	AgentTokensTable = &schema.Table{
		Name:       "agent_tokens",
		Columns:    AgentTokensColumns,
		PrimaryKey: []*schema.Column{AgentTokensColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "agent_tokens_agents_tokens",
				Columns:    []*schema.Column{AgentTokensColumns[9]},
				RefColumns: []*schema.Column{AgentsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "agent_tokens_chat_conversations_agent_tokens",
				Columns:    []*schema.Column{AgentTokensColumns[10]},
				RefColumns: []*schema.Column{ChatConversationsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "agent_tokens_projects_agent_tokens",
				Columns:    []*schema.Column{AgentTokensColumns[11]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_tokens_tickets_agent_tokens",
				Columns:    []*schema.Column{AgentTokensColumns[12]},
				RefColumns: []*schema.Column{TicketsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "agenttoken_token_hash",
				Unique:  true,
				Columns: []*schema.Column{AgentTokensColumns[4]},
			},
			{
				Name:    "agenttoken_project_id_ticket_id",
				Unique:  false,
				Columns: []*schema.Column{AgentTokensColumns[11], AgentTokensColumns[12]},
			},
			{
				Name:    "agenttoken_project_id_conversation_id",
				Unique:  false,
				Columns: []*schema.Column{AgentTokensColumns[11], AgentTokensColumns[10]},
			},
			{
				Name:    "agenttoken_principal_kind_principal_id",
				Unique:  false,
				Columns: []*schema.Column{AgentTokensColumns[1], AgentTokensColumns[2]},
			},
			{
				Name:    "agenttoken_expires_at",
				Unique:  false,
				Columns: []*schema.Column{AgentTokensColumns[6]},
			},
		},
	}
	// AgentTraceEventsColumns holds the columns for the "agent_trace_events" table.
	AgentTraceEventsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "sequence", Type: field.TypeInt64},
		{Name: "provider", Type: field.TypeString},
		{Name: "kind", Type: field.TypeString},
		{Name: "stream", Type: field.TypeString},
		{Name: "text", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "payload", Type: field.TypeJSON},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "agent_id", Type: field.TypeUUID},
		{Name: "agent_run_id", Type: field.TypeUUID},
		{Name: "project_id", Type: field.TypeUUID},
		{Name: "ticket_id", Type: field.TypeUUID},
	}
	// AgentTraceEventsTable holds the schema information for the "agent_trace_events" table.
	AgentTraceEventsTable = &schema.Table{
		Name:       "agent_trace_events",
		Columns:    AgentTraceEventsColumns,
		PrimaryKey: []*schema.Column{AgentTraceEventsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "agent_trace_events_agents_agent_trace_events",
				Columns:    []*schema.Column{AgentTraceEventsColumns[8]},
				RefColumns: []*schema.Column{AgentsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_trace_events_agent_runs_agent_trace_events",
				Columns:    []*schema.Column{AgentTraceEventsColumns[9]},
				RefColumns: []*schema.Column{AgentRunsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_trace_events_projects_agent_trace_events",
				Columns:    []*schema.Column{AgentTraceEventsColumns[10]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_trace_events_tickets_agent_trace_events",
				Columns:    []*schema.Column{AgentTraceEventsColumns[11]},
				RefColumns: []*schema.Column{TicketsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "agenttraceevent_agent_run_id_sequence",
				Unique:  true,
				Columns: []*schema.Column{AgentTraceEventsColumns[9], AgentTraceEventsColumns[1]},
			},
			{
				Name:    "agenttraceevent_ticket_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{AgentTraceEventsColumns[11], AgentTraceEventsColumns[7]},
			},
			{
				Name:    "agenttraceevent_agent_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{AgentTraceEventsColumns[8], AgentTraceEventsColumns[7]},
			},
			{
				Name:    "agenttraceevent_project_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{AgentTraceEventsColumns[10], AgentTraceEventsColumns[7]},
			},
		},
	}
	// AgentTranscriptEntriesColumns holds the columns for the "agent_transcript_entries" table.
	AgentTranscriptEntriesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "provider", Type: field.TypeString},
		{Name: "entry_key", Type: field.TypeString},
		{Name: "entry_kind", Type: field.TypeString},
		{Name: "activity_kind", Type: field.TypeString, Nullable: true},
		{Name: "activity_id", Type: field.TypeString, Nullable: true},
		{Name: "title", Type: field.TypeString, Nullable: true},
		{Name: "summary", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "body_text", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "command", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "tool_name", Type: field.TypeString, Nullable: true},
		{Name: "metadata", Type: field.TypeJSON},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "agent_id", Type: field.TypeUUID},
		{Name: "agent_run_id", Type: field.TypeUUID},
		{Name: "project_id", Type: field.TypeUUID},
		{Name: "ticket_id", Type: field.TypeUUID, Nullable: true},
	}
	// AgentTranscriptEntriesTable holds the schema information for the "agent_transcript_entries" table.
	AgentTranscriptEntriesTable = &schema.Table{
		Name:       "agent_transcript_entries",
		Columns:    AgentTranscriptEntriesColumns,
		PrimaryKey: []*schema.Column{AgentTranscriptEntriesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "agent_transcript_entries_agents_agent_transcript_entries",
				Columns:    []*schema.Column{AgentTranscriptEntriesColumns[13]},
				RefColumns: []*schema.Column{AgentsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_transcript_entries_agent_runs_agent_transcript_entries",
				Columns:    []*schema.Column{AgentTranscriptEntriesColumns[14]},
				RefColumns: []*schema.Column{AgentRunsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_transcript_entries_projects_agent_transcript_entries",
				Columns:    []*schema.Column{AgentTranscriptEntriesColumns[15]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "agent_transcript_entries_tickets_agent_transcript_entries",
				Columns:    []*schema.Column{AgentTranscriptEntriesColumns[16]},
				RefColumns: []*schema.Column{TicketsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "agenttranscriptentry_agent_run_id_entry_key",
				Unique:  true,
				Columns: []*schema.Column{AgentTranscriptEntriesColumns[14], AgentTranscriptEntriesColumns[2]},
			},
			{
				Name:    "agenttranscriptentry_agent_run_id_created_at_id",
				Unique:  false,
				Columns: []*schema.Column{AgentTranscriptEntriesColumns[14], AgentTranscriptEntriesColumns[12], AgentTranscriptEntriesColumns[0]},
			},
			{
				Name:    "agenttranscriptentry_project_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{AgentTranscriptEntriesColumns[15], AgentTranscriptEntriesColumns[12]},
			},
			{
				Name:    "agenttranscriptentry_ticket_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{AgentTranscriptEntriesColumns[16], AgentTranscriptEntriesColumns[12]},
			},
		},
	}
	// ApprovalPolicyRulesColumns holds the columns for the "approval_policy_rules" table.
	ApprovalPolicyRulesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "scope_kind", Type: field.TypeEnum, Enums: []string{"instance", "organization", "project"}},
		{Name: "scope_id", Type: field.TypeString, Default: ""},
		{Name: "action_key", Type: field.TypeString},
		{Name: "require_role_key", Type: field.TypeString, Default: ""},
		{Name: "require_ticket_status", Type: field.TypeString, Default: ""},
		{Name: "enabled", Type: field.TypeBool, Default: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
	}
	// ApprovalPolicyRulesTable holds the schema information for the "approval_policy_rules" table.
	ApprovalPolicyRulesTable = &schema.Table{
		Name:       "approval_policy_rules",
		Columns:    ApprovalPolicyRulesColumns,
		PrimaryKey: []*schema.Column{ApprovalPolicyRulesColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "approvalpolicyrule_scope_kind_scope_id_action_key",
				Unique:  true,
				Columns: []*schema.Column{ApprovalPolicyRulesColumns[1], ApprovalPolicyRulesColumns[2], ApprovalPolicyRulesColumns[3]},
			},
		},
	}
	// AuthAuditEventsColumns holds the columns for the "auth_audit_events" table.
	AuthAuditEventsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "user_id", Type: field.TypeUUID, Nullable: true},
		{Name: "session_id", Type: field.TypeUUID, Nullable: true},
		{Name: "actor_id", Type: field.TypeString, Default: ""},
		{Name: "event_type", Type: field.TypeString},
		{Name: "message", Type: field.TypeString, Size: 2147483647, Default: ""},
		{Name: "metadata", Type: field.TypeJSON},
		{Name: "created_at", Type: field.TypeTime},
	}
	// AuthAuditEventsTable holds the schema information for the "auth_audit_events" table.
	AuthAuditEventsTable = &schema.Table{
		Name:       "auth_audit_events",
		Columns:    AuthAuditEventsColumns,
		PrimaryKey: []*schema.Column{AuthAuditEventsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "authauditevent_user_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{AuthAuditEventsColumns[1], AuthAuditEventsColumns[7]},
			},
			{
				Name:    "authauditevent_session_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{AuthAuditEventsColumns[2], AuthAuditEventsColumns[7]},
			},
			{
				Name:    "authauditevent_event_type_created_at",
				Unique:  false,
				Columns: []*schema.Column{AuthAuditEventsColumns[4], AuthAuditEventsColumns[7]},
			},
		},
	}
	// BrowserSessionsColumns holds the columns for the "browser_sessions" table.
	BrowserSessionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "user_id", Type: field.TypeUUID},
		{Name: "session_hash", Type: field.TypeString},
		{Name: "device_kind", Type: field.TypeString, Default: "unknown"},
		{Name: "device_os", Type: field.TypeString, Default: ""},
		{Name: "device_browser", Type: field.TypeString, Default: ""},
		{Name: "device_label", Type: field.TypeString, Default: ""},
		{Name: "expires_at", Type: field.TypeTime},
		{Name: "idle_expires_at", Type: field.TypeTime},
		{Name: "csrf_secret", Type: field.TypeString},
		{Name: "user_agent_hash", Type: field.TypeString, Default: ""},
		{Name: "ip_prefix", Type: field.TypeString, Default: ""},
		{Name: "revoked_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
	}
	// BrowserSessionsTable holds the schema information for the "browser_sessions" table.
	BrowserSessionsTable = &schema.Table{
		Name:       "browser_sessions",
		Columns:    BrowserSessionsColumns,
		PrimaryKey: []*schema.Column{BrowserSessionsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "browsersession_session_hash",
				Unique:  true,
				Columns: []*schema.Column{BrowserSessionsColumns[2]},
			},
			{
				Name:    "browsersession_user_id",
				Unique:  false,
				Columns: []*schema.Column{BrowserSessionsColumns[1]},
			},
			{
				Name:    "browsersession_expires_at",
				Unique:  false,
				Columns: []*schema.Column{BrowserSessionsColumns[7]},
			},
		},
	}
	// ChatConversationsColumns holds the columns for the "chat_conversations" table.
	ChatConversationsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "user_id", Type: field.TypeString},
		{Name: "source", Type: field.TypeString},
		{Name: "provider_id", Type: field.TypeUUID},
		{Name: "status", Type: field.TypeString, Default: "active"},
		{Name: "title", Type: field.TypeString, Nullable: true, Default: ""},
		{Name: "provider_thread_id", Type: field.TypeString, Nullable: true},
		{Name: "last_turn_id", Type: field.TypeString, Nullable: true},
		{Name: "provider_thread_status", Type: field.TypeString, Nullable: true},
		{Name: "provider_thread_active_flags", Type: field.TypeJSON, Nullable: true},
		{Name: "rolling_summary", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "last_activity_at", Type: field.TypeTime},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "project_id", Type: field.TypeUUID},
	}
	// ChatConversationsTable holds the schema information for the "chat_conversations" table.
	ChatConversationsTable = &schema.Table{
		Name:       "chat_conversations",
		Columns:    ChatConversationsColumns,
		PrimaryKey: []*schema.Column{ChatConversationsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "chat_conversations_projects_chat_conversations",
				Columns:    []*schema.Column{ChatConversationsColumns[14]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "chatconversation_project_id_user_id_source_provider_id_last_activity_at",
				Unique:  false,
				Columns: []*schema.Column{ChatConversationsColumns[14], ChatConversationsColumns[1], ChatConversationsColumns[2], ChatConversationsColumns[3], ChatConversationsColumns[11]},
			},
		},
	}
	// ChatEntriesColumns holds the columns for the "chat_entries" table.
	ChatEntriesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "seq", Type: field.TypeInt},
		{Name: "kind", Type: field.TypeString},
		{Name: "payload_json", Type: field.TypeJSON},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "conversation_id", Type: field.TypeUUID},
		{Name: "turn_id", Type: field.TypeUUID, Nullable: true},
	}
	// ChatEntriesTable holds the schema information for the "chat_entries" table.
	ChatEntriesTable = &schema.Table{
		Name:       "chat_entries",
		Columns:    ChatEntriesColumns,
		PrimaryKey: []*schema.Column{ChatEntriesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "chat_entries_chat_conversations_entries",
				Columns:    []*schema.Column{ChatEntriesColumns[5]},
				RefColumns: []*schema.Column{ChatConversationsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "chat_entries_chat_turns_entries",
				Columns:    []*schema.Column{ChatEntriesColumns[6]},
				RefColumns: []*schema.Column{ChatTurnsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "chatentry_conversation_id_seq",
				Unique:  true,
				Columns: []*schema.Column{ChatEntriesColumns[5], ChatEntriesColumns[1]},
			},
			{
				Name:    "chatentry_turn_id_seq",
				Unique:  false,
				Columns: []*schema.Column{ChatEntriesColumns[6], ChatEntriesColumns[1]},
			},
		},
	}
	// ChatPendingInterruptsColumns holds the columns for the "chat_pending_interrupts" table.
	ChatPendingInterruptsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "provider_request_id", Type: field.TypeString},
		{Name: "kind", Type: field.TypeString},
		{Name: "payload_json", Type: field.TypeJSON},
		{Name: "status", Type: field.TypeString, Default: "pending"},
		{Name: "decision", Type: field.TypeString, Nullable: true},
		{Name: "response_json", Type: field.TypeJSON, Nullable: true},
		{Name: "resolved_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "conversation_id", Type: field.TypeUUID},
		{Name: "turn_id", Type: field.TypeUUID},
	}
	// ChatPendingInterruptsTable holds the schema information for the "chat_pending_interrupts" table.
	ChatPendingInterruptsTable = &schema.Table{
		Name:       "chat_pending_interrupts",
		Columns:    ChatPendingInterruptsColumns,
		PrimaryKey: []*schema.Column{ChatPendingInterruptsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "chat_pending_interrupts_chat_conversations_pending_interrupts",
				Columns:    []*schema.Column{ChatPendingInterruptsColumns[10]},
				RefColumns: []*schema.Column{ChatConversationsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "chat_pending_interrupts_chat_turns_pending_interrupts",
				Columns:    []*schema.Column{ChatPendingInterruptsColumns[11]},
				RefColumns: []*schema.Column{ChatTurnsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "chatpendinginterrupt_conversation_id_status_created_at",
				Unique:  false,
				Columns: []*schema.Column{ChatPendingInterruptsColumns[10], ChatPendingInterruptsColumns[4], ChatPendingInterruptsColumns[8]},
			},
			{
				Name:    "chatpendinginterrupt_conversation_id_provider_request_id",
				Unique:  true,
				Columns: []*schema.Column{ChatPendingInterruptsColumns[10], ChatPendingInterruptsColumns[1]},
			},
		},
	}
	// ChatTurnsColumns holds the columns for the "chat_turns" table.
	ChatTurnsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "turn_index", Type: field.TypeInt},
		{Name: "provider_turn_id", Type: field.TypeString, Nullable: true},
		{Name: "status", Type: field.TypeString, Default: "pending"},
		{Name: "started_at", Type: field.TypeTime},
		{Name: "completed_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "conversation_id", Type: field.TypeUUID},
	}
	// ChatTurnsTable holds the schema information for the "chat_turns" table.
	ChatTurnsTable = &schema.Table{
		Name:       "chat_turns",
		Columns:    ChatTurnsColumns,
		PrimaryKey: []*schema.Column{ChatTurnsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "chat_turns_chat_conversations_turns",
				Columns:    []*schema.Column{ChatTurnsColumns[8]},
				RefColumns: []*schema.Column{ChatConversationsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "chatturn_conversation_id_turn_index",
				Unique:  true,
				Columns: []*schema.Column{ChatTurnsColumns[8], ChatTurnsColumns[1]},
			},
			{
				Name:    "chatturn_conversation_id_started_at",
				Unique:  false,
				Columns: []*schema.Column{ChatTurnsColumns[8], ChatTurnsColumns[4]},
			},
		},
	}
	// InstanceAuthConfigsColumns holds the columns for the "instance_auth_configs" table.
	InstanceAuthConfigsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "scope_key", Type: field.TypeString, Default: "instance"},
		{Name: "status", Type: field.TypeString, Default: "absent"},
		{Name: "issuer_url", Type: field.TypeString, Default: ""},
		{Name: "client_id", Type: field.TypeString, Default: ""},
		{Name: "client_secret_encrypted", Type: field.TypeJSON, Nullable: true},
		{Name: "redirect_mode", Type: field.TypeString, Default: ""},
		{Name: "redirect_url", Type: field.TypeString, Default: ""},
		{Name: "scopes", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "text[]"}},
		{Name: "email_claim", Type: field.TypeString, Default: "email"},
		{Name: "name_claim", Type: field.TypeString, Default: "name"},
		{Name: "username_claim", Type: field.TypeString, Default: "preferred_username"},
		{Name: "groups_claim", Type: field.TypeString, Default: "groups"},
		{Name: "allowed_email_domains", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "text[]"}},
		{Name: "bootstrap_admin_emails", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "text[]"}},
		{Name: "session_ttl", Type: field.TypeString, Default: "0s"},
		{Name: "session_idle_ttl", Type: field.TypeString, Default: "0s"},
		{Name: "validation_metadata", Type: field.TypeJSON},
		{Name: "activation_metadata", Type: field.TypeJSON},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
	}
	// InstanceAuthConfigsTable holds the schema information for the "instance_auth_configs" table.
	InstanceAuthConfigsTable = &schema.Table{
		Name:       "instance_auth_configs",
		Columns:    InstanceAuthConfigsColumns,
		PrimaryKey: []*schema.Column{InstanceAuthConfigsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "instanceauthconfig_scope_key",
				Unique:  true,
				Columns: []*schema.Column{InstanceAuthConfigsColumns[1]},
			},
		},
	}
	// LocalBootstrapAuthRequestsColumns holds the columns for the "local_bootstrap_auth_requests" table.
	LocalBootstrapAuthRequestsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "code_hash", Type: field.TypeString},
		{Name: "nonce_hash", Type: field.TypeString},
		{Name: "purpose", Type: field.TypeString, Default: "browser_session"},
		{Name: "requested_by", Type: field.TypeString, Default: ""},
		{Name: "expires_at", Type: field.TypeTime},
		{Name: "used_session_id", Type: field.TypeUUID, Nullable: true},
		{Name: "used_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
	}
	// LocalBootstrapAuthRequestsTable holds the schema information for the "local_bootstrap_auth_requests" table.
	LocalBootstrapAuthRequestsTable = &schema.Table{
		Name:       "local_bootstrap_auth_requests",
		Columns:    LocalBootstrapAuthRequestsColumns,
		PrimaryKey: []*schema.Column{LocalBootstrapAuthRequestsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "localbootstrapauthrequest_expires_at",
				Unique:  false,
				Columns: []*schema.Column{LocalBootstrapAuthRequestsColumns[5]},
			},
			{
				Name:    "localbootstrapauthrequest_used_at",
				Unique:  false,
				Columns: []*schema.Column{LocalBootstrapAuthRequestsColumns[7]},
			},
		},
	}
	// MachinesColumns holds the columns for the "machines" table.
	MachinesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "name", Type: field.TypeString},
		{Name: "host", Type: field.TypeString},
		{Name: "port", Type: field.TypeInt, Default: 22},
		{Name: "connection_mode", Type: field.TypeEnum, Enums: []string{"local", "ssh", "ws_reverse", "ws_listener"}, Default: "ssh"},
		{Name: "transport_capabilities", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "text[]"}},
		{Name: "ssh_user", Type: field.TypeString, Nullable: true},
		{Name: "ssh_key_path", Type: field.TypeString, Nullable: true},
		{Name: "advertised_endpoint", Type: field.TypeString, Nullable: true},
		{Name: "daemon_registered", Type: field.TypeBool, Default: false},
		{Name: "daemon_last_registered_at", Type: field.TypeTime, Nullable: true},
		{Name: "daemon_session_id", Type: field.TypeString, Nullable: true},
		{Name: "daemon_session_state", Type: field.TypeEnum, Enums: []string{"unknown", "connected", "disconnected", "unavailable"}, Default: "unknown"},
		{Name: "detected_os", Type: field.TypeEnum, Enums: []string{"darwin", "linux", "unknown"}, Default: "unknown"},
		{Name: "detected_arch", Type: field.TypeEnum, Enums: []string{"amd64", "arm64", "unknown"}, Default: "unknown"},
		{Name: "detection_status", Type: field.TypeEnum, Enums: []string{"pending", "ok", "degraded", "unknown"}, Default: "unknown"},
		{Name: "channel_credential_kind", Type: field.TypeEnum, Enums: []string{"none", "token", "certificate"}, Default: "none"},
		{Name: "channel_token_id", Type: field.TypeString, Nullable: true},
		{Name: "channel_certificate_id", Type: field.TypeString, Nullable: true},
		{Name: "description", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "labels", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "text[]"}},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"online", "offline", "degraded", "maintenance"}, Default: "maintenance"},
		{Name: "workspace_root", Type: field.TypeString, Nullable: true},
		{Name: "agent_cli_path", Type: field.TypeString, Nullable: true},
		{Name: "env_vars", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "text[]"}},
		{Name: "last_heartbeat_at", Type: field.TypeTime, Nullable: true},
		{Name: "resources", Type: field.TypeJSON},
		{Name: "organization_id", Type: field.TypeUUID},
	}
	// MachinesTable holds the schema information for the "machines" table.
	MachinesTable = &schema.Table{
		Name:       "machines",
		Columns:    MachinesColumns,
		PrimaryKey: []*schema.Column{MachinesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "machines_organizations_machines",
				Columns:    []*schema.Column{MachinesColumns[27]},
				RefColumns: []*schema.Column{OrganizationsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "machine_organization_id_name",
				Unique:  true,
				Columns: []*schema.Column{MachinesColumns[27], MachinesColumns[1]},
			},
			{
				Name:    "machine_organization_id_host",
				Unique:  false,
				Columns: []*schema.Column{MachinesColumns[27], MachinesColumns[2]},
			},
			{
				Name:    "machine_labels",
				Unique:  false,
				Columns: []*schema.Column{MachinesColumns[20]},
				Annotation: &entsql.IndexAnnotation{
					Type: "GIN",
				},
			},
		},
	}
	// MachineChannelTokensColumns holds the columns for the "machine_channel_tokens" table.
	MachineChannelTokensColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "token_hash", Type: field.TypeString},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"active", "revoked"}, Default: "active"},
		{Name: "expires_at", Type: field.TypeTime},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "last_used_at", Type: field.TypeTime, Nullable: true},
		{Name: "revoked_at", Type: field.TypeTime, Nullable: true},
		{Name: "machine_id", Type: field.TypeUUID},
	}
	// MachineChannelTokensTable holds the schema information for the "machine_channel_tokens" table.
	MachineChannelTokensTable = &schema.Table{
		Name:       "machine_channel_tokens",
		Columns:    MachineChannelTokensColumns,
		PrimaryKey: []*schema.Column{MachineChannelTokensColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "machine_channel_tokens_machines_channel_tokens",
				Columns:    []*schema.Column{MachineChannelTokensColumns[7]},
				RefColumns: []*schema.Column{MachinesColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "machinechanneltoken_token_hash",
				Unique:  true,
				Columns: []*schema.Column{MachineChannelTokensColumns[1]},
			},
			{
				Name:    "machinechanneltoken_machine_id_status",
				Unique:  false,
				Columns: []*schema.Column{MachineChannelTokensColumns[7], MachineChannelTokensColumns[2]},
			},
			{
				Name:    "machinechanneltoken_expires_at",
				Unique:  false,
				Columns: []*schema.Column{MachineChannelTokensColumns[3]},
			},
		},
	}
	// NotificationChannelsColumns holds the columns for the "notification_channels" table.
	NotificationChannelsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "name", Type: field.TypeString},
		{Name: "type", Type: field.TypeString},
		{Name: "config", Type: field.TypeJSON},
		{Name: "is_enabled", Type: field.TypeBool, Default: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "organization_id", Type: field.TypeUUID},
	}
	// NotificationChannelsTable holds the schema information for the "notification_channels" table.
	NotificationChannelsTable = &schema.Table{
		Name:       "notification_channels",
		Columns:    NotificationChannelsColumns,
		PrimaryKey: []*schema.Column{NotificationChannelsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "notification_channels_organizations_notification_channels",
				Columns:    []*schema.Column{NotificationChannelsColumns[6]},
				RefColumns: []*schema.Column{OrganizationsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "notificationchannel_organization_id_name",
				Unique:  true,
				Columns: []*schema.Column{NotificationChannelsColumns[6], NotificationChannelsColumns[1]},
			},
			{
				Name:    "notificationchannel_organization_id_type",
				Unique:  false,
				Columns: []*schema.Column{NotificationChannelsColumns[6], NotificationChannelsColumns[2]},
			},
		},
	}
	// NotificationRulesColumns holds the columns for the "notification_rules" table.
	NotificationRulesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "name", Type: field.TypeString},
		{Name: "event_type", Type: field.TypeString},
		{Name: "filter", Type: field.TypeJSON},
		{Name: "template", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "is_enabled", Type: field.TypeBool, Default: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "channel_id", Type: field.TypeUUID},
		{Name: "project_id", Type: field.TypeUUID},
	}
	// NotificationRulesTable holds the schema information for the "notification_rules" table.
	NotificationRulesTable = &schema.Table{
		Name:       "notification_rules",
		Columns:    NotificationRulesColumns,
		PrimaryKey: []*schema.Column{NotificationRulesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "notification_rules_notification_channels_notification_rules",
				Columns:    []*schema.Column{NotificationRulesColumns[7]},
				RefColumns: []*schema.Column{NotificationChannelsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "notification_rules_projects_notification_rules",
				Columns:    []*schema.Column{NotificationRulesColumns[8]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "notificationrule_project_id_name",
				Unique:  true,
				Columns: []*schema.Column{NotificationRulesColumns[8], NotificationRulesColumns[1]},
			},
			{
				Name:    "notificationrule_project_id_event_type",
				Unique:  false,
				Columns: []*schema.Column{NotificationRulesColumns[8], NotificationRulesColumns[2]},
			},
			{
				Name:    "notificationrule_channel_id",
				Unique:  false,
				Columns: []*schema.Column{NotificationRulesColumns[7]},
			},
		},
	}
	// OrganizationsColumns holds the columns for the "organizations" table.
	OrganizationsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "name", Type: field.TypeString},
		{Name: "slug", Type: field.TypeString},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"active", "archived"}, Default: "active"},
		{Name: "github_outbound_credential", Type: field.TypeJSON, Nullable: true},
		{Name: "github_token_probe", Type: field.TypeJSON, Nullable: true},
		{Name: "default_agent_provider_id", Type: field.TypeUUID, Nullable: true},
	}
	// OrganizationsTable holds the schema information for the "organizations" table.
	OrganizationsTable = &schema.Table{
		Name:       "organizations",
		Columns:    OrganizationsColumns,
		PrimaryKey: []*schema.Column{OrganizationsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "organizations_agent_providers_default_agent_provider",
				Columns:    []*schema.Column{OrganizationsColumns[6]},
				RefColumns: []*schema.Column{AgentProvidersColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "organization_slug",
				Unique:  true,
				Columns: []*schema.Column{OrganizationsColumns[2]},
			},
		},
	}
	// OrganizationDailyTokenUsagesColumns holds the columns for the "organization_daily_token_usages" table.
	OrganizationDailyTokenUsagesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "usage_date", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "date"}},
		{Name: "input_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "output_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "cached_input_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "reasoning_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "total_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "finalized_run_count", Type: field.TypeInt, Default: 0},
		{Name: "recomputed_at", Type: field.TypeTime},
		{Name: "source_mode", Type: field.TypeEnum, Enums: []string{"materialized", "lazy_backfill"}, Default: "materialized"},
		{Name: "organization_id", Type: field.TypeUUID},
	}
	// OrganizationDailyTokenUsagesTable holds the schema information for the "organization_daily_token_usages" table.
	OrganizationDailyTokenUsagesTable = &schema.Table{
		Name:       "organization_daily_token_usages",
		Columns:    OrganizationDailyTokenUsagesColumns,
		PrimaryKey: []*schema.Column{OrganizationDailyTokenUsagesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "organization_daily_token_usages_organizations_daily_token_usage",
				Columns:    []*schema.Column{OrganizationDailyTokenUsagesColumns[10]},
				RefColumns: []*schema.Column{OrganizationsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "organizationdailytokenusage_organization_id_usage_date",
				Unique:  true,
				Columns: []*schema.Column{OrganizationDailyTokenUsagesColumns[10], OrganizationDailyTokenUsagesColumns[1]},
			},
			{
				Name:    "organizationdailytokenusage_usage_date",
				Unique:  false,
				Columns: []*schema.Column{OrganizationDailyTokenUsagesColumns[1]},
			},
		},
	}
	// OrganizationInvitationsColumns holds the columns for the "organization_invitations" table.
	OrganizationInvitationsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "email", Type: field.TypeString},
		{Name: "role", Type: field.TypeEnum, Enums: []string{"owner", "admin", "member"}},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"pending", "accepted", "canceled", "expired"}, Default: "pending"},
		{Name: "invited_by", Type: field.TypeString, Default: ""},
		{Name: "invite_token_hash", Type: field.TypeString},
		{Name: "expires_at", Type: field.TypeTime},
		{Name: "sent_at", Type: field.TypeTime},
		{Name: "accepted_at", Type: field.TypeTime, Nullable: true},
		{Name: "canceled_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "organization_id", Type: field.TypeUUID},
		{Name: "membership_id", Type: field.TypeUUID},
		{Name: "accepted_by_user_id", Type: field.TypeUUID, Nullable: true},
	}
	// OrganizationInvitationsTable holds the schema information for the "organization_invitations" table.
	OrganizationInvitationsTable = &schema.Table{
		Name:       "organization_invitations",
		Columns:    OrganizationInvitationsColumns,
		PrimaryKey: []*schema.Column{OrganizationInvitationsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "organization_invitations_organizations_invitations",
				Columns:    []*schema.Column{OrganizationInvitationsColumns[12]},
				RefColumns: []*schema.Column{OrganizationsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "organization_invitations_organization_memberships_invitations",
				Columns:    []*schema.Column{OrganizationInvitationsColumns[13]},
				RefColumns: []*schema.Column{OrganizationMembershipsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "organization_invitations_users_accepted_organization_invitations",
				Columns:    []*schema.Column{OrganizationInvitationsColumns[14]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "organizationinvitation_invite_token_hash",
				Unique:  true,
				Columns: []*schema.Column{OrganizationInvitationsColumns[5]},
			},
			{
				Name:    "organizationinvitation_organization_id_status",
				Unique:  false,
				Columns: []*schema.Column{OrganizationInvitationsColumns[12], OrganizationInvitationsColumns[3]},
			},
			{
				Name:    "organizationinvitation_membership_id_status",
				Unique:  false,
				Columns: []*schema.Column{OrganizationInvitationsColumns[13], OrganizationInvitationsColumns[3]},
			},
		},
	}
	// OrganizationMembershipsColumns holds the columns for the "organization_memberships" table.
	OrganizationMembershipsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "email", Type: field.TypeString},
		{Name: "role", Type: field.TypeEnum, Enums: []string{"owner", "admin", "member"}},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"invited", "active", "suspended", "removed"}, Default: "invited"},
		{Name: "invited_by", Type: field.TypeString, Default: ""},
		{Name: "invited_at", Type: field.TypeTime},
		{Name: "accepted_at", Type: field.TypeTime, Nullable: true},
		{Name: "suspended_at", Type: field.TypeTime, Nullable: true},
		{Name: "removed_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "organization_id", Type: field.TypeUUID},
		{Name: "user_id", Type: field.TypeUUID, Nullable: true},
	}
	// OrganizationMembershipsTable holds the schema information for the "organization_memberships" table.
	OrganizationMembershipsTable = &schema.Table{
		Name:       "organization_memberships",
		Columns:    OrganizationMembershipsColumns,
		PrimaryKey: []*schema.Column{OrganizationMembershipsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "organization_memberships_organizations_memberships",
				Columns:    []*schema.Column{OrganizationMembershipsColumns[11]},
				RefColumns: []*schema.Column{OrganizationsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "organization_memberships_users_organization_memberships",
				Columns:    []*schema.Column{OrganizationMembershipsColumns[12]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "organizationmembership_organization_id_email",
				Unique:  true,
				Columns: []*schema.Column{OrganizationMembershipsColumns[11], OrganizationMembershipsColumns[1]},
			},
			{
				Name:    "organizationmembership_organization_id_status",
				Unique:  false,
				Columns: []*schema.Column{OrganizationMembershipsColumns[11], OrganizationMembershipsColumns[3]},
			},
			{
				Name:    "organizationmembership_user_id_status",
				Unique:  false,
				Columns: []*schema.Column{OrganizationMembershipsColumns[12], OrganizationMembershipsColumns[3]},
			},
		},
	}
	// ProjectsColumns holds the columns for the "projects" table.
	ProjectsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "name", Type: field.TypeString},
		{Name: "slug", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "status", Type: field.TypeString, Default: "Planned"},
		{Name: "github_outbound_credential", Type: field.TypeJSON, Nullable: true},
		{Name: "github_token_probe", Type: field.TypeJSON, Nullable: true},
		{Name: "project_ai_platform_access_allowed", Type: field.TypeJSON},
		{Name: "accessible_machine_ids", Type: field.TypeJSON},
		{Name: "max_concurrent_agents", Type: field.TypeInt, Default: 0},
		{Name: "agent_run_summary_prompt", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "project_ai_retention_enabled", Type: field.TypeBool, Default: false},
		{Name: "project_ai_retention_keep_latest_n", Type: field.TypeInt, Default: 0},
		{Name: "project_ai_retention_keep_recent_days", Type: field.TypeInt, Default: 0},
		{Name: "organization_id", Type: field.TypeUUID},
		{Name: "default_agent_provider_id", Type: field.TypeUUID, Nullable: true},
	}
	// ProjectsTable holds the schema information for the "projects" table.
	ProjectsTable = &schema.Table{
		Name:       "projects",
		Columns:    ProjectsColumns,
		PrimaryKey: []*schema.Column{ProjectsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "projects_organizations_projects",
				Columns:    []*schema.Column{ProjectsColumns[14]},
				RefColumns: []*schema.Column{OrganizationsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "projects_agent_providers_default_agent_provider",
				Columns:    []*schema.Column{ProjectsColumns[15]},
				RefColumns: []*schema.Column{AgentProvidersColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "project_organization_id_slug",
				Unique:  true,
				Columns: []*schema.Column{ProjectsColumns[14], ProjectsColumns[2]},
			},
		},
	}
	// ProjectConversationPrincipalsColumns holds the columns for the "project_conversation_principals" table.
	ProjectConversationPrincipalsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "conversation_id", Type: field.TypeUUID, Unique: true},
		{Name: "project_id", Type: field.TypeUUID},
		{Name: "provider_id", Type: field.TypeUUID},
		{Name: "name", Type: field.TypeString},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"active", "closed"}, Default: "active"},
		{Name: "runtime_state", Type: field.TypeEnum, Enums: []string{"inactive", "ready", "executing", "interrupted"}, Default: "inactive"},
		{Name: "current_session_id", Type: field.TypeString, Nullable: true},
		{Name: "current_workspace_path", Type: field.TypeString, Nullable: true},
		{Name: "current_run_id", Type: field.TypeUUID, Nullable: true},
		{Name: "last_heartbeat_at", Type: field.TypeTime, Nullable: true},
		{Name: "current_step_status", Type: field.TypeString, Nullable: true},
		{Name: "current_step_summary", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "current_step_changed_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "closed_at", Type: field.TypeTime, Nullable: true},
	}
	// ProjectConversationPrincipalsTable holds the schema information for the "project_conversation_principals" table.
	ProjectConversationPrincipalsTable = &schema.Table{
		Name:       "project_conversation_principals",
		Columns:    ProjectConversationPrincipalsColumns,
		PrimaryKey: []*schema.Column{ProjectConversationPrincipalsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "projectconversationprincipal_project_id_status",
				Unique:  false,
				Columns: []*schema.Column{ProjectConversationPrincipalsColumns[2], ProjectConversationPrincipalsColumns[5]},
			},
			{
				Name:    "projectconversationprincipal_project_id_runtime_state",
				Unique:  false,
				Columns: []*schema.Column{ProjectConversationPrincipalsColumns[2], ProjectConversationPrincipalsColumns[6]},
			},
			{
				Name:    "projectconversationprincipal_current_run_id",
				Unique:  false,
				Columns: []*schema.Column{ProjectConversationPrincipalsColumns[9]},
			},
		},
	}
	// ProjectConversationRunsColumns holds the columns for the "project_conversation_runs" table.
	ProjectConversationRunsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "principal_id", Type: field.TypeUUID},
		{Name: "conversation_id", Type: field.TypeUUID},
		{Name: "project_id", Type: field.TypeUUID},
		{Name: "provider_id", Type: field.TypeUUID},
		{Name: "turn_id", Type: field.TypeUUID, Nullable: true},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"launching", "executing", "interrupted", "completed", "failed", "terminated"}},
		{Name: "session_id", Type: field.TypeString, Nullable: true},
		{Name: "workspace_path", Type: field.TypeString, Nullable: true},
		{Name: "provider_thread_id", Type: field.TypeString, Nullable: true},
		{Name: "provider_turn_id", Type: field.TypeString, Nullable: true},
		{Name: "runtime_started_at", Type: field.TypeTime, Nullable: true},
		{Name: "terminal_at", Type: field.TypeTime, Nullable: true},
		{Name: "snapshot_materialized_at", Type: field.TypeTime, Nullable: true},
		{Name: "last_error", Type: field.TypeString, Nullable: true},
		{Name: "last_heartbeat_at", Type: field.TypeTime, Nullable: true},
		{Name: "cost_amount", Type: field.TypeFloat64, Default: 0},
		{Name: "input_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "output_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "cached_input_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "cache_creation_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "reasoning_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "prompt_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "candidate_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "tool_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "total_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "current_step_status", Type: field.TypeString, Nullable: true},
		{Name: "current_step_summary", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "current_step_changed_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
	}
	// ProjectConversationRunsTable holds the schema information for the "project_conversation_runs" table.
	ProjectConversationRunsTable = &schema.Table{
		Name:       "project_conversation_runs",
		Columns:    ProjectConversationRunsColumns,
		PrimaryKey: []*schema.Column{ProjectConversationRunsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "projectconversationrun_principal_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{ProjectConversationRunsColumns[1], ProjectConversationRunsColumns[29]},
			},
			{
				Name:    "projectconversationrun_conversation_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{ProjectConversationRunsColumns[2], ProjectConversationRunsColumns[29]},
			},
			{
				Name:    "projectconversationrun_status_last_heartbeat_at",
				Unique:  false,
				Columns: []*schema.Column{ProjectConversationRunsColumns[6], ProjectConversationRunsColumns[15]},
			},
			{
				Name:    "projectconversationrun_turn_id",
				Unique:  true,
				Columns: []*schema.Column{ProjectConversationRunsColumns[5]},
			},
		},
	}
	// ProjectConversationStepEventsColumns holds the columns for the "project_conversation_step_events" table.
	ProjectConversationStepEventsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "principal_id", Type: field.TypeUUID},
		{Name: "run_id", Type: field.TypeUUID},
		{Name: "conversation_id", Type: field.TypeUUID},
		{Name: "project_id", Type: field.TypeUUID},
		{Name: "step_status", Type: field.TypeString},
		{Name: "summary", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "source_trace_event_id", Type: field.TypeUUID, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
	}
	// ProjectConversationStepEventsTable holds the schema information for the "project_conversation_step_events" table.
	ProjectConversationStepEventsTable = &schema.Table{
		Name:       "project_conversation_step_events",
		Columns:    ProjectConversationStepEventsColumns,
		PrimaryKey: []*schema.Column{ProjectConversationStepEventsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "projectconversationstepevent_run_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{ProjectConversationStepEventsColumns[2], ProjectConversationStepEventsColumns[8]},
			},
			{
				Name:    "projectconversationstepevent_conversation_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{ProjectConversationStepEventsColumns[3], ProjectConversationStepEventsColumns[8]},
			},
			{
				Name:    "projectconversationstepevent_principal_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{ProjectConversationStepEventsColumns[1], ProjectConversationStepEventsColumns[8]},
			},
		},
	}
	// ProjectConversationTraceEventsColumns holds the columns for the "project_conversation_trace_events" table.
	ProjectConversationTraceEventsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "principal_id", Type: field.TypeUUID},
		{Name: "run_id", Type: field.TypeUUID},
		{Name: "conversation_id", Type: field.TypeUUID},
		{Name: "project_id", Type: field.TypeUUID},
		{Name: "sequence", Type: field.TypeInt64},
		{Name: "provider", Type: field.TypeString},
		{Name: "kind", Type: field.TypeString},
		{Name: "stream", Type: field.TypeString},
		{Name: "text", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "payload", Type: field.TypeJSON},
		{Name: "created_at", Type: field.TypeTime},
	}
	// ProjectConversationTraceEventsTable holds the schema information for the "project_conversation_trace_events" table.
	ProjectConversationTraceEventsTable = &schema.Table{
		Name:       "project_conversation_trace_events",
		Columns:    ProjectConversationTraceEventsColumns,
		PrimaryKey: []*schema.Column{ProjectConversationTraceEventsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "projectconversationtraceevent_run_id_sequence",
				Unique:  true,
				Columns: []*schema.Column{ProjectConversationTraceEventsColumns[2], ProjectConversationTraceEventsColumns[5]},
			},
			{
				Name:    "projectconversationtraceevent_conversation_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{ProjectConversationTraceEventsColumns[3], ProjectConversationTraceEventsColumns[11]},
			},
			{
				Name:    "projectconversationtraceevent_principal_id_created_at",
				Unique:  false,
				Columns: []*schema.Column{ProjectConversationTraceEventsColumns[1], ProjectConversationTraceEventsColumns[11]},
			},
		},
	}
	// ProjectDailyTokenUsagesColumns holds the columns for the "project_daily_token_usages" table.
	ProjectDailyTokenUsagesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "usage_date", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "date"}},
		{Name: "input_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "output_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "cached_input_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "reasoning_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "total_tokens", Type: field.TypeInt64, Default: 0},
		{Name: "finalized_run_count", Type: field.TypeInt, Default: 0},
		{Name: "recomputed_at", Type: field.TypeTime},
		{Name: "source_mode", Type: field.TypeEnum, Enums: []string{"materialized", "lazy_backfill"}, Default: "materialized"},
		{Name: "project_id", Type: field.TypeUUID},
	}
	// ProjectDailyTokenUsagesTable holds the schema information for the "project_daily_token_usages" table.
	ProjectDailyTokenUsagesTable = &schema.Table{
		Name:       "project_daily_token_usages",
		Columns:    ProjectDailyTokenUsagesColumns,
		PrimaryKey: []*schema.Column{ProjectDailyTokenUsagesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "project_daily_token_usages_projects_daily_token_usage",
				Columns:    []*schema.Column{ProjectDailyTokenUsagesColumns[10]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "projectdailytokenusage_project_id_usage_date",
				Unique:  true,
				Columns: []*schema.Column{ProjectDailyTokenUsagesColumns[10], ProjectDailyTokenUsagesColumns[1]},
			},
			{
				Name:    "projectdailytokenusage_usage_date",
				Unique:  false,
				Columns: []*schema.Column{ProjectDailyTokenUsagesColumns[1]},
			},
		},
	}
	// ProjectReposColumns holds the columns for the "project_repos" table.
	ProjectReposColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "name", Type: field.TypeString},
		{Name: "repository_url", Type: field.TypeString},
		{Name: "default_branch", Type: field.TypeString, Default: "main"},
		{Name: "workspace_dirname", Type: field.TypeString, Default: ""},
		{Name: "labels", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "text[]"}},
		{Name: "project_id", Type: field.TypeUUID},
	}
	// ProjectReposTable holds the schema information for the "project_repos" table.
	ProjectReposTable = &schema.Table{
		Name:       "project_repos",
		Columns:    ProjectReposColumns,
		PrimaryKey: []*schema.Column{ProjectReposColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "project_repos_projects_repos",
				Columns:    []*schema.Column{ProjectReposColumns[6]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "projectrepo_project_id_name",
				Unique:  true,
				Columns: []*schema.Column{ProjectReposColumns[6], ProjectReposColumns[1]},
			},
			{
				Name:    "projectrepo_labels",
				Unique:  false,
				Columns: []*schema.Column{ProjectReposColumns[5]},
				Annotation: &entsql.IndexAnnotation{
					Type: "GIN",
				},
			},
		},
	}
	// ProjectUpdateCommentsColumns holds the columns for the "project_update_comments" table.
	ProjectUpdateCommentsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "body_markdown", Type: field.TypeString, Size: 2147483647},
		{Name: "created_by", Type: field.TypeString},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "edited_at", Type: field.TypeTime, Nullable: true},
		{Name: "edit_count", Type: field.TypeInt, Default: 0},
		{Name: "last_edited_by", Type: field.TypeString, Nullable: true},
		{Name: "is_deleted", Type: field.TypeBool, Default: false},
		{Name: "deleted_at", Type: field.TypeTime, Nullable: true},
		{Name: "deleted_by", Type: field.TypeString, Nullable: true},
		{Name: "thread_id", Type: field.TypeUUID},
	}
	// ProjectUpdateCommentsTable holds the schema information for the "project_update_comments" table.
	ProjectUpdateCommentsTable = &schema.Table{
		Name:       "project_update_comments",
		Columns:    ProjectUpdateCommentsColumns,
		PrimaryKey: []*schema.Column{ProjectUpdateCommentsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "project_update_comments_project_update_threads_comments",
				Columns:    []*schema.Column{ProjectUpdateCommentsColumns[11]},
				RefColumns: []*schema.Column{ProjectUpdateThreadsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "projectupdatecomment_thread_id_created_at_id",
				Unique:  false,
				Columns: []*schema.Column{ProjectUpdateCommentsColumns[11], ProjectUpdateCommentsColumns[3], ProjectUpdateCommentsColumns[0]},
			},
		},
	}
	// ProjectUpdateCommentRevisionsColumns holds the columns for the "project_update_comment_revisions" table.
	ProjectUpdateCommentRevisionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "revision_number", Type: field.TypeInt},
		{Name: "body_markdown", Type: field.TypeString, Size: 2147483647},
		{Name: "edited_by", Type: field.TypeString},
		{Name: "edited_at", Type: field.TypeTime},
		{Name: "edit_reason", Type: field.TypeString, Nullable: true},
		{Name: "comment_id", Type: field.TypeUUID},
	}
	// ProjectUpdateCommentRevisionsTable holds the schema information for the "project_update_comment_revisions" table.
	ProjectUpdateCommentRevisionsTable = &schema.Table{
		Name:       "project_update_comment_revisions",
		Columns:    ProjectUpdateCommentRevisionsColumns,
		PrimaryKey: []*schema.Column{ProjectUpdateCommentRevisionsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "project_update_comment_revisions_project_update_comments_revisions",
				Columns:    []*schema.Column{ProjectUpdateCommentRevisionsColumns[6]},
				RefColumns: []*schema.Column{ProjectUpdateCommentsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "projectupdatecommentrevision_comment_id_revision_number",
				Unique:  true,
				Columns: []*schema.Column{ProjectUpdateCommentRevisionsColumns[6], ProjectUpdateCommentRevisionsColumns[1]},
			},
			{
				Name:    "projectupdatecommentrevision_comment_id_edited_at_id",
				Unique:  false,
				Columns: []*schema.Column{ProjectUpdateCommentRevisionsColumns[6], ProjectUpdateCommentRevisionsColumns[4], ProjectUpdateCommentRevisionsColumns[0]},
			},
		},
	}
	// ProjectUpdateThreadsColumns holds the columns for the "project_update_threads" table.
	ProjectUpdateThreadsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"on_track", "at_risk", "off_track"}},
		{Name: "title", Type: field.TypeString},
		{Name: "body_markdown", Type: field.TypeString, Size: 2147483647},
		{Name: "created_by", Type: field.TypeString},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "edited_at", Type: field.TypeTime, Nullable: true},
		{Name: "edit_count", Type: field.TypeInt, Default: 0},
		{Name: "last_edited_by", Type: field.TypeString, Nullable: true},
		{Name: "is_deleted", Type: field.TypeBool, Default: false},
		{Name: "deleted_at", Type: field.TypeTime, Nullable: true},
		{Name: "deleted_by", Type: field.TypeString, Nullable: true},
		{Name: "last_activity_at", Type: field.TypeTime},
		{Name: "comment_count", Type: field.TypeInt, Default: 0},
		{Name: "project_id", Type: field.TypeUUID},
	}
	// ProjectUpdateThreadsTable holds the schema information for the "project_update_threads" table.
	ProjectUpdateThreadsTable = &schema.Table{
		Name:       "project_update_threads",
		Columns:    ProjectUpdateThreadsColumns,
		PrimaryKey: []*schema.Column{ProjectUpdateThreadsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "project_update_threads_projects_update_threads",
				Columns:    []*schema.Column{ProjectUpdateThreadsColumns[15]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "projectupdatethread_project_id_last_activity_at_id",
				Unique:  false,
				Columns: []*schema.Column{ProjectUpdateThreadsColumns[15], ProjectUpdateThreadsColumns[13], ProjectUpdateThreadsColumns[0]},
			},
			{
				Name:    "projectupdatethread_project_id_created_at_id",
				Unique:  false,
				Columns: []*schema.Column{ProjectUpdateThreadsColumns[15], ProjectUpdateThreadsColumns[5], ProjectUpdateThreadsColumns[0]},
			},
		},
	}
	// ProjectUpdateThreadRevisionsColumns holds the columns for the "project_update_thread_revisions" table.
	ProjectUpdateThreadRevisionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "revision_number", Type: field.TypeInt},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"on_track", "at_risk", "off_track"}},
		{Name: "title", Type: field.TypeString},
		{Name: "body_markdown", Type: field.TypeString, Size: 2147483647},
		{Name: "edited_by", Type: field.TypeString},
		{Name: "edited_at", Type: field.TypeTime},
		{Name: "edit_reason", Type: field.TypeString, Nullable: true},
		{Name: "thread_id", Type: field.TypeUUID},
	}
	// ProjectUpdateThreadRevisionsTable holds the schema information for the "project_update_thread_revisions" table.
	ProjectUpdateThreadRevisionsTable = &schema.Table{
		Name:       "project_update_thread_revisions",
		Columns:    ProjectUpdateThreadRevisionsColumns,
		PrimaryKey: []*schema.Column{ProjectUpdateThreadRevisionsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "project_update_thread_revisions_project_update_threads_revisions",
				Columns:    []*schema.Column{ProjectUpdateThreadRevisionsColumns[8]},
				RefColumns: []*schema.Column{ProjectUpdateThreadsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "projectupdatethreadrevision_thread_id_revision_number",
				Unique:  true,
				Columns: []*schema.Column{ProjectUpdateThreadRevisionsColumns[8], ProjectUpdateThreadRevisionsColumns[1]},
			},
			{
				Name:    "projectupdatethreadrevision_thread_id_edited_at_id",
				Unique:  false,
				Columns: []*schema.Column{ProjectUpdateThreadRevisionsColumns[8], ProjectUpdateThreadRevisionsColumns[6], ProjectUpdateThreadRevisionsColumns[0]},
			},
		},
	}
	// RoleBindingsColumns holds the columns for the "role_bindings" table.
	RoleBindingsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "scope_kind", Type: field.TypeEnum, Enums: []string{"instance", "organization", "project"}},
		{Name: "scope_id", Type: field.TypeString, Default: ""},
		{Name: "subject_kind", Type: field.TypeEnum, Enums: []string{"user", "group"}},
		{Name: "subject_key", Type: field.TypeString},
		{Name: "role_key", Type: field.TypeString},
		{Name: "granted_by", Type: field.TypeString, Default: ""},
		{Name: "expires_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
	}
	// RoleBindingsTable holds the schema information for the "role_bindings" table.
	RoleBindingsTable = &schema.Table{
		Name:       "role_bindings",
		Columns:    RoleBindingsColumns,
		PrimaryKey: []*schema.Column{RoleBindingsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "rolebinding_scope_kind_scope_id_subject_kind_subject_key_role_key",
				Unique:  true,
				Columns: []*schema.Column{RoleBindingsColumns[1], RoleBindingsColumns[2], RoleBindingsColumns[3], RoleBindingsColumns[4], RoleBindingsColumns[5]},
			},
			{
				Name:    "rolebinding_subject_kind_subject_key",
				Unique:  false,
				Columns: []*schema.Column{RoleBindingsColumns[3], RoleBindingsColumns[4]},
			},
			{
				Name:    "rolebinding_scope_kind_scope_id",
				Unique:  false,
				Columns: []*schema.Column{RoleBindingsColumns[1], RoleBindingsColumns[2]},
			},
		},
	}
	// ScheduledJobsColumns holds the columns for the "scheduled_jobs" table.
	ScheduledJobsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "name", Type: field.TypeString},
		{Name: "cron_expression", Type: field.TypeString},
		{Name: "ticket_template", Type: field.TypeJSON},
		{Name: "is_enabled", Type: field.TypeBool, Default: true},
		{Name: "last_run_at", Type: field.TypeTime, Nullable: true},
		{Name: "next_run_at", Type: field.TypeTime, Nullable: true},
		{Name: "project_id", Type: field.TypeUUID},
		{Name: "workflow_id", Type: field.TypeUUID, Nullable: true},
	}
	// ScheduledJobsTable holds the schema information for the "scheduled_jobs" table.
	ScheduledJobsTable = &schema.Table{
		Name:       "scheduled_jobs",
		Columns:    ScheduledJobsColumns,
		PrimaryKey: []*schema.Column{ScheduledJobsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "scheduled_jobs_projects_scheduled_jobs",
				Columns:    []*schema.Column{ScheduledJobsColumns[7]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "scheduled_jobs_workflows_scheduled_jobs",
				Columns:    []*schema.Column{ScheduledJobsColumns[8]},
				RefColumns: []*schema.Column{WorkflowsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "scheduledjob_project_id_name",
				Unique:  true,
				Columns: []*schema.Column{ScheduledJobsColumns[7], ScheduledJobsColumns[1]},
			},
			{
				Name:    "scheduledjob_next_run_at",
				Unique:  false,
				Columns: []*schema.Column{ScheduledJobsColumns[6]},
				Annotation: &entsql.IndexAnnotation{
					Where: "is_enabled = true",
				},
			},
		},
	}
	// SecretsColumns holds the columns for the "secrets" table.
	SecretsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "organization_id", Type: field.TypeUUID},
		{Name: "project_id", Type: field.TypeUUID},
		{Name: "scope_kind", Type: field.TypeEnum, Enums: []string{"organization", "project"}},
		{Name: "name", Type: field.TypeString},
		{Name: "kind", Type: field.TypeEnum, Enums: []string{"opaque"}, Default: "opaque"},
		{Name: "description", Type: field.TypeString, Size: 2147483647, Default: ""},
		{Name: "algorithm", Type: field.TypeString},
		{Name: "key_source", Type: field.TypeString},
		{Name: "key_id", Type: field.TypeString},
		{Name: "value_preview", Type: field.TypeString},
		{Name: "nonce", Type: field.TypeString},
		{Name: "ciphertext", Type: field.TypeString, Size: 2147483647},
		{Name: "rotated_at", Type: field.TypeTime},
		{Name: "disabled_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
	}
	// SecretsTable holds the schema information for the "secrets" table.
	SecretsTable = &schema.Table{
		Name:       "secrets",
		Columns:    SecretsColumns,
		PrimaryKey: []*schema.Column{SecretsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "secret_organization_id_scope_kind_project_id_name",
				Unique:  true,
				Columns: []*schema.Column{SecretsColumns[1], SecretsColumns[3], SecretsColumns[2], SecretsColumns[4]},
			},
			{
				Name:    "secret_organization_id_project_id_scope_kind_disabled_at",
				Unique:  false,
				Columns: []*schema.Column{SecretsColumns[1], SecretsColumns[2], SecretsColumns[3], SecretsColumns[14]},
			},
		},
	}
	// SecretBindingsColumns holds the columns for the "secret_bindings" table.
	SecretBindingsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "organization_id", Type: field.TypeUUID},
		{Name: "project_id", Type: field.TypeUUID},
		{Name: "scope_kind", Type: field.TypeEnum, Enums: []string{"organization", "project", "workflow", "agent", "ticket"}},
		{Name: "scope_resource_id", Type: field.TypeUUID},
		{Name: "binding_key", Type: field.TypeString},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "secret_id", Type: field.TypeUUID},
	}
	// SecretBindingsTable holds the schema information for the "secret_bindings" table.
	SecretBindingsTable = &schema.Table{
		Name:       "secret_bindings",
		Columns:    SecretBindingsColumns,
		PrimaryKey: []*schema.Column{SecretBindingsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "secret_bindings_secrets_bindings",
				Columns:    []*schema.Column{SecretBindingsColumns[8]},
				RefColumns: []*schema.Column{SecretsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "secretbinding_scope_kind_scope_resource_id_binding_key",
				Unique:  true,
				Columns: []*schema.Column{SecretBindingsColumns[3], SecretBindingsColumns[4], SecretBindingsColumns[5]},
			},
			{
				Name:    "secretbinding_organization_id_project_id_binding_key",
				Unique:  false,
				Columns: []*schema.Column{SecretBindingsColumns[1], SecretBindingsColumns[2], SecretBindingsColumns[5]},
			},
			{
				Name:    "secretbinding_secret_id",
				Unique:  false,
				Columns: []*schema.Column{SecretBindingsColumns[8]},
			},
		},
	}
	// SkillsColumns holds the columns for the "skills" table.
	SkillsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "name", Type: field.TypeString},
		{Name: "description", Type: field.TypeString},
		{Name: "is_builtin", Type: field.TypeBool, Default: false},
		{Name: "is_enabled", Type: field.TypeBool, Default: true},
		{Name: "created_by", Type: field.TypeString, Default: "user:manual"},
		{Name: "archived_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "project_id", Type: field.TypeUUID},
		{Name: "current_version_id", Type: field.TypeUUID, Nullable: true},
	}
	// SkillsTable holds the schema information for the "skills" table.
	SkillsTable = &schema.Table{
		Name:       "skills",
		Columns:    SkillsColumns,
		PrimaryKey: []*schema.Column{SkillsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "skills_projects_skills",
				Columns:    []*schema.Column{SkillsColumns[9]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "skills_skill_versions_current_version",
				Columns:    []*schema.Column{SkillsColumns[10]},
				RefColumns: []*schema.Column{SkillVersionsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "skill_project_id_name",
				Unique:  true,
				Columns: []*schema.Column{SkillsColumns[9], SkillsColumns[1]},
			},
			{
				Name:    "skill_project_id_archived_at",
				Unique:  false,
				Columns: []*schema.Column{SkillsColumns[9], SkillsColumns[6]},
			},
		},
	}
	// SkillBlobsColumns holds the columns for the "skill_blobs" table.
	SkillBlobsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "sha256", Type: field.TypeString},
		{Name: "size_bytes", Type: field.TypeInt64, Default: 0},
		{Name: "compression", Type: field.TypeEnum, Enums: []string{"none", "gzip"}, Default: "none"},
		{Name: "content_bytes", Type: field.TypeBytes},
		{Name: "created_at", Type: field.TypeTime},
	}
	// SkillBlobsTable holds the schema information for the "skill_blobs" table.
	SkillBlobsTable = &schema.Table{
		Name:       "skill_blobs",
		Columns:    SkillBlobsColumns,
		PrimaryKey: []*schema.Column{SkillBlobsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "skillblob_sha256",
				Unique:  true,
				Columns: []*schema.Column{SkillBlobsColumns[1]},
			},
		},
	}
	// SkillVersionsColumns holds the columns for the "skill_versions" table.
	SkillVersionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "version", Type: field.TypeInt},
		{Name: "content_markdown", Type: field.TypeString, Size: 2147483647},
		{Name: "content_hash", Type: field.TypeString},
		{Name: "bundle_hash", Type: field.TypeString, Nullable: true},
		{Name: "manifest_json", Type: field.TypeJSON},
		{Name: "size_bytes", Type: field.TypeInt64, Default: 0},
		{Name: "file_count", Type: field.TypeInt, Default: 0},
		{Name: "created_by", Type: field.TypeString, Default: "system:workflow-service"},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "skill_id", Type: field.TypeUUID},
	}
	// SkillVersionsTable holds the schema information for the "skill_versions" table.
	SkillVersionsTable = &schema.Table{
		Name:       "skill_versions",
		Columns:    SkillVersionsColumns,
		PrimaryKey: []*schema.Column{SkillVersionsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "skill_versions_skills_versions",
				Columns:    []*schema.Column{SkillVersionsColumns[10]},
				RefColumns: []*schema.Column{SkillsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "skillversion_skill_id_version",
				Unique:  true,
				Columns: []*schema.Column{SkillVersionsColumns[10], SkillVersionsColumns[1]},
			},
		},
	}
	// SkillVersionFilesColumns holds the columns for the "skill_version_files" table.
	SkillVersionFilesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "path", Type: field.TypeString},
		{Name: "file_kind", Type: field.TypeEnum, Enums: []string{"entrypoint", "metadata", "script", "reference", "asset"}, Default: "asset"},
		{Name: "media_type", Type: field.TypeString, Default: "application/octet-stream"},
		{Name: "encoding", Type: field.TypeEnum, Enums: []string{"utf8", "base64", "binary"}, Default: "binary"},
		{Name: "is_executable", Type: field.TypeBool, Default: false},
		{Name: "size_bytes", Type: field.TypeInt64, Default: 0},
		{Name: "sha256", Type: field.TypeString},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "content_blob_id", Type: field.TypeUUID},
		{Name: "skill_version_id", Type: field.TypeUUID},
	}
	// SkillVersionFilesTable holds the schema information for the "skill_version_files" table.
	SkillVersionFilesTable = &schema.Table{
		Name:       "skill_version_files",
		Columns:    SkillVersionFilesColumns,
		PrimaryKey: []*schema.Column{SkillVersionFilesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "skill_version_files_skill_blobs_files",
				Columns:    []*schema.Column{SkillVersionFilesColumns[9]},
				RefColumns: []*schema.Column{SkillBlobsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "skill_version_files_skill_versions_files",
				Columns:    []*schema.Column{SkillVersionFilesColumns[10]},
				RefColumns: []*schema.Column{SkillVersionsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "skillversionfile_skill_version_id_path",
				Unique:  true,
				Columns: []*schema.Column{SkillVersionFilesColumns[10], SkillVersionFilesColumns[1]},
			},
			{
				Name:    "skillversionfile_content_blob_id",
				Unique:  false,
				Columns: []*schema.Column{SkillVersionFilesColumns[9]},
			},
		},
	}
	// TicketsColumns holds the columns for the "tickets" table.
	TicketsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "identifier", Type: field.TypeString},
		{Name: "title", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "archived", Type: field.TypeBool, Default: false},
		{Name: "priority", Type: field.TypeEnum, Nullable: true, Enums: []string{"urgent", "high", "medium", "low"}},
		{Name: "type", Type: field.TypeEnum, Enums: []string{"feature", "bugfix", "refactor", "chore", "epic"}, Default: "feature"},
		{Name: "created_by", Type: field.TypeString},
		{Name: "external_ref", Type: field.TypeString, Nullable: true},
		{Name: "attempt_count", Type: field.TypeInt, Default: 0},
		{Name: "consecutive_errors", Type: field.TypeInt, Default: 0},
		{Name: "next_retry_at", Type: field.TypeTime, Nullable: true},
		{Name: "retry_paused", Type: field.TypeBool, Default: false},
		{Name: "pause_reason", Type: field.TypeString, Nullable: true},
		{Name: "stall_count", Type: field.TypeInt, Default: 0},
		{Name: "retry_token", Type: field.TypeString, Nullable: true},
		{Name: "harness_version", Type: field.TypeInt, Default: 0},
		{Name: "budget_usd", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "numeric(18,6)"}},
		{Name: "cost_tokens_input", Type: field.TypeInt64, Default: 0},
		{Name: "cost_tokens_output", Type: field.TypeInt64, Default: 0},
		{Name: "cost_amount", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "numeric(18,6)"}},
		{Name: "metadata", Type: field.TypeJSON},
		{Name: "started_at", Type: field.TypeTime, Nullable: true},
		{Name: "completed_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "current_run_id", Type: field.TypeUUID, Nullable: true},
		{Name: "target_machine_id", Type: field.TypeUUID, Nullable: true},
		{Name: "project_id", Type: field.TypeUUID},
		{Name: "parent_ticket_id", Type: field.TypeUUID, Nullable: true},
		{Name: "status_id", Type: field.TypeUUID},
		{Name: "workflow_id", Type: field.TypeUUID, Nullable: true},
	}
	// TicketsTable holds the schema information for the "tickets" table.
	TicketsTable = &schema.Table{
		Name:       "tickets",
		Columns:    TicketsColumns,
		PrimaryKey: []*schema.Column{TicketsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "tickets_agent_runs_current_for_ticket",
				Columns:    []*schema.Column{TicketsColumns[25]},
				RefColumns: []*schema.Column{AgentRunsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "tickets_machines_target_tickets",
				Columns:    []*schema.Column{TicketsColumns[26]},
				RefColumns: []*schema.Column{MachinesColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "tickets_projects_tickets",
				Columns:    []*schema.Column{TicketsColumns[27]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "tickets_tickets_children",
				Columns:    []*schema.Column{TicketsColumns[28]},
				RefColumns: []*schema.Column{TicketsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "tickets_ticket_status_tickets",
				Columns:    []*schema.Column{TicketsColumns[29]},
				RefColumns: []*schema.Column{TicketStatusColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "tickets_workflows_tickets",
				Columns:    []*schema.Column{TicketsColumns[30]},
				RefColumns: []*schema.Column{WorkflowsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "ticket_project_id_identifier",
				Unique:  true,
				Columns: []*schema.Column{TicketsColumns[27], TicketsColumns[1]},
			},
			{
				Name:    "ticket_project_id_status_id_current_run_id_priority_created_at",
				Unique:  false,
				Columns: []*schema.Column{TicketsColumns[27], TicketsColumns[29], TicketsColumns[25], TicketsColumns[5], TicketsColumns[24]},
			},
			{
				Name:    "ticket_project_id_status_id",
				Unique:  false,
				Columns: []*schema.Column{TicketsColumns[27], TicketsColumns[29]},
			},
			{
				Name:    "ticket_project_id_archived_created_at",
				Unique:  false,
				Columns: []*schema.Column{TicketsColumns[27], TicketsColumns[4], TicketsColumns[24]},
			},
			{
				Name:    "ticket_project_id_external_ref",
				Unique:  false,
				Columns: []*schema.Column{TicketsColumns[27], TicketsColumns[8]},
			},
		},
	}
	// TicketCommentsColumns holds the columns for the "ticket_comments" table.
	TicketCommentsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "body", Type: field.TypeString, Size: 2147483647},
		{Name: "created_by", Type: field.TypeString},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "edited_at", Type: field.TypeTime, Nullable: true},
		{Name: "edit_count", Type: field.TypeInt, Default: 0},
		{Name: "last_edited_by", Type: field.TypeString, Nullable: true},
		{Name: "is_deleted", Type: field.TypeBool, Default: false},
		{Name: "deleted_at", Type: field.TypeTime, Nullable: true},
		{Name: "deleted_by", Type: field.TypeString, Nullable: true},
		{Name: "ticket_id", Type: field.TypeUUID},
	}
	// TicketCommentsTable holds the schema information for the "ticket_comments" table.
	TicketCommentsTable = &schema.Table{
		Name:       "ticket_comments",
		Columns:    TicketCommentsColumns,
		PrimaryKey: []*schema.Column{TicketCommentsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "ticket_comments_tickets_comments",
				Columns:    []*schema.Column{TicketCommentsColumns[11]},
				RefColumns: []*schema.Column{TicketsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "ticketcomment_ticket_id_created_at_id",
				Unique:  false,
				Columns: []*schema.Column{TicketCommentsColumns[11], TicketCommentsColumns[3], TicketCommentsColumns[0]},
			},
		},
	}
	// TicketCommentRevisionsColumns holds the columns for the "ticket_comment_revisions" table.
	TicketCommentRevisionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "revision_number", Type: field.TypeInt},
		{Name: "body_markdown", Type: field.TypeString, Size: 2147483647},
		{Name: "edited_by", Type: field.TypeString},
		{Name: "edited_at", Type: field.TypeTime},
		{Name: "edit_reason", Type: field.TypeString, Nullable: true},
		{Name: "comment_id", Type: field.TypeUUID},
	}
	// TicketCommentRevisionsTable holds the schema information for the "ticket_comment_revisions" table.
	TicketCommentRevisionsTable = &schema.Table{
		Name:       "ticket_comment_revisions",
		Columns:    TicketCommentRevisionsColumns,
		PrimaryKey: []*schema.Column{TicketCommentRevisionsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "ticket_comment_revisions_ticket_comments_revisions",
				Columns:    []*schema.Column{TicketCommentRevisionsColumns[6]},
				RefColumns: []*schema.Column{TicketCommentsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "ticketcommentrevision_comment_id_revision_number",
				Unique:  true,
				Columns: []*schema.Column{TicketCommentRevisionsColumns[6], TicketCommentRevisionsColumns[1]},
			},
			{
				Name:    "ticketcommentrevision_comment_id_edited_at_id",
				Unique:  false,
				Columns: []*schema.Column{TicketCommentRevisionsColumns[6], TicketCommentRevisionsColumns[4], TicketCommentRevisionsColumns[0]},
			},
		},
	}
	// TicketDependenciesColumns holds the columns for the "ticket_dependencies" table.
	TicketDependenciesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "type", Type: field.TypeEnum, Enums: []string{"blocks", "sub-issue"}, Default: "blocks"},
		{Name: "source_ticket_id", Type: field.TypeUUID},
		{Name: "target_ticket_id", Type: field.TypeUUID},
	}
	// TicketDependenciesTable holds the schema information for the "ticket_dependencies" table.
	TicketDependenciesTable = &schema.Table{
		Name:       "ticket_dependencies",
		Columns:    TicketDependenciesColumns,
		PrimaryKey: []*schema.Column{TicketDependenciesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "ticket_dependencies_tickets_outgoing_dependencies",
				Columns:    []*schema.Column{TicketDependenciesColumns[2]},
				RefColumns: []*schema.Column{TicketsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "ticket_dependencies_tickets_incoming_dependencies",
				Columns:    []*schema.Column{TicketDependenciesColumns[3]},
				RefColumns: []*schema.Column{TicketsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "ticketdependency_source_ticket_id_target_ticket_id_type",
				Unique:  true,
				Columns: []*schema.Column{TicketDependenciesColumns[2], TicketDependenciesColumns[3], TicketDependenciesColumns[1]},
			},
			{
				Name:    "ticketdependency_target_ticket_id_type",
				Unique:  false,
				Columns: []*schema.Column{TicketDependenciesColumns[3], TicketDependenciesColumns[1]},
			},
			{
				Name:    "ticketdependency_source_ticket_id",
				Unique:  false,
				Columns: []*schema.Column{TicketDependenciesColumns[2]},
			},
		},
	}
	// TicketExternalLinksColumns holds the columns for the "ticket_external_links" table.
	TicketExternalLinksColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "link_type", Type: field.TypeString, Nullable: true},
		{Name: "url", Type: field.TypeString},
		{Name: "external_id", Type: field.TypeString},
		{Name: "title", Type: field.TypeString, Nullable: true},
		{Name: "status", Type: field.TypeString, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "ticket_id", Type: field.TypeUUID},
	}
	// TicketExternalLinksTable holds the schema information for the "ticket_external_links" table.
	TicketExternalLinksTable = &schema.Table{
		Name:       "ticket_external_links",
		Columns:    TicketExternalLinksColumns,
		PrimaryKey: []*schema.Column{TicketExternalLinksColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "ticket_external_links_tickets_external_links",
				Columns:    []*schema.Column{TicketExternalLinksColumns[7]},
				RefColumns: []*schema.Column{TicketsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "ticketexternallink_ticket_id_external_id",
				Unique:  true,
				Columns: []*schema.Column{TicketExternalLinksColumns[7], TicketExternalLinksColumns[3]},
			},
			{
				Name:    "ticketexternallink_external_id",
				Unique:  false,
				Columns: []*schema.Column{TicketExternalLinksColumns[3]},
			},
		},
	}
	// TicketRepoScopesColumns holds the columns for the "ticket_repo_scopes" table.
	TicketRepoScopesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "branch_name", Type: field.TypeString},
		{Name: "pull_request_url", Type: field.TypeString, Nullable: true},
		{Name: "pr_status", Type: field.TypeEnum, Enums: []string{"none", "open", "changes_requested", "approved", "merged", "closed"}, Default: "none"},
		{Name: "ci_status", Type: field.TypeEnum, Enums: []string{"pending", "passing", "failing"}, Default: "pending"},
		{Name: "repo_id", Type: field.TypeUUID},
		{Name: "ticket_id", Type: field.TypeUUID},
	}
	// TicketRepoScopesTable holds the schema information for the "ticket_repo_scopes" table.
	TicketRepoScopesTable = &schema.Table{
		Name:       "ticket_repo_scopes",
		Columns:    TicketRepoScopesColumns,
		PrimaryKey: []*schema.Column{TicketRepoScopesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "ticket_repo_scopes_project_repos_ticket_scopes",
				Columns:    []*schema.Column{TicketRepoScopesColumns[5]},
				RefColumns: []*schema.Column{ProjectReposColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "ticket_repo_scopes_tickets_repo_scopes",
				Columns:    []*schema.Column{TicketRepoScopesColumns[6]},
				RefColumns: []*schema.Column{TicketsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "ticketreposcope_ticket_id_repo_id",
				Unique:  true,
				Columns: []*schema.Column{TicketRepoScopesColumns[6], TicketRepoScopesColumns[5]},
			},
			{
				Name:    "ticketreposcope_repo_id_branch_name",
				Unique:  false,
				Columns: []*schema.Column{TicketRepoScopesColumns[5], TicketRepoScopesColumns[1]},
			},
			{
				Name:    "ticketreposcope_ticket_id",
				Unique:  false,
				Columns: []*schema.Column{TicketRepoScopesColumns[6]},
			},
		},
	}
	// TicketRepoWorkspacesColumns holds the columns for the "ticket_repo_workspaces" table.
	TicketRepoWorkspacesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "workspace_root", Type: field.TypeString},
		{Name: "repo_path", Type: field.TypeString},
		{Name: "branch_name", Type: field.TypeString},
		{Name: "state", Type: field.TypeEnum, Enums: []string{"planned", "materializing", "ready", "dirty", "verifying", "completed", "failed", "cleaning", "cleaned"}, Default: "planned"},
		{Name: "head_commit", Type: field.TypeString, Nullable: true},
		{Name: "last_error", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "prepared_at", Type: field.TypeTime, Nullable: true},
		{Name: "cleaned_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
		{Name: "agent_run_id", Type: field.TypeUUID},
		{Name: "repo_id", Type: field.TypeUUID},
		{Name: "ticket_id", Type: field.TypeUUID},
	}
	// TicketRepoWorkspacesTable holds the schema information for the "ticket_repo_workspaces" table.
	TicketRepoWorkspacesTable = &schema.Table{
		Name:       "ticket_repo_workspaces",
		Columns:    TicketRepoWorkspacesColumns,
		PrimaryKey: []*schema.Column{TicketRepoWorkspacesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "ticket_repo_workspaces_agent_runs_ticket_repo_workspaces",
				Columns:    []*schema.Column{TicketRepoWorkspacesColumns[11]},
				RefColumns: []*schema.Column{AgentRunsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "ticket_repo_workspaces_project_repos_ticket_repo_workspaces",
				Columns:    []*schema.Column{TicketRepoWorkspacesColumns[12]},
				RefColumns: []*schema.Column{ProjectReposColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "ticket_repo_workspaces_tickets_repo_workspaces",
				Columns:    []*schema.Column{TicketRepoWorkspacesColumns[13]},
				RefColumns: []*schema.Column{TicketsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "ticketrepoworkspace_agent_run_id_repo_id",
				Unique:  true,
				Columns: []*schema.Column{TicketRepoWorkspacesColumns[11], TicketRepoWorkspacesColumns[12]},
			},
			{
				Name:    "ticketrepoworkspace_ticket_id_state",
				Unique:  false,
				Columns: []*schema.Column{TicketRepoWorkspacesColumns[13], TicketRepoWorkspacesColumns[4]},
			},
		},
	}
	// TicketStatusColumns holds the columns for the "ticket_status" table.
	TicketStatusColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "name", Type: field.TypeString},
		{Name: "stage", Type: field.TypeEnum, Enums: []string{"backlog", "unstarted", "started", "completed", "canceled"}, Default: "unstarted"},
		{Name: "color", Type: field.TypeString},
		{Name: "icon", Type: field.TypeString, Nullable: true},
		{Name: "position", Type: field.TypeInt, Default: 0},
		{Name: "max_active_runs", Type: field.TypeInt, Nullable: true},
		{Name: "is_default", Type: field.TypeBool, Default: false},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "project_id", Type: field.TypeUUID},
	}
	// TicketStatusTable holds the schema information for the "ticket_status" table.
	TicketStatusTable = &schema.Table{
		Name:       "ticket_status",
		Columns:    TicketStatusColumns,
		PrimaryKey: []*schema.Column{TicketStatusColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "ticket_status_projects_statuses",
				Columns:    []*schema.Column{TicketStatusColumns[9]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "ticketstatus_project_id_name",
				Unique:  true,
				Columns: []*schema.Column{TicketStatusColumns[9], TicketStatusColumns[1]},
			},
			{
				Name:    "ticketstatus_project_id_position",
				Unique:  false,
				Columns: []*schema.Column{TicketStatusColumns[9], TicketStatusColumns[5]},
			},
		},
	}
	// UsersColumns holds the columns for the "users" table.
	UsersColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "status", Type: field.TypeEnum, Enums: []string{"active", "disabled"}, Default: "active"},
		{Name: "primary_email", Type: field.TypeString, Default: ""},
		{Name: "display_name", Type: field.TypeString, Default: ""},
		{Name: "avatar_url", Type: field.TypeString, Default: ""},
		{Name: "last_login_at", Type: field.TypeTime, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
	}
	// UsersTable holds the schema information for the "users" table.
	UsersTable = &schema.Table{
		Name:       "users",
		Columns:    UsersColumns,
		PrimaryKey: []*schema.Column{UsersColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "user_primary_email",
				Unique:  false,
				Columns: []*schema.Column{UsersColumns[2]},
			},
		},
	}
	// UserGroupMembershipsColumns holds the columns for the "user_group_memberships" table.
	UserGroupMembershipsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "user_id", Type: field.TypeUUID},
		{Name: "issuer", Type: field.TypeString},
		{Name: "group_key", Type: field.TypeString},
		{Name: "group_name", Type: field.TypeString, Default: ""},
		{Name: "last_synced_at", Type: field.TypeTime},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
	}
	// UserGroupMembershipsTable holds the schema information for the "user_group_memberships" table.
	UserGroupMembershipsTable = &schema.Table{
		Name:       "user_group_memberships",
		Columns:    UserGroupMembershipsColumns,
		PrimaryKey: []*schema.Column{UserGroupMembershipsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "usergroupmembership_user_id_issuer_group_key",
				Unique:  true,
				Columns: []*schema.Column{UserGroupMembershipsColumns[1], UserGroupMembershipsColumns[2], UserGroupMembershipsColumns[3]},
			},
			{
				Name:    "usergroupmembership_group_key",
				Unique:  false,
				Columns: []*schema.Column{UserGroupMembershipsColumns[3]},
			},
		},
	}
	// UserIdentitiesColumns holds the columns for the "user_identities" table.
	UserIdentitiesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "user_id", Type: field.TypeUUID},
		{Name: "issuer", Type: field.TypeString},
		{Name: "subject", Type: field.TypeString},
		{Name: "email", Type: field.TypeString, Default: ""},
		{Name: "email_verified", Type: field.TypeBool, Default: false},
		{Name: "claims_version", Type: field.TypeInt, Default: 1},
		{Name: "raw_claims_json", Type: field.TypeString, Size: 2147483647, Default: "{}"},
		{Name: "last_synced_at", Type: field.TypeTime},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
	}
	// UserIdentitiesTable holds the schema information for the "user_identities" table.
	UserIdentitiesTable = &schema.Table{
		Name:       "user_identities",
		Columns:    UserIdentitiesColumns,
		PrimaryKey: []*schema.Column{UserIdentitiesColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "useridentity_issuer_subject",
				Unique:  true,
				Columns: []*schema.Column{UserIdentitiesColumns[2], UserIdentitiesColumns[3]},
			},
			{
				Name:    "useridentity_user_id",
				Unique:  false,
				Columns: []*schema.Column{UserIdentitiesColumns[1]},
			},
			{
				Name:    "useridentity_email",
				Unique:  false,
				Columns: []*schema.Column{UserIdentitiesColumns[4]},
			},
		},
	}
	// WorkflowsColumns holds the columns for the "workflows" table.
	WorkflowsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "name", Type: field.TypeString},
		{Name: "type", Type: field.TypeString},
		{Name: "role_slug", Type: field.TypeString, Nullable: true},
		{Name: "role_name", Type: field.TypeString, Nullable: true},
		{Name: "role_description", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "platform_access_allowed", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "text[]"}},
		{Name: "harness_path", Type: field.TypeString},
		{Name: "hooks", Type: field.TypeJSON},
		{Name: "max_concurrent", Type: field.TypeInt, Default: 0},
		{Name: "max_retry_attempts", Type: field.TypeInt, Default: 3},
		{Name: "timeout_minutes", Type: field.TypeInt, Default: 60},
		{Name: "stall_timeout_minutes", Type: field.TypeInt, Default: 5},
		{Name: "version", Type: field.TypeInt, Default: 1},
		{Name: "is_active", Type: field.TypeBool, Default: true},
		{Name: "agent_id", Type: field.TypeUUID, Nullable: true},
		{Name: "project_id", Type: field.TypeUUID},
		{Name: "current_version_id", Type: field.TypeUUID, Nullable: true},
	}
	// WorkflowsTable holds the schema information for the "workflows" table.
	WorkflowsTable = &schema.Table{
		Name:       "workflows",
		Columns:    WorkflowsColumns,
		PrimaryKey: []*schema.Column{WorkflowsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "workflows_agents_workflows",
				Columns:    []*schema.Column{WorkflowsColumns[15]},
				RefColumns: []*schema.Column{AgentsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "workflows_projects_workflows",
				Columns:    []*schema.Column{WorkflowsColumns[16]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "workflows_workflow_versions_current_version",
				Columns:    []*schema.Column{WorkflowsColumns[17]},
				RefColumns: []*schema.Column{WorkflowVersionsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "workflow_project_id_name",
				Unique:  true,
				Columns: []*schema.Column{WorkflowsColumns[16], WorkflowsColumns[1]},
			},
			{
				Name:    "workflow_project_id_is_active",
				Unique:  false,
				Columns: []*schema.Column{WorkflowsColumns[16], WorkflowsColumns[14]},
			},
		},
	}
	// WorkflowSkillBindingsColumns holds the columns for the "workflow_skill_bindings" table.
	WorkflowSkillBindingsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "skill_id", Type: field.TypeUUID},
		{Name: "required_version_id", Type: field.TypeUUID, Nullable: true},
		{Name: "workflow_id", Type: field.TypeUUID},
	}
	// WorkflowSkillBindingsTable holds the schema information for the "workflow_skill_bindings" table.
	WorkflowSkillBindingsTable = &schema.Table{
		Name:       "workflow_skill_bindings",
		Columns:    WorkflowSkillBindingsColumns,
		PrimaryKey: []*schema.Column{WorkflowSkillBindingsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "workflow_skill_bindings_skills_workflow_bindings",
				Columns:    []*schema.Column{WorkflowSkillBindingsColumns[2]},
				RefColumns: []*schema.Column{SkillsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "workflow_skill_bindings_skill_versions_required_by_bindings",
				Columns:    []*schema.Column{WorkflowSkillBindingsColumns[3]},
				RefColumns: []*schema.Column{SkillVersionsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "workflow_skill_bindings_workflows_skill_bindings",
				Columns:    []*schema.Column{WorkflowSkillBindingsColumns[4]},
				RefColumns: []*schema.Column{WorkflowsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "workflowskillbinding_workflow_id_skill_id",
				Unique:  true,
				Columns: []*schema.Column{WorkflowSkillBindingsColumns[4], WorkflowSkillBindingsColumns[2]},
			},
			{
				Name:    "workflowskillbinding_skill_id_workflow_id",
				Unique:  false,
				Columns: []*schema.Column{WorkflowSkillBindingsColumns[2], WorkflowSkillBindingsColumns[4]},
			},
		},
	}
	// WorkflowVersionsColumns holds the columns for the "workflow_versions" table.
	WorkflowVersionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "version", Type: field.TypeInt},
		{Name: "content_markdown", Type: field.TypeString, Size: 2147483647},
		{Name: "name", Type: field.TypeString},
		{Name: "type", Type: field.TypeString},
		{Name: "role_slug", Type: field.TypeString, Nullable: true},
		{Name: "role_name", Type: field.TypeString, Nullable: true},
		{Name: "role_description", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "pickup_status_ids", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "text[]"}},
		{Name: "finish_status_ids", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "text[]"}},
		{Name: "harness_path", Type: field.TypeString},
		{Name: "hooks", Type: field.TypeJSON},
		{Name: "platform_access_allowed", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "text[]"}},
		{Name: "max_concurrent", Type: field.TypeInt, Default: 0},
		{Name: "max_retry_attempts", Type: field.TypeInt, Default: 3},
		{Name: "timeout_minutes", Type: field.TypeInt, Default: 60},
		{Name: "stall_timeout_minutes", Type: field.TypeInt, Default: 5},
		{Name: "is_active", Type: field.TypeBool, Default: true},
		{Name: "content_hash", Type: field.TypeString},
		{Name: "created_by", Type: field.TypeString, Default: "system:workflow-service"},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "workflow_id", Type: field.TypeUUID},
	}
	// WorkflowVersionsTable holds the schema information for the "workflow_versions" table.
	WorkflowVersionsTable = &schema.Table{
		Name:       "workflow_versions",
		Columns:    WorkflowVersionsColumns,
		PrimaryKey: []*schema.Column{WorkflowVersionsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "workflow_versions_workflows_versions",
				Columns:    []*schema.Column{WorkflowVersionsColumns[21]},
				RefColumns: []*schema.Column{WorkflowsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "workflowversion_workflow_id_version",
				Unique:  true,
				Columns: []*schema.Column{WorkflowVersionsColumns[21], WorkflowVersionsColumns[1]},
			},
		},
	}
	// WorkspaceInitLeasesColumns holds the columns for the "workspace_init_leases" table.
	WorkspaceInitLeasesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeUUID},
		{Name: "lease_key", Type: field.TypeString},
		{Name: "machine_id", Type: field.TypeUUID},
		{Name: "owner_run_id", Type: field.TypeUUID},
		{Name: "lease_expires_at", Type: field.TypeTime},
		{Name: "heartbeat_at", Type: field.TypeTime},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "updated_at", Type: field.TypeTime},
	}
	// WorkspaceInitLeasesTable holds the schema information for the "workspace_init_leases" table.
	WorkspaceInitLeasesTable = &schema.Table{
		Name:       "workspace_init_leases",
		Columns:    WorkspaceInitLeasesColumns,
		PrimaryKey: []*schema.Column{WorkspaceInitLeasesColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "workspaceinitlease_lease_key",
				Unique:  true,
				Columns: []*schema.Column{WorkspaceInitLeasesColumns[1]},
			},
			{
				Name:    "workspaceinitlease_machine_id",
				Unique:  false,
				Columns: []*schema.Column{WorkspaceInitLeasesColumns[2]},
			},
			{
				Name:    "workspaceinitlease_owner_run_id",
				Unique:  false,
				Columns: []*schema.Column{WorkspaceInitLeasesColumns[3]},
			},
			{
				Name:    "workspaceinitlease_lease_expires_at",
				Unique:  false,
				Columns: []*schema.Column{WorkspaceInitLeasesColumns[4]},
			},
		},
	}
	// WorkflowPickupStatusesColumns holds the columns for the "workflow_pickup_statuses" table.
	WorkflowPickupStatusesColumns = []*schema.Column{
		{Name: "workflow_id", Type: field.TypeUUID},
		{Name: "ticket_status_id", Type: field.TypeUUID},
	}
	// WorkflowPickupStatusesTable holds the schema information for the "workflow_pickup_statuses" table.
	WorkflowPickupStatusesTable = &schema.Table{
		Name:       "workflow_pickup_statuses",
		Columns:    WorkflowPickupStatusesColumns,
		PrimaryKey: []*schema.Column{WorkflowPickupStatusesColumns[0], WorkflowPickupStatusesColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "workflow_pickup_statuses_workflow_id",
				Columns:    []*schema.Column{WorkflowPickupStatusesColumns[0]},
				RefColumns: []*schema.Column{WorkflowsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "workflow_pickup_statuses_ticket_status_id",
				Columns:    []*schema.Column{WorkflowPickupStatusesColumns[1]},
				RefColumns: []*schema.Column{TicketStatusColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// WorkflowFinishStatusesColumns holds the columns for the "workflow_finish_statuses" table.
	WorkflowFinishStatusesColumns = []*schema.Column{
		{Name: "workflow_id", Type: field.TypeUUID},
		{Name: "ticket_status_id", Type: field.TypeUUID},
	}
	// WorkflowFinishStatusesTable holds the schema information for the "workflow_finish_statuses" table.
	WorkflowFinishStatusesTable = &schema.Table{
		Name:       "workflow_finish_statuses",
		Columns:    WorkflowFinishStatusesColumns,
		PrimaryKey: []*schema.Column{WorkflowFinishStatusesColumns[0], WorkflowFinishStatusesColumns[1]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "workflow_finish_statuses_workflow_id",
				Columns:    []*schema.Column{WorkflowFinishStatusesColumns[0]},
				RefColumns: []*schema.Column{WorkflowsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "workflow_finish_statuses_ticket_status_id",
				Columns:    []*schema.Column{WorkflowFinishStatusesColumns[1]},
				RefColumns: []*schema.Column{TicketStatusColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// Tables holds all the tables in the schema.
	Tables = []*schema.Table{
		ActivityEventsTable,
		AgentsTable,
		AgentActivityInstancesTable,
		AgentProvidersTable,
		AgentRawEventsTable,
		AgentRunsTable,
		AgentStepEventsTable,
		AgentTokensTable,
		AgentTraceEventsTable,
		AgentTranscriptEntriesTable,
		ApprovalPolicyRulesTable,
		AuthAuditEventsTable,
		BrowserSessionsTable,
		ChatConversationsTable,
		ChatEntriesTable,
		ChatPendingInterruptsTable,
		ChatTurnsTable,
		InstanceAuthConfigsTable,
		LocalBootstrapAuthRequestsTable,
		MachinesTable,
		MachineChannelTokensTable,
		NotificationChannelsTable,
		NotificationRulesTable,
		OrganizationsTable,
		OrganizationDailyTokenUsagesTable,
		OrganizationInvitationsTable,
		OrganizationMembershipsTable,
		ProjectsTable,
		ProjectConversationPrincipalsTable,
		ProjectConversationRunsTable,
		ProjectConversationStepEventsTable,
		ProjectConversationTraceEventsTable,
		ProjectDailyTokenUsagesTable,
		ProjectReposTable,
		ProjectUpdateCommentsTable,
		ProjectUpdateCommentRevisionsTable,
		ProjectUpdateThreadsTable,
		ProjectUpdateThreadRevisionsTable,
		RoleBindingsTable,
		ScheduledJobsTable,
		SecretsTable,
		SecretBindingsTable,
		SkillsTable,
		SkillBlobsTable,
		SkillVersionsTable,
		SkillVersionFilesTable,
		TicketsTable,
		TicketCommentsTable,
		TicketCommentRevisionsTable,
		TicketDependenciesTable,
		TicketExternalLinksTable,
		TicketRepoScopesTable,
		TicketRepoWorkspacesTable,
		TicketStatusTable,
		UsersTable,
		UserGroupMembershipsTable,
		UserIdentitiesTable,
		WorkflowsTable,
		WorkflowSkillBindingsTable,
		WorkflowVersionsTable,
		WorkspaceInitLeasesTable,
		WorkflowPickupStatusesTable,
		WorkflowFinishStatusesTable,
	}
)

Functions

func Create

func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...schema.MigrateOption) error

Create creates all table resources using the given schema driver.

Types

type Schema

type Schema struct {
	// contains filtered or unexported fields
}

Schema is the API for creating, migrating and dropping a schema.

func NewSchema

func NewSchema(drv dialect.Driver) *Schema

NewSchema creates a new schema client.

func (*Schema) Create

func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error

Create creates all schema resources.

func (*Schema) WriteTo

func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error

WriteTo writes the schema changes to w instead of running them against the database.

if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil {
	log.Fatal(err)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL