database-migrations

Guide GLAPI database schema changes with Drizzle SQL migrations via psql.

Updated May 10, 2025
One-click install
npx skills add https://github.com/adteco/glapi --skill database-migrations-adteco
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-migrations
Source: https://github.com/adteco/glapi/tree/main/.claude/skills/database-migrations
Command: npx skills add https://github.com/adteco/glapi --skill database-migrations-adteco

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

GLAPI database schema changes require precise SQL, admin-level execution, and updated TypeScript exports, but the unreliable Drizzle migrations and limited DATABASE_URL permissions often cause failed rollouts and policy conflicts.

Core Features & Use Cases

  • Admin Execution Assurance: Always source the environment and run DDL scripts via psql against DATABASE_ADMIN_URL to avoid permission and ownership errors.
  • Schema and Migration Coordination: Define new tables in packages/database/src/db/schema, export them, and add sequential files in packages/database/drizzle with RLS policies and indexes.
  • Full Stack Checklist: Complement database changes with repository, service, and router exports, then build all packages to verify type safety before release.

Quick Start

Ask the database migrations skill to outline the steps for exporting a new schema, writing the sequential drizzle SQL migration, and running it through psql with DATABASE_ADMIN_URL.

Frequently Asked Questions about database-migrations

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

FAQPage Schema
How do I run Drizzle database migrations safely with admin permissions in psql?

To run Drizzle database migrations safely, source the environment and execute the sequential SQL files via psql against DATABASE_ADMIN_URL. This prevents permission and ownership errors caused by limited DATABASE_URL access.

What is the correct process for adding a new table schema and row-level security policies in a monorepo?

Define new tables in the packages/database/src/db/schema directory, export them, then add sequential Drizzle SQL files with row-level security policies and indexes to ensure schema changes apply safely.

Why do my database schema rollouts fail with permission errors when using standard DATABASE_URL?

Schema rollouts fail because standard DATABASE_URL permissions are limited and Drizzle migrations are unreliable. You must run DDL scripts through psql on DATABASE_ADMIN_URL to avoid ownership and policy conflicts.

Do I need to update repository and service exports after modifying a database schema?

Yes, after modifying a database schema you must complement the changes with downstream repository, service, and router exports. Build all packages to verify type safety before releasing the migration.

Can I use standard Drizzle migration commands instead of psql for GLAPI schema changes?

Standard Drizzle migration commands are unreliable for GLAPI schema changes. You need to source the environment and execute the sequential SQL files directly through psql using DATABASE_ADMIN_URL for safe execution.