2022-01-05 09:20:56 -06:00
|
|
|
# sqlc is used to generate types from sql schema language.
|
|
|
|
|
# It was chosen to ensure type-safety when interacting with
|
|
|
|
|
# the database.
|
2022-12-15 14:40:11 -06:00
|
|
|
version: "2"
|
2023-12-19 14:31:55 -06:00
|
|
|
cloud:
|
|
|
|
|
# This is the static ID for the coder project.
|
|
|
|
|
project: "01HEP08N3WKWRFZT3ZZ9Q37J8X"
|
2022-12-15 14:40:11 -06:00
|
|
|
sql:
|
|
|
|
|
- schema: "./dump.sql"
|
|
|
|
|
queries: "./queries"
|
|
|
|
|
engine: "postgresql"
|
2023-12-12 15:53:26 -06:00
|
|
|
# This only works if you are running a local postgres database with the
|
|
|
|
|
# schema loaded and migrations run. Run `make sqlc-vet` to run the linter.
|
|
|
|
|
database:
|
|
|
|
|
uri: "${SQLC_DATABASE_URL}"
|
2023-12-12 18:50:23 -06:00
|
|
|
analyzer:
|
|
|
|
|
database: false
|
2023-12-12 15:53:26 -06:00
|
|
|
rules:
|
|
|
|
|
- sqlc/db-prepare
|
2024-03-18 15:23:25 +01:00
|
|
|
- do-not-use-public-schema-in-queries
|
2022-12-15 14:40:11 -06:00
|
|
|
gen:
|
|
|
|
|
go:
|
|
|
|
|
package: "database"
|
|
|
|
|
out: "./queries"
|
|
|
|
|
emit_interface: true
|
|
|
|
|
emit_json_tags: true
|
|
|
|
|
emit_db_tags: true
|
2023-01-23 13:14:47 +02:00
|
|
|
emit_enum_valid_method: true
|
|
|
|
|
emit_all_enum_values: true
|
2026-06-16 11:01:43 +02:00
|
|
|
initialisms:
|
|
|
|
|
# Keep the sqlc default initialism and add AI so generated
|
|
|
|
|
# identifiers follow Go naming conventions.
|
|
|
|
|
- id
|
|
|
|
|
- ai
|
2026-06-24 15:04:04 -04:00
|
|
|
- nats
|
2024-01-02 03:56:38 -05:00
|
|
|
overrides:
|
2025-09-22 19:26:51 +02:00
|
|
|
- column: "api_keys.scopes"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "APIKeyScopes"
|
|
|
|
|
- column: "api_keys.allow_list"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "AllowList"
|
2024-11-01 14:36:12 +11:00
|
|
|
- db_type: "agent_id_name_pair"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "AgentIDNamePair"
|
2024-06-06 15:36:37 -05:00
|
|
|
# Used in 'CustomRoles' query to filter by (name,organization_id)
|
|
|
|
|
- db_type: "name_organization_pair"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "NameOrganizationPair"
|
2024-11-15 11:33:22 +02:00
|
|
|
- db_type: "tagset"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "StringMap"
|
2024-06-04 09:27:44 -05:00
|
|
|
- column: "custom_roles.site_permissions"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "CustomRolePermissions"
|
|
|
|
|
- column: "custom_roles.org_permissions"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "CustomRolePermissions"
|
|
|
|
|
- column: "custom_roles.user_permissions"
|
2026-01-12 18:19:19 -08:00
|
|
|
go_type:
|
|
|
|
|
type: "CustomRolePermissions"
|
|
|
|
|
- column: "custom_roles.member_permissions"
|
2024-06-04 09:27:44 -05:00
|
|
|
go_type:
|
|
|
|
|
type: "CustomRolePermissions"
|
2024-01-02 03:56:38 -05:00
|
|
|
- column: "provisioner_daemons.tags"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "StringMap"
|
2024-07-25 11:20:45 -04:00
|
|
|
- column: "provisioner_keys.tags"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "StringMap"
|
2024-01-02 03:56:38 -05:00
|
|
|
- column: "provisioner_jobs.tags"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "StringMap"
|
2026-03-25 13:26:26 -04:00
|
|
|
- column: "chats.labels"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "StringMap"
|
2026-05-14 17:18:50 +01:00
|
|
|
- column: "chats_expanded.labels"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "StringMap"
|
2026-05-18 22:32:05 +01:00
|
|
|
- column: "chats.user_acl"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "ChatACL"
|
|
|
|
|
- column: "chats.group_acl"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "ChatACL"
|
2026-08-24 10:30:01 +01:00
|
|
|
- column: "chat_model_configs.user_acl"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "ChatACL"
|
|
|
|
|
- column: "chat_model_configs.group_acl"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "ChatACL"
|
2026-08-19 21:25:18 +02:00
|
|
|
- column: "mcp_server_configs.user_acl"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "ChatACL"
|
|
|
|
|
- column: "mcp_server_configs.group_acl"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "ChatACL"
|
2026-05-18 22:32:05 +01:00
|
|
|
- column: "chats_expanded.user_acl"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "ChatACL"
|
|
|
|
|
- column: "chats_expanded.group_acl"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "ChatACL"
|
2024-01-02 03:56:38 -05:00
|
|
|
- column: "users.rbac_roles"
|
|
|
|
|
go_type: "github.com/lib/pq.StringArray"
|
|
|
|
|
- column: "templates.user_acl"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "TemplateACL"
|
|
|
|
|
- column: "templates.group_acl"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "TemplateACL"
|
2024-07-02 04:08:30 -10:00
|
|
|
- column: "template_with_names.user_acl"
|
2024-01-02 03:56:38 -05:00
|
|
|
go_type:
|
|
|
|
|
type: "TemplateACL"
|
2024-07-02 04:08:30 -10:00
|
|
|
- column: "template_with_names.group_acl"
|
2024-01-02 03:56:38 -05:00
|
|
|
go_type:
|
|
|
|
|
type: "TemplateACL"
|
2024-03-22 18:33:34 +02:00
|
|
|
- column: "template_usage_stats.app_usage_mins"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "StringMapOfInt"
|
2026-03-05 13:40:53 -07:00
|
|
|
- column: "tasks_with_status.workspace_user_acl"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "WorkspaceACL"
|
|
|
|
|
- column: "tasks_with_status.workspace_group_acl"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "WorkspaceACL"
|
2025-07-30 17:02:51 -06:00
|
|
|
- column: "workspaces.user_acl"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "WorkspaceACL"
|
|
|
|
|
- column: "workspaces.group_acl"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "WorkspaceACL"
|
|
|
|
|
- column: "workspaces_expanded.user_acl"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "WorkspaceACL"
|
|
|
|
|
- column: "workspaces_expanded.group_acl"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "WorkspaceACL"
|
2025-12-15 08:42:08 -08:00
|
|
|
- column: "workspaces_expanded.user_acl_display_info"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "WorkspaceACLDisplayInfo"
|
|
|
|
|
- column: "workspaces_expanded.group_acl_display_info"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "WorkspaceACLDisplayInfo"
|
2024-06-28 11:21:25 +02:00
|
|
|
- column: "notification_templates.actions"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "[]byte"
|
|
|
|
|
- column: "notification_messages.payload"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "[]byte"
|
2024-08-21 14:18:58 +02:00
|
|
|
- column: "provisioner_job_stats.*_secs"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "float64"
|
2024-11-14 10:05:44 -06:00
|
|
|
- column: "user_links.claims"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "UserLinkClaims"
|
2025-10-15 19:34:33 +03:00
|
|
|
# Workaround for sqlc not interpreting the left join correctly.
|
|
|
|
|
- column: "tasks_with_status.workspace_build_number"
|
|
|
|
|
go_type: "database/sql.NullInt32"
|
2025-11-14 19:52:26 +02:00
|
|
|
- column: "tasks_with_status.status"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "TaskStatus"
|
|
|
|
|
- column: "tasks_with_status.workspace_agent_lifecycle_state"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "NullWorkspaceAgentLifecycleState"
|
|
|
|
|
- column: "tasks_with_status.workspace_app_health"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "NullWorkspaceAppHealth"
|
2026-02-24 17:04:42 +00:00
|
|
|
# Workaround for sqlc not interpreting the left join correctly
|
|
|
|
|
# in the combined telemetry query.
|
|
|
|
|
- column: "task_event_data.start_build_number"
|
|
|
|
|
go_type: "database/sql.NullInt32"
|
|
|
|
|
- column: "task_event_data.stop_build_created_at"
|
|
|
|
|
go_type: "database/sql.NullTime"
|
|
|
|
|
- column: "task_event_data.stop_build_reason"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "NullBuildReason"
|
|
|
|
|
- column: "task_event_data.start_build_created_at"
|
|
|
|
|
go_type: "database/sql.NullTime"
|
|
|
|
|
- column: "task_event_data.start_build_reason"
|
|
|
|
|
go_type:
|
|
|
|
|
type: "NullBuildReason"
|
|
|
|
|
- column: "task_event_data.last_working_status_at"
|
|
|
|
|
go_type: "database/sql.NullTime"
|
|
|
|
|
- column: "task_event_data.first_status_after_resume_at"
|
|
|
|
|
go_type: "database/sql.NullTime"
|
2026-03-13 18:30:49 +01:00
|
|
|
- db_type: "pg_catalog.numeric"
|
|
|
|
|
go_type:
|
|
|
|
|
import: "github.com/shopspring/decimal"
|
|
|
|
|
type: "Decimal"
|
|
|
|
|
package: "decimal"
|
|
|
|
|
- db_type: "pg_catalog.numeric"
|
|
|
|
|
nullable: true
|
|
|
|
|
go_type:
|
|
|
|
|
import: "github.com/shopspring/decimal"
|
|
|
|
|
type: "NullDecimal"
|
|
|
|
|
package: "decimal"
|
2024-01-02 03:56:38 -05:00
|
|
|
rename:
|
2026-05-22 02:16:01 +02:00
|
|
|
ai_provider_id: AIProviderID
|
2026-05-14 17:18:50 +01:00
|
|
|
chat: ChatTable
|
|
|
|
|
chats_expanded: Chat
|
2024-08-13 16:20:24 +02:00
|
|
|
group_member: GroupMemberTable
|
|
|
|
|
group_members_expanded: GroupMember
|
2024-01-02 03:56:38 -05:00
|
|
|
template: TemplateTable
|
2024-07-02 04:08:30 -10:00
|
|
|
template_with_name: Template
|
2024-01-02 03:56:38 -05:00
|
|
|
workspace_build: WorkspaceBuildTable
|
|
|
|
|
workspace_build_with_user: WorkspaceBuild
|
2024-10-22 09:20:54 -05:00
|
|
|
workspace: WorkspaceTable
|
|
|
|
|
workspaces_expanded: Workspace
|
2025-10-13 12:25:58 +03:00
|
|
|
task: TaskTable
|
|
|
|
|
tasks_with_status: Task
|
2024-01-02 03:56:38 -05:00
|
|
|
template_version: TemplateVersionTable
|
|
|
|
|
template_version_with_user: TemplateVersion
|
|
|
|
|
api_key: APIKey
|
|
|
|
|
api_key_scope: APIKeyScope
|
|
|
|
|
api_key_scope_all: APIKeyScopeAll
|
|
|
|
|
api_key_scope_application_connect: APIKeyScopeApplicationConnect
|
|
|
|
|
api_version: APIVersion
|
|
|
|
|
avatar_url: AvatarURL
|
|
|
|
|
created_by_avatar_url: CreatedByAvatarURL
|
2026-05-13 11:06:42 -04:00
|
|
|
diff_url: DiffURL
|
2024-01-02 03:56:38 -05:00
|
|
|
dbcrypt_key: DBCryptKey
|
|
|
|
|
session_count_vscode: SessionCountVSCode
|
|
|
|
|
session_count_jetbrains: SessionCountJetBrains
|
|
|
|
|
session_count_reconnecting_pty: SessionCountReconnectingPTY
|
|
|
|
|
session_count_ssh: SessionCountSSH
|
|
|
|
|
connection_median_latency_ms: ConnectionMedianLatencyMS
|
|
|
|
|
login_type_oidc: LoginTypeOIDC
|
|
|
|
|
oauth_access_token: OAuthAccessToken
|
|
|
|
|
oauth_access_token_key_id: OAuthAccessTokenKeyID
|
|
|
|
|
oauth_expiry: OAuthExpiry
|
|
|
|
|
oauth_id_token: OAuthIDToken
|
|
|
|
|
oauth_refresh_token: OAuthRefreshToken
|
|
|
|
|
oauth_refresh_token_key_id: OAuthRefreshTokenKeyID
|
|
|
|
|
oauth_extra: OAuthExtra
|
|
|
|
|
parameter_type_system_hcl: ParameterTypeSystemHCL
|
|
|
|
|
userstatus: UserStatus
|
|
|
|
|
gitsshkey: GitSSHKey
|
|
|
|
|
rbac_roles: RBACRoles
|
|
|
|
|
ip_address: IPAddress
|
|
|
|
|
ip_addresses: IPAddresses
|
|
|
|
|
ids: IDs
|
|
|
|
|
jwt: JWT
|
|
|
|
|
user_acl: UserACL
|
|
|
|
|
group_acl: GroupACL
|
2026-03-05 13:40:53 -07:00
|
|
|
workspace_user_acl: WorkspaceUserACL
|
|
|
|
|
workspace_group_acl: WorkspaceGroupACL
|
2025-12-15 08:42:08 -08:00
|
|
|
user_acl_display_info: UserACLDisplayInfo
|
|
|
|
|
group_acl_display_info: GroupACLDisplayInfo
|
2024-01-02 03:56:38 -05:00
|
|
|
troubleshooting_url: TroubleshootingURL
|
|
|
|
|
default_ttl: DefaultTTL
|
|
|
|
|
motd_file: MOTDFile
|
|
|
|
|
uuid: UUID
|
|
|
|
|
failure_ttl: FailureTTL
|
|
|
|
|
time_til_dormant_autodelete: TimeTilDormantAutoDelete
|
|
|
|
|
eof: EOF
|
|
|
|
|
template_ids: TemplateIDs
|
|
|
|
|
active_user_ids: ActiveUserIDs
|
|
|
|
|
display_app_ssh_helper: DisplayAppSSHHelper
|
|
|
|
|
oauth2_provider_app: OAuth2ProviderApp
|
|
|
|
|
oauth2_provider_app_secret: OAuth2ProviderAppSecret
|
2024-02-20 15:58:43 -08:00
|
|
|
oauth2_provider_app_code: OAuth2ProviderAppCode
|
|
|
|
|
oauth2_provider_app_token: OAuth2ProviderAppToken
|
|
|
|
|
api_key_id: APIKeyID
|
2024-01-02 03:56:38 -05:00
|
|
|
callback_url: CallbackURL
|
2024-02-20 15:58:43 -08:00
|
|
|
login_type_oauth2_provider_app: LoginTypeOAuth2ProviderApp
|
2024-10-25 17:14:35 +01:00
|
|
|
crypto_key_feature_workspace_apps_api_key: CryptoKeyFeatureWorkspaceAppsAPIKey
|
|
|
|
|
crypto_key_feature_oidc_convert: CryptoKeyFeatureOIDCConvert
|
2026-06-26 11:59:00 -07:00
|
|
|
crypto_key_feature_nats_ca: CryptoKeyFeatureNATSCA
|
2025-01-14 18:40:26 +02:00
|
|
|
stale_interval_ms: StaleIntervalMS
|
2025-06-13 15:54:02 +02:00
|
|
|
has_ai_task: HasAITask
|
2025-06-24 12:36:37 +02:00
|
|
|
ai_task_sidebar_app_id: AITaskSidebarAppID
|
2025-06-18 18:22:45 +02:00
|
|
|
latest_build_has_ai_task: LatestBuildHasAITask
|
2025-07-30 13:42:39 -07:00
|
|
|
cors_behavior: CorsBehavior
|
2025-09-16 21:31:17 +02:00
|
|
|
aibridge_interception: AIBridgeInterception
|
2026-07-09 15:06:44 +02:00
|
|
|
aibridge_interception_error_type: AIBridgeInterceptionErrorType
|
2025-09-16 21:31:17 +02:00
|
|
|
aibridge_tool_usage: AIBridgeToolUsage
|
|
|
|
|
aibridge_token_usage: AIBridgeTokenUsage
|
|
|
|
|
aibridge_user_prompt: AIBridgeUserPrompt
|
2026-03-17 13:41:10 +02:00
|
|
|
aibridge_model_thought: AIBridgeModelThought
|
2026-05-14 16:10:46 +02:00
|
|
|
ai_provider: AIProvider
|
|
|
|
|
ai_provider_key: AIProviderKey
|
|
|
|
|
ai_provider_type: AIProviderType
|
2026-06-02 09:28:43 +02:00
|
|
|
ai_gateway_key: AIGatewayKey
|
2026-05-20 14:44:57 +02:00
|
|
|
resource_type_ai_provider: ResourceTypeAIProvider
|
|
|
|
|
resource_type_ai_provider_key: ResourceTypeAIProviderKey
|
2026-06-02 09:28:43 +02:00
|
|
|
resource_type_ai_gateway_key: ResourceTypeAIGatewayKey
|
2026-03-19 10:07:36 -04:00
|
|
|
mcp_server_config: MCPServerConfig
|
|
|
|
|
mcp_server_configs: MCPServerConfigs
|
2026-08-19 21:11:52 +02:00
|
|
|
resource_type_mcp_server_config: ResourceTypeMCPServerConfig
|
2026-03-19 10:07:36 -04:00
|
|
|
mcp_server_user_token: MCPServerUserToken
|
|
|
|
|
mcp_server_user_tokens: MCPServerUserTokens
|
|
|
|
|
mcp_server_tool_snapshot: MCPServerToolSnapshot
|
|
|
|
|
mcp_server_tool_snapshots: MCPServerToolSnapshots
|
|
|
|
|
mcp_server_config_id: MCPServerConfigID
|
|
|
|
|
mcp_server_ids: MCPServerIDs
|
2026-04-07 12:05:29 +01:00
|
|
|
max_file_links: MaxFileLinks
|
2026-03-19 10:07:36 -04:00
|
|
|
icon_url: IconURL
|
|
|
|
|
oauth2_client_id: OAuth2ClientID
|
|
|
|
|
oauth2_client_secret: OAuth2ClientSecret
|
|
|
|
|
oauth2_client_secret_key_id: OAuth2ClientSecretKeyID
|
|
|
|
|
oauth2_auth_url: OAuth2AuthURL
|
|
|
|
|
oauth2_token_url: OAuth2TokenURL
|
2026-07-20 00:14:03 +02:00
|
|
|
oauth2_revocation_url: OAuth2RevocationURL
|
2026-03-19 10:07:36 -04:00
|
|
|
oauth2_scopes: OAuth2Scopes
|
|
|
|
|
api_key_header: APIKeyHeader
|
|
|
|
|
api_key_value: APIKeyValue
|
|
|
|
|
api_key_value_key_id: APIKeyValueKeyID
|
|
|
|
|
custom_headers_key_id: CustomHeadersKeyID
|
|
|
|
|
tools_json: ToolsJSON
|
|
|
|
|
access_token_key_id: AccessTokenKeyID
|
|
|
|
|
refresh_token_key_id: RefreshTokenKeyID
|
2024-03-18 15:23:25 +01:00
|
|
|
rules:
|
|
|
|
|
- name: do-not-use-public-schema-in-queries
|
|
|
|
|
message: "do not use public schema in queries"
|
|
|
|
|
# FIXME: It would be great to run sqlc-vet against `migrations` directory and `dump.sql`.
|
|
|
|
|
rule: >
|
|
|
|
|
query.sql.matches(r'[^a-z]public\.')
|