database-engine is the Supabase database governance repository for the TianGong LCA workspace.
For AI-facing routing and current repo facts, start here:
AGENTS.md.docpact/config.yamldocs/agents/repo-validation.mddocs/agents/repo-architecture.mddocs/agents/supabase-branching.md
It owns the checked-in database source of truth:
supabase/config.tomlsupabase/migrations/*.sqlsupabase/seed.sqlsupabase/seeds/*supabase/tests/*.sql.env.supabase.dev.local.example.env.supabase.main.local.example- Supabase branching and operations docs
- the GitHub Actions flow that pushes committed migrations to the persistent Supabase
devbranch - the production Supabase GitHub integration contract that applies Git
mainmigrations automatically
It does not own:
- frontend runtime env files such as
.envor.env.development - app-side Supabase clients
- Edge Function runtime code
- ad-hoc manual dashboard changes as a long-term workflow
Those stay in consumer repos such as:
tiangong-lca-nextfor frontend envs and app integrationtiangong-lca-edge-functionsfor Edge Function runtime code
- GitHub default branch:
main - Daily trunk:
dev - Routine PR target:
dev - Promotion path:
dev -> main
- Start from the latest
dev. - Create a feature branch from
dev. - Use local Supabase for schema authoring and validation.
- Commit migrations, seeds, tests, and config changes together.
- Open the PR into
dev. - Validate the Supabase preview branch created for the PR.
- After merge, validate the persistent
devbranch. - Promote
devtomainwhen ready to release, then validate the production Supabase auto migration.
This repository keeps the operator-side Supabase branch-binding templates:
.env.supabase.dev.local.example.env.supabase.main.local.example
Copy them to .env.supabase.dev.local or .env.supabase.main.local for local-only credentials.
Those real .local files are ignored by Git because they may contain remote database passwords.
Frontend runtime env files stay in tiangong-lca-next.
Bulk imports can defer embedding queue fan-out through util.embedding_queue_policy.
Minimal operator sequence:
- Set the target policy to
deferred, for examplepublic / flows / embedding_ft / embedding_ft. - Run the bulk import.
- Confirm pending work in
util.pending_embedding_jobs. - Enqueue backfill in bounded batches with
select util.enqueue_pending_embeddings(<limit>, 'public', 'flows', 'embedding_ft', 'embedding_ft');. - Return the policy to
normalafter the queue is draining safely.
Use paused only as a stopgap when no new backfill should be enqueued. Jobs that exceed retry policy are recorded in util.embedding_job_failures.
- AI entrypoint:
AGENTS.md - Machine-readable governance:
.docpact/config.yaml - Validation guide:
docs/agents/repo-validation.md - Architecture notes:
docs/agents/repo-architecture.md - English:
docs/agents/supabase-branching.md - Chinese:
docs/agents/supabase-branching_CN.md