Skip to content
Skills Library
Programming · Automation

database-management

/database-management

When you need to modify the database schema, run migrations, or deploy Supabase changes. Use this for all SQL and Supabase-related tasks.

Repository
nextblock ↗
Licence
AGPL-3.0
Last repository change
27.10.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

AGPL-3.0, copyleft: przeróbki udostępniane innym muszą mieć tę samą licencję.

What it does and when to use it

When you need to modify the database schema, run migrations, or deploy Supabase changes. Use this for all SQL and Supabase-related tasks.

Original author description

When you need to modify the database schema, run migrations, or deploy Supabase changes. Use this for all SQL and Supabase-related tasks.

How it works

  1. 1. Core Workflow
  2. 2. Key Commands
  3. 3. Schema Management
  4. 4. Troubleshooting
Original SKILL.md headings · 40 lines, 362 words
SKILL.md preview
---
name: database-management
description: When you need to modify the database schema, run migrations, or deploy Supabase changes. Use this for all SQL and Supabase-related tasks.
---

# Database Management (Supabase)

## 1. Core Workflow

- **Environment:** We use Supabase (PostgreSQL + Auth).
- **Local Config:** `supabase/config.toml` manages local settings.
- **Env Vars:** Ensure `.env.local` is populated with valid Supabase credentials.

## 2. Key Commands

- **Check Migrations:** `npm run db:migrate:check`
  - Dry-runs pending remote migrations. Run this before any live migration.
- **Push Migrations:** `npm run db:migrate` or `npm run db:push`
  - Applies pending migration files only.
  - It does not reset data, seed sandbox media, deploy functions, or push local Supabase config.
- **Repair Existing Baseline History:** `npm run db:migrate:repair-history:check`, then `npm run db:migrate:repair-history`
  - For existing production/shared databases whose schema already exists but whose Supabase migration ledger is missing old baseline versions.
  - Marks historical baseline migrations as applied without running their SQL.
- **Link Database:** `npm run db:link`
  - Links the local development environment to the remote Supabase project.
- **Generate Types:** `npm run db:types`
  - Generates TypeScript definitions from the database schema. **Run this after every schema change.**
- **Deploy:** `npm run deploy:supabase`
  - Deploys migrations and config (often used in CI/CD).

## 3. Schema Management

- **Migrations:** SQL migrations are located in `libs/db/src/supabase/migrations`.
- **Production Rule:** Always create a new append-only migration for production/shared database changes. Do not rewrite, squash, reorder, delete, or recycle existing migrations once they may have been applied to a real database.
- **Data Safety:** Never run or recommend `db:reset`, `sandbox:reset`, `db:push:sandbox`, or `db:migrate:fresh` against a production/shared database containing orders, users, payments, or customer data.
- **Fresh Databases Only:** `npm run db:migrate:fresh` is only for a brand-new empty database.
- **No Local Docker:** There is no local Supabase Docker instance. The user will usually push DB migrations manually via `npm run db:migrate`. Do not attempt to run mutating DB commands yourself unless explicitly asked and the target is confirmed.
- **Validation:** Always verify schema changes are syntactically correct SQL before leaving them for the user to push.

## 4. Troubleshooting

- **CSP/Connection Issues:** If the build fails to connect to Supabase, check the Content Security Policy (CSP) headers in `next.config.js` or `middleware.ts`.
- **Url Sync:** Ensure `NEXT_PUBLIC_URL` matches your `site_url` in Supabase config to prevent redirect issues with auth.

Versions

RepositoryScoreLicence
This page · nextblock-cms/nextblock90AGPL-3.0
AutumnsGrove/Lattice100AGPL-3.0

Database snapshot: 13.11.2026 · package version 32bc61783ef9 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 2 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100supabase-schema-from-requirements
    Execute Supabase primary workflow: Schema from Requirements. Use when Starting a new project with defined data requirements, Refactoring an existing schema based on new features, or Creating migrations from specification documents. Trigger with phrases like "supabase schema from…
  • 100supabase-admin
    Supabase administration, RLS policies, migrations, and schema design. Use for database architecture, Row Level Security, performance tuning, auth integration. Activate on "Supabase", "RLS", "migration", "policy", "schema", "auth.uid()". NOT for Supabase Auth UI configuration…
  • 100supabase-admin
    Supabase administration, RLS policies, migrations, and schema design. Use for database architecture, Row Level Security, performance tuning, auth integration. Activate on "Supabase", "RLS", "migration", "policy", "schema", "auth.uid()". NOT for Supabase Auth UI configuration…
  • 100supabase-migration-deep-dive
    Database migration patterns with the Supabase CLI: npx supabase migration new, zero-downtime migrations, data backfill strategies, schema versioning, rollback strategies, and TypeScript type generation. Use when creating database migrations, performing zero-downtime schema…
  • 100supabase-schema-from-requirements
    Design Supabase Postgres schema from business requirements with migrations, RLS, and types. Use when translating specifications into database tables, creating migration files, adding Row Level Security policies, or generating TypeScript types from schema. Trigger with phrases…
  • 95supabase-js
    This skill should be used when user asks to "use supabase-js", "query Supabase database", "supabase auth", "supabase storage", "supabase realtime", "supabase edge functions", or works with the @supabase/supabase-js JavaScript/TypeScript SDK.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.