Introduce DB migrations for ladder and pool-attachment tables and an audit log for provision transitions. Make product_type nullable and add lifecycle_status plus a product_kinds view. Implement Transition and ReapplyDefaultsForPool primitives, SQLC queries/models, webhook and Temporal workflow integration, and accompanying unit/integration tests.
17 lines
608 B
SQL
17 lines
608 B
SQL
-- name: CreatePoolProvisionTransition :one
|
|
INSERT INTO entitlements.pool_provision_transitions
|
|
(pool_id, provision_id, plan_ladder_id, from_rank, to_rank,
|
|
transition_type, actor_type, actor_id, reason, effective_at)
|
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
|
|
RETURNING *;
|
|
|
|
-- name: ListTransitionsByPool :many
|
|
SELECT * FROM entitlements.pool_provision_transitions
|
|
WHERE pool_id = $1
|
|
ORDER BY effective_at DESC, created_at DESC;
|
|
|
|
-- name: ListTransitionsByProvision :many
|
|
SELECT * FROM entitlements.pool_provision_transitions
|
|
WHERE provision_id = $1
|
|
ORDER BY effective_at ASC, created_at ASC;
|