database-migration

Automate PostgreSQL migrations and Better Auth schema updates with GORM AutoMigrate.

2|Updated Dec 3, 2025
One-click install
npx skills add https://github.com/atilladeniz/next-go-pg --skill database-migration-atilladeniz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-migration
Source: https://github.com/atilladeniz/next-go-pg/tree/main/.claude/skills/database-migration
Command: npx skills add https://github.com/atilladeniz/next-go-pg --skill database-migration-atilladeniz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill automates the often error-prone and time-consuming process of managing database schema changes and migrations. It ensures your PostgreSQL database and Better Auth schema are always in sync with your application's needs, saving you from manual database operations and potential data inconsistencies.

Core Features & Use Cases

  • GORM AutoMigrate Integration: Automatically registers new Go entities for schema creation upon backend startup.
  • Better Auth Schema Management: Simplifies the creation and migration of Better Auth's essential tables.
  • Database Lifecycle Commands: Provides quick commands to start, stop, and reset your PostgreSQL database.
  • Use Case: After adding a new Go entity (e.g., Product), use this skill to automatically register it for GORM AutoMigrate and ensure your database schema is up-to-date with a single command, eliminating manual SQL execution.

Quick Start

Explain how to add a new entity to the GORM AutoMigrate registry in backend/internal/domain/registry.go and then run the database migration by restarting the backend.

Frequently Asked Questions about database-migration

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

FAQPage Schema
How do I automate PostgreSQL database migrations with GORM?

Database migrations with GORM are automated by registering Go entities in the GORM AutoMigrate registry. When your backend restarts, new entities are automatically detected and their schemas created in PostgreSQL, eliminating manual SQL execution and keeping your database in sync with your application.

Can I manage Better Auth schema updates automatically?

Yes. This Skill handles Better Auth schema creation and migration automatically, ensuring Better Auth's essential tables are provisioned and updated alongside your PostgreSQL database without manual intervention during deployments.

What Makefile commands are available for database lifecycle management?

Quick Makefile commands manage your PostgreSQL database: db-up starts the database, db-down stops it, db-reset clears all data, and db-migrate runs pending migrations. These commands streamline local development and deployment workflows across backend and frontend.

How do I add a new entity and update the database schema?

Add your Go entity to `backend/internal/domain/registry.go` in the GORM AutoMigrate registry, then restart your backend. The schema updates automatically on startup without requiring manual migration files or SQL commands.

Does this work with Docker-based PostgreSQL deployments?

Yes. The Skill supports Docker-based PostgreSQL databases and integrates with Makefile commands for database lifecycle management, making it suitable for both local development with Docker and containerized backend and frontend deployments.

What happens if my database schema and application code become out of sync?

Use the db-reset command to clear the database and restart your backend, which triggers AutoMigrate to recreate the schema from your current entity registry. This ensures consistency but removes all data, making it ideal for development and testing environments.