Declarative schema workflow, generated migrations, RLS placement, seeds, and generated types.
CentraKit uses Supabase declarative schema management.
supabase/schemas/ is the source of truth for database structure. Do not create or write migration files directly during normal schema work.
supabase/schemas/*.sql.supabase db diff -f <migration_name>.For rollbacks, revert declarative schema files and generate a new forward migration instead of rewriting history.
Schema files are applied in configured order. Some RLS policies depend on helper functions, so supabase/config.toml keeps an explicit ordered schema_paths list.
Every table must have RLS enabled. Policies that reference later-defined schema or helper functions belong in dedicated RLS files rather than table definition files.
On hot tenant tables, prefer public.has_org_permission(org_id, key) over the more general public.authorize_scope(...) for planner-friendly checks.
Seed data lives under supabase/seeds/. After schema changes, regenerate Supabase TypeScript types for both public and graphql_public schemas so generated code stays complete.