Apply Database Migrations
Create or update the Kredal Supabase schema using the CLI.
Kredal's schema lives in kredal-app/supabase/migrations/. It is applied with the Supabase
CLI.
Important: The live Kredal project (
cbrnyfninzpsspwygvnd, regionap-south-1) lives in a Supabase account that is not the one the Supabase MCP tool is authenticated to. The MCP tool cannot see or manage this project —list_tablesetc. return a permission error. Use thesupabaseCLI for everything on this project.
Prerequisites
- Supabase CLI installed and logged in to the account that owns the project
(
supabase login). - You are in
kredal-app/.
Apply to an existing linked project
The repo is already linked. To apply any pending migrations:
cd kredal-app
supabase db pushConfirm what was applied:
supabase migration listlocal and remote columns should match for every migration.
First-time setup on a fresh project
If you are creating a new project from scratch:
# 1. Create the project (generate a strong DB password first and keep it safe)
supabase projects create Kredal --org-id <your-org-id> --db-password "<password>" --region ap-south-1
# 2. Link the local repo to it
supabase link --project-ref <new-ref> --password "<password>"
# 3. Apply the schema
supabase db pushThen populate .env.local — see Rotate Supabase keys.
Verify
After pushing, confirm:
- The
company-documentsstorage bucket exists and is private. - RLS is enabled on every table (each shows a lock icon in the dashboard).
For a functional cross-tenant test, see Verify RLS.
Adding a new migration
Create a new numbered SQL file (e.g. 0002_docs_rag.sql) in supabase/migrations/, then
supabase db push. Never edit a migration that has already been applied to production —
add a new one.