Files
botsmann/scripts/ci/no-hosted-supabase.sh
107e8c5c08 docs(db): point this repo at its own database, and gate the way back (#143)
The schema fix landed in #138, but the repo still told you to operate a
Supabase we do not have. docs/SUPABASE_SETUP.md opened with "Completed Setup"
for a hosted project jkjmhtirxwhljpkcfxqe.supabase.co and said to apply
migrations by pasting SQL into a supabase.com dashboard. Two unreferenced
scripts printed the same instruction, one handing out a psql string against
pooler.supabase.com, and the CLI's .temp cache with the old project ref was
committed — twice, once nested under supabase/migrations/.

That is not stale clutter, it is the outage. A wrong pointer to a real-looking
place is worse than no pointer: no pointer makes someone ask, a plausible one
makes them assume it was handled. Nobody pasted anything, the eleven migrations
were never applied, and /api/health served PGRST205 for months while every
deploy went green.

So the doc now describes what is actually true — self-hosted on bitbaum at
supabase.orangecat.ch, our tables in the `botsmann` schema because one database
backs several apps and `public` is orangecat's, and migrations applied
automatically on deploy by fleetcrown's apply-schema.sh against the
botsmann._deploy_schema_history ledger. Nothing is pasted anywhere. 280 lines
became 100.

Fixing today's copies only clears today's copies, so check:selfhost joins
verify: it fails on supabase.com/dashboard, app.supabase.com, pooler URLs and
real project refs, allows supabase.com/docs because the product documentation
is still correct for us, and exempts docs/archive/ so history can stay honest.
Proven to fail before shipping — it catches an injected dashboard link and a
project ref, and leaves the your-project.supabase.co placeholder alone.


Claude-Session: https://claude.ai/code/session_018waGt1ieA9TjpscqrbrnGb

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-28 08:08:06 +00:00

40 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# Fail if anything in this repo points at a HOSTED Supabase.
#
# WHY: our database is the self-hosted stack on bitbaum (supabase.orangecat.ch).
# We have no supabase.com project. The repo nevertheless carried a full setup
# doc, two migration scripts and a committed CLI cache all pointing at a hosted
# project ref — so the documented way to apply a migration was "paste this into
# a dashboard", against a dashboard that does not exist for us. Nobody pasted
# anything, the schema was never applied, and the app served PGRST205 in
# production. The instructions were not merely stale; they were the outage.
#
# Fixing those files once only clears today's copies. This gate ends the class.
#
# Allowed: supabase.com/docs — the product documentation is still correct for
# us; only the hosted control plane is not.
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/../.."
# A hosted project ref is a long opaque token; `your-project.supabase.co` in an
# example file is a placeholder and stays legal.
PATTERN='supabase\.com/dashboard|app\.supabase\.com|pooler\.supabase\.com|[a-z0-9]{15,}\.supabase\.co'
# docs/archive/ is a historical record of the hosted era — it is supposed to
# describe it. Everything else is read as current instruction.
hits=$(git ls-files -z \
| grep -zZv -e '^docs/archive/' -e '^scripts/ci/no-hosted-supabase\.sh$' \
| xargs -0 grep -nEI "$PATTERN" 2>/dev/null || true)
if [ -n "$hits" ]; then
echo "✗ hosted-Supabase reference(s) found — this repo is self-hosted on bitbaum:" >&2
echo "$hits" >&2
echo >&2
echo " API URL is https://supabase.orangecat.ch and migrations apply on deploy." >&2
echo " See docs/SUPABASE_SETUP.md. If a line is a historical record, move it" >&2
echo " under docs/archive/ rather than weakening this check." >&2
exit 1
fi
echo "✓ no hosted-Supabase references"