Files
member-console/test/seed-demo.sh
T
cgalo5758 dd3962990b Adopt entity keys and add invoice numbers
Replace the entity slugs on organizations, workspaces, resource pools,
and
plan ladders with nullable `key` columns and add keys to products,
prices,
and entitlement sets. Rename `providers.slug` to `provider` and add
partial
unique indexes for system and org role names.

Assign invoice numbers per billing account from a gapless transactional
counter; Stripe's number moves to the invoice mapping as an external
reference.

Seeds, fixtures, and the operator lookup address rows by key, and the
returning-login resync no longer blanks a display name when the IdP
sends
no `name` claim.
2026-08-29 20:12:04 -05:00

38 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# test/seed-demo.sh — host-side invocation of the member-console demo seeder.
#
# Loads the worktree-isolated env (DB port, DSN) from test/.env and runs
# `go run . seed-demo --config test/mc-config.yaml` from the repo root.
#
# Opt-in only: the default bootstrap-stack.sh + docker compose up workflow
# does NOT invoke this. Use it before walking the operator UI for M7-7a.
#
# Idempotent — re-running is a no-op. The database generates every ID; the
# seeder finds the rows it already created by their `key` and skips them.
# Person rows for bob/carlos/diana ARE seeded, through the app's own signup
# path, each carrying as its OIDC subject the literal `sub` the Keycloak seed
# pins for that username (test/seed/keycloak/seed-keycloak.sh). Alice is left
# to lazy-create on her first login.
#
# See openspec/changes/2026-05-10-member-console-demo-seeder/ for design.
set -euo pipefail
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
repo_root="$(cd "$here/.." && pwd)"
env_file="$here/.env"
if [[ ! -f "$env_file" ]]; then
echo "error: $env_file not found. Run ./bootstrap-stack.sh first." >&2
exit 1
fi
set -a
# shellcheck source=/dev/null
source "$env_file"
set +a
cd "$repo_root"
exec go run . seed-demo --config test/mc-config.yaml