Files
member-console/internal/entitlements/queries/numeric_entitlements.sql
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

20 lines
583 B
SQL

-- name: CreateNumericEntitlement :one
INSERT INTO core.numeric_entitlements (pool_id, resource_key, entitlement_type, resource_limit)
VALUES ($1, $2, $3, $4)
RETURNING *;
-- name: GetNumericEntitlementByPoolAndResource :one
SELECT * FROM core.numeric_entitlements
WHERE pool_id = $1 AND resource_key = $2;
-- name: UpdateNumericEntitlementLimit :one
UPDATE core.numeric_entitlements
SET resource_limit = $2
WHERE entitlement_id = $1
RETURNING *;
-- name: ListNumericEntitlementsByPoolID :many
SELECT * FROM core.numeric_entitlements
WHERE pool_id = $1
ORDER BY resource_key ASC;