context-database-schema

Manage PostgreSQL/Supabase schema migrations with Alembic and RLS policies.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/stars-end/agent-skills --skill context-database-schema
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-database-schema
Source: https://github.com/stars-end/agent-skills/tree/main/context-database-schema
Command: npx skills add https://github.com/stars-end/agent-skills --skill context-database-schema

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Supabase PostgreSQL schema management, 86+ migrations, RLS policies, and type generation. Handles table creation, schema changes, migrations, foreign key constraints, and migration workflows.

Core Features & Use Cases

  • Migration Workflows: Alembic-based migrations; guidance for creating and applying migrations
  • Legacy Supabase Migrations: Deprecated for runtime; preserved for archival and reference
  • Schema Overview: Supabase and Railway Postgres integration, RLS policies, and typical table setups
  • Type Generation & Definitions: Type schemas and tooling references for database access

Quick Start

Verify environment and apply migrations with Alembic (example):

  • Navigate to backend: cd backend
  • Create a new Alembic migration: poetry run alembic revision -m "description"
  • Apply migrations: poetry run alembic upgrade head Note: Legacy Supabase migrations are kept for archival; do not add new Supabase migrations for Railway workflows.

Frequently Asked Questions about context-database-schema

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I apply database migrations with Alembic to my PostgreSQL schema?

Alembic migrations manage schema changes incrementally. Navigate to your backend directory, run `poetry run alembic upgrade head` to apply pending migrations, or create new migrations with `poetry run alembic revision -m "description"` before applying them. This workflow ensures consistent schema evolution across environments like Railway Postgres.

What's the difference between legacy Supabase migrations and Alembic-based workflows?

Legacy Supabase migrations are deprecated for runtime use and kept only for archival reference. Alembic-based migrations are the current standard for Railway Postgres deployments, providing version control, rollback capability, and reproducible schema changes. Use Alembic for all new migrations.

How do I fix 'relation does not exist' errors in PostgreSQL?

This error occurs when migrations haven't been applied or a table reference is missing. Verify pending migrations with Alembic status, apply all migrations with `poetry run alembic upgrade head`, and check that table names and schemas match your migration definitions. Manual SQL inspection may be needed to diagnose schema state.

Can I manage Row-Level Security policies alongside schema migrations?

Yes. RLS policies are part of the schema management scope in this Skill. Define and apply RLS policies through migrations or manual SQL to enforce access control on Supabase and Railway Postgres tables, coordinating with your migration workflow.

How do I generate type definitions from my PostgreSQL schema?

Type generation tooling converts your database schema into TypeScript or language-specific type definitions. Reference the Skill's type generation documentation and tooling references to automate type creation from your 86+ migrations, reducing manual type maintenance.

What do I need before applying migrations to Railway Postgres?

Ensure your backend environment is configured with Poetry, Alembic is initialized, your database connection is set in environment variables, and all migration files are committed. Verify Railway Postgres connectivity before running `poetry run alembic upgrade head` to apply schema changes.