chore(sqlc): regenerate models for migration 0006

sqlc reads all migrations into every package's schema, so the
addition of acp_* tables and workspaces.active_main_session_id
in migration 0006 propagates type definitions and SELECT
column lists across all sub-packages. No code logic changes.
This commit is contained in:
2026-05-07 13:39:08 +08:00
parent 3d5f63b28e
commit 679ded50c9
8 changed files with 432 additions and 97 deletions
+60 -13
View File
@@ -10,6 +10,52 @@ import (
"github.com/jackc/pgx/v5/pgtype"
)
type AcpAgentKind struct {
ID pgtype.UUID `json:"id"`
Name string `json:"name"`
DisplayName string `json:"display_name"`
Description string `json:"description"`
BinaryPath string `json:"binary_path"`
Args []string `json:"args"`
EncryptedEnv []byte `json:"encrypted_env"`
Enabled bool `json:"enabled"`
CreatedBy pgtype.UUID `json:"created_by"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type AcpEvent struct {
ID int64 `json:"id"`
SessionID pgtype.UUID `json:"session_id"`
Direction string `json:"direction"`
RpcKind string `json:"rpc_kind"`
Method *string `json:"method"`
Payload []byte `json:"payload"`
PayloadSize int32 `json:"payload_size"`
Truncated bool `json:"truncated"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
type AcpSession struct {
ID pgtype.UUID `json:"id"`
WorkspaceID pgtype.UUID `json:"workspace_id"`
ProjectID pgtype.UUID `json:"project_id"`
AgentKindID pgtype.UUID `json:"agent_kind_id"`
UserID pgtype.UUID `json:"user_id"`
IssueID pgtype.UUID `json:"issue_id"`
RequirementID pgtype.UUID `json:"requirement_id"`
AgentSessionID *string `json:"agent_session_id"`
Branch string `json:"branch"`
CwdPath string `json:"cwd_path"`
IsMainWorktree bool `json:"is_main_worktree"`
Status string `json:"status"`
Pid *int32 `json:"pid"`
ExitCode *int32 `json:"exit_code"`
LastError *string `json:"last_error"`
StartedAt pgtype.Timestamptz `json:"started_at"`
EndedAt pgtype.Timestamptz `json:"ended_at"`
}
type AuditLog struct {
ID int64 `json:"id"`
UserID pgtype.UUID `json:"user_id"`
@@ -220,19 +266,20 @@ type UserSession struct {
}
type Workspace struct {
ID pgtype.UUID `json:"id"`
ProjectID pgtype.UUID `json:"project_id"`
Slug string `json:"slug"`
Name string `json:"name"`
Description string `json:"description"`
GitRemoteUrl string `json:"git_remote_url"`
DefaultBranch string `json:"default_branch"`
MainPath string `json:"main_path"`
SyncStatus string `json:"sync_status"`
LastSyncedAt pgtype.Timestamptz `json:"last_synced_at"`
LastSyncError *string `json:"last_sync_error"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
ID pgtype.UUID `json:"id"`
ProjectID pgtype.UUID `json:"project_id"`
Slug string `json:"slug"`
Name string `json:"name"`
Description string `json:"description"`
GitRemoteUrl string `json:"git_remote_url"`
DefaultBranch string `json:"default_branch"`
MainPath string `json:"main_path"`
SyncStatus string `json:"sync_status"`
LastSyncedAt pgtype.Timestamptz `json:"last_synced_at"`
LastSyncError *string `json:"last_sync_error"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
ActiveMainSessionID pgtype.UUID `json:"active_main_session_id"`
}
type WorkspaceWorktree struct {
+12 -6
View File
@@ -16,7 +16,7 @@ INSERT INTO workspaces (
id, project_id, slug, name, description,
git_remote_url, default_branch, main_path, sync_status
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9)
RETURNING id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at
RETURNING id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at, active_main_session_id
`
type CreateWorkspaceParams struct {
@@ -58,6 +58,7 @@ func (q *Queries) CreateWorkspace(ctx context.Context, arg CreateWorkspaceParams
&i.LastSyncError,
&i.CreatedAt,
&i.UpdatedAt,
&i.ActiveMainSessionID,
)
return i, err
}
@@ -72,7 +73,7 @@ func (q *Queries) DeleteWorkspace(ctx context.Context, id pgtype.UUID) error {
}
const getWorkspaceByID = `-- name: GetWorkspaceByID :one
SELECT id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at FROM workspaces WHERE id = $1
SELECT id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at, active_main_session_id FROM workspaces WHERE id = $1
`
func (q *Queries) GetWorkspaceByID(ctx context.Context, id pgtype.UUID) (Workspace, error) {
@@ -92,12 +93,13 @@ func (q *Queries) GetWorkspaceByID(ctx context.Context, id pgtype.UUID) (Workspa
&i.LastSyncError,
&i.CreatedAt,
&i.UpdatedAt,
&i.ActiveMainSessionID,
)
return i, err
}
const getWorkspaceBySlug = `-- name: GetWorkspaceBySlug :one
SELECT w.id, w.project_id, w.slug, w.name, w.description, w.git_remote_url, w.default_branch, w.main_path, w.sync_status, w.last_synced_at, w.last_sync_error, w.created_at, w.updated_at FROM workspaces w
SELECT w.id, w.project_id, w.slug, w.name, w.description, w.git_remote_url, w.default_branch, w.main_path, w.sync_status, w.last_synced_at, w.last_sync_error, w.created_at, w.updated_at, w.active_main_session_id FROM workspaces w
JOIN projects p ON p.id = w.project_id
WHERE p.slug = $1 AND w.slug = $2
`
@@ -124,6 +126,7 @@ func (q *Queries) GetWorkspaceBySlug(ctx context.Context, arg GetWorkspaceBySlug
&i.LastSyncError,
&i.CreatedAt,
&i.UpdatedAt,
&i.ActiveMainSessionID,
)
return i, err
}
@@ -170,7 +173,7 @@ func (q *Queries) ListFetchTargets(ctx context.Context) ([]ListFetchTargetsRow,
}
const listWorkspacesByProject = `-- name: ListWorkspacesByProject :many
SELECT id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at FROM workspaces WHERE project_id = $1
SELECT id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at, active_main_session_id FROM workspaces WHERE project_id = $1
ORDER BY created_at DESC
`
@@ -197,6 +200,7 @@ func (q *Queries) ListWorkspacesByProject(ctx context.Context, projectID pgtype.
&i.LastSyncError,
&i.CreatedAt,
&i.UpdatedAt,
&i.ActiveMainSessionID,
); err != nil {
return nil, err
}
@@ -279,7 +283,7 @@ const updateWorkspaceCore = `-- name: UpdateWorkspaceCore :one
UPDATE workspaces
SET name = $2, description = $3, default_branch = $4, updated_at = now()
WHERE id = $1
RETURNING id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at
RETURNING id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at, active_main_session_id
`
type UpdateWorkspaceCoreParams struct {
@@ -311,6 +315,7 @@ func (q *Queries) UpdateWorkspaceCore(ctx context.Context, arg UpdateWorkspaceCo
&i.LastSyncError,
&i.CreatedAt,
&i.UpdatedAt,
&i.ActiveMainSessionID,
)
return i, err
}
@@ -322,7 +327,7 @@ SET sync_status = $2,
last_sync_error = $4,
updated_at = now()
WHERE id = $1
RETURNING id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at
RETURNING id, project_id, slug, name, description, git_remote_url, default_branch, main_path, sync_status, last_synced_at, last_sync_error, created_at, updated_at, active_main_session_id
`
type UpdateWorkspaceSyncStatusParams struct {
@@ -354,6 +359,7 @@ func (q *Queries) UpdateWorkspaceSyncStatus(ctx context.Context, arg UpdateWorks
&i.LastSyncError,
&i.CreatedAt,
&i.UpdatedAt,
&i.ActiveMainSessionID,
)
return i, err
}