Files
member-console/internal/entitlements/pool_assignments.sql.go
T
cgalo5758 b0072d8971 Consolidate domain tables into core schema
Squash the pre-production migration history into fresh core, fedwiki,
and stripe baselines and reduce the canonical source list to those
three streams.

Update sqlc configs, generated queries, raw SQL, tests, and docs while
keeping provider tables schema-qualified.

BREAKING: existing local database volumes must be wiped because goose
version history restarts from the new baselines.
2026-07-05 20:10:23 -05:00

60 lines
1.6 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.29.0
// source: pool_assignments.sql
package entitlements
import (
"context"
)
const createPoolAssignment = `-- name: CreatePoolAssignment :one
INSERT INTO core.pool_assignments (pool_id, workspace_id, is_primary)
VALUES ($1, $2, $3)
RETURNING assignment_id, pool_id, workspace_id, is_primary, status, suspended_at, created_at, updated_at
`
type CreatePoolAssignmentParams struct {
PoolID string `json:"pool_id"`
WorkspaceID string `json:"workspace_id"`
IsPrimary bool `json:"is_primary"`
}
func (q *Queries) CreatePoolAssignment(ctx context.Context, arg CreatePoolAssignmentParams) (PoolAssignment, error) {
row := q.db.QueryRowContext(ctx, createPoolAssignment, arg.PoolID, arg.WorkspaceID, arg.IsPrimary)
var i PoolAssignment
err := row.Scan(
&i.AssignmentID,
&i.PoolID,
&i.WorkspaceID,
&i.IsPrimary,
&i.Status,
&i.SuspendedAt,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const getPrimaryPoolAssignmentByWorkspace = `-- name: GetPrimaryPoolAssignmentByWorkspace :one
SELECT assignment_id, pool_id, workspace_id, is_primary, status, suspended_at, created_at, updated_at FROM core.pool_assignments
WHERE workspace_id = $1 AND is_primary = TRUE AND status = 'active'
`
func (q *Queries) GetPrimaryPoolAssignmentByWorkspace(ctx context.Context, workspaceID string) (PoolAssignment, error) {
row := q.db.QueryRowContext(ctx, getPrimaryPoolAssignmentByWorkspace, workspaceID)
var i PoolAssignment
err := row.Scan(
&i.AssignmentID,
&i.PoolID,
&i.WorkspaceID,
&i.IsPrimary,
&i.Status,
&i.SuspendedAt,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}