Files
computer-playbook/roles/web-app-fider/files/sql/count-tenants.sql
kevinveenbirkenbachandClaude Opus 4.7 2c416cb5c7 refactor(db-tasks): migrate ad-hoc SQL execs to database_query module
- Replace 13 raw `container exec mysql/psql` invocations across
  web-app-pixelfed, web-app-fider, and web-app-mattermost with the
  canonical `database_query` module + `query_file:` + `named_args:`
  pattern. The module already speaks both shared (central `svc-db-*`)
  and non-shared (per-role `<entity>-database`) modes via the
  `database` lookup, so the same task shape works regardless of DB
  topology — the per-role hardcoded container-exec argv was the only
  blocker.
- Extract every inline SQL body into per-role `files/sql/` trees.
  Pixelfed splits further into `files/sql/oidc-mapping/` because the
  OIDC-mapping cluster is a distinct concern from the bootstrap /
  administrator queries. Each SQL file is single-purpose and named by
  verb-noun (count-users, select-admin-id, upsert, etc.) to match the
  precedent set by web-app-odoo.
- Fider's existing `files/{create_admin_user,configure_oidc_provider}.sql`
  move to `files/sql/` and switch from psql-specific `:'var'`
  variable substitution (which forced `stdin:` piping with `-v`
  flags) to engine-neutral `%(name)s` placeholders the module
  escapes per backend.
- Pixelfed loses `PIXELFED_MARIADB_ARGS` + 3 derived DB vars
  (`*_CONTAINER`, `*_USERNAME`, `*_PASSWORD`) from `vars/main.yml` —
  they were the manual argv bundle for the old container-exec
  pattern and become orphan once `lookup('database', application_id)`
  takes over.
- Every refactored task carries `mask_values:
  MASK_CREDENTIALS_IN_LOGS` (module-level credential redaction);
  tasks that previously used `no_log: MASK_CREDENTIALS_IN_LOGS`
  keep both directives so the task-level masking stays alongside
  the module-level one.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 19:07:01 +02:00

2 lines
30 B
SQL

SELECT COUNT(*) FROM tenants;