db-migrations

Manage Madoc TypeScript database migrations with the Slonik migrator.

57|15|Updated Nov 28, 2018
One-click install
npx skills add https://github.com/digirati-co-uk/madoc-platform --skill db-migrations-digirati-co-uk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: db-migrations
Source: https://github.com/digirati-co-uk/madoc-platform/tree/main/.agents/skills/db-migrations
Command: npx skills add https://github.com/digirati-co-uk/madoc-platform --skill db-migrations-digirati-co-uk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill clarifies how Madoc TypeScript database migrations are organized and executed so contributors can add SQL migrations safely and ensure they run correctly in development and deployment environments.

Core Features & Use Cases

  • Explains migration file layout, naming conventions, and where migration scripts live under services/madoc-ts/migrations.
  • Describes Slonik migrator setup and the primary entrypoints used to run migrations, including the TypeScript and CommonJS runners.
  • Covers required environment variables and common pitfalls such as filename format, migration ordering, and mismatched migration paths.
  • Use Case: Add a new SQL migration to evolve the schema, verify it applies against a clean database, and deploy it as part of your CI/CD pipeline.

Quick Start

Run the migrator from services/madoc-ts using the src/migrate.ts or migrate.cjs entrypoints with DATABASE_* environment variables set to apply pending SQL migrations to the target database.

Frequently Asked Questions about db-migrations

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

FAQPage Schema
How do I run Slonik database migrations for Madoc TypeScript?

To run database migrations for Madoc TypeScript, execute the src/migrate.ts or migrate.cjs entrypoints from the services/madoc-ts directory with the appropriate DATABASE_* environment variables set to apply pending SQL files to the target database.

How do I run Slonik database migrations for Madoc TypeScript?

You need to configure appropriate DATABASE_* environment variables to execute Madoc database migrations. These variables provide the connection details required by the Slonik migrator to apply SQL files to your target database during development or deployment.

What environment variables do I need to execute Madoc database migrations?

The correct file layout for Madoc TypeScript database migrations places SQL migration files in services/madoc-ts/migrations, with execution entrypoints located in services/madoc-ts/src/migrate.ts and migrate.cjs to ensure the migrator finds and applies schema changes properly.

What is the correct file layout for Madoc TypeScript database migrations?

TypeScript database migrations may fail to apply during deployment due to common pitfalls like incorrect filename formats, mismatched migration paths in services/madoc-ts, or missing DATABASE_* environment variables required by the Slonik migrator entrypoints.

Why are my TypeScript database migrations not applying during deployment?

Yes, you can use CommonJS to run Madoc database migrations by utilizing the migrate.cjs entrypoint alongside the TypeScript runner, allowing flexible integration within different development and deployment workflows while applying pending SQL files.

Can I use CommonJS to run Madoc database migrations instead of TypeScript?

Yes, you can use CommonJS to run Madoc database migrations by utilizing the migrate.cjs entrypoint alongside the TypeScript runner, allowing flexible integration within different development and deployment workflows while applying pending SQL files.