db-migration-mysql-postgres

db-migration-mysql-postgres is a skill for Claude Code, Codex from sandeepmvl/rails-skills. It costs 127 tokens per session (1,664 once invoked), scanned A, original, MIT.

A guide to moving a Ruby on Rails application's main database from MySQL to PostgreSQL. It explains data conversion and differences such as JSON, booleans, enums, indexes, arrays, and case-sensitive searches.

In plain words
What is it for?
Use it when planning or performing a MySQL-to-PostgreSQL migration, including bulk transfer, schema changes, and a low-downtime cutover.
Why use it?
It prevents silent data and query changes during migration and helps the application use PostgreSQL features instead of merely copying the old schema.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when planning or performing a MySQL-to-PostgreSQL migration, including bulk transfer, schema changes, and a low-downtime cutover.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sandeepmvl/rails-skills/22-db-migration-mysql-postgres
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add sandeepmvl/rails-skills --skill 22-db-migration-mysql-postgres
Clone the repo
git clone --depth 1 https://github.com/sandeepmvl/rails-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for db-migration-mysql-postgres

README.md
[![agentmods](https://agentmods.dev/badge/skills/sandeepmvl/rails-skills/22-db-migration-mysql-postgres/github.svg)](https://agentmods.dev/skills/sandeepmvl/rails-skills/22-db-migration-mysql-postgres)
Your own site
<a href="https://agentmods.dev/skills/sandeepmvl/rails-skills/22-db-migration-mysql-postgres"><img src="https://agentmods.dev/badge/skills/sandeepmvl/rails-skills/22-db-migration-mysql-postgres/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for db-migration-mysql-postgres

Your own site · 80×15
<a href="https://agentmods.dev/skills/sandeepmvl/rails-skills/22-db-migration-mysql-postgres"><img src="https://agentmods.dev/badge/skills/sandeepmvl/rails-skills/22-db-migration-mysql-postgres.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 127 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,664 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00127 $0.01664
Opus 5 $0.00063 $0.00832
Sonnet 5 $0.00025 $0.00333
Haiku 4.5 $0.00013 $0.00166

Measured 11d ago against content hash 3e8161d9c479, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

db-migration-mysql-postgres scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/22-db-migration-mysql-postgres/SKILL.md · 177 lines

How it starts

The opening of the file, as written. The whole thing — 177 lines — stays where its author put it; the contents beside it link to each section on GitHub.

MySQL → Postgres Migration

Going from MySQL to Postgres is mostly an upgrade. You gain JSONB with rich operators, partial indexes, true booleans, ARRAY columns, generated columns since 12, and rich CHECK constraints. Plan for the data conversion carefully — pgloader handles most of it.

The opinion

pgloader for bulk migration. Dual-write cutover for zero-downtime. Plan for the schema upgrades — don't just translate, take advantage of Postgres features (JSONB instead of JSON, BOOLEAN instead of TINYINT, partial indexes, generated columns).

Pre-migration: what improves

MySQL Postgres Why it matters
JSON JSONB Indexed queries via GIN; @> containment
TINYINT(1) for booleans BOOLEAN Type-safe; no 0/1 ambiguity
ENUM Native enum OR CHECK constraint + ActiveRecord enum Rename without table lock
No partial indexes Partial indexes Index only relevant rows; smaller, faster
No ARRAY columns ARRAY columns Native array storage for simple cases
LIKE case-insensitive LIKE case-sensitive (use ILIKE) Match-semantics change
No deferrable FK Deferrable FK Bulk-load patterns easier
Generated columns (5.7+) Generated columns (12+) Both have them; syntax slightly different

Core patterns

Pattern 1: pgloader migration

brew install pgloader

cat > migrate.load <<EOF
LOAD DATABASE
  FROM mysql://user:pass@source-host/myapp_production
  INTO postgresql://user:pass@target-host/myapp_production

WITH include drop, create tables, create indexes, reset sequences,
     workers = 8, concurrency = 1, multiple readers per thread

SET PostgreSQL PARAMETERS
     maintenance_work_mem to '512MB',
     work_mem to '32MB'

CAST type tinyint when (= precision 1) to boolean drop typemod,
     type datetime to timestamptz drop default drop not null using zero-dates-to-null
;
EOF

pgloader migrate.load

Key casts:

  • tinyint(1) → boolean — Rails treats 0/1 TINYINT as bool but the schema is more explicit as BOOLEAN.
  • datetime → timestamptz — Postgres has true timezone support; bring data forward as UTC.
  • zero-dates-to-null — MySQL allows 0000-00-00; Postgres doesn't.

Read the full file on GitHub · 177 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 177 lines · 127 tokens per session scan A 3e8161d9c479

Subscribe to this mod's changes

db-migration-mysql-postgres is a skill published in the GitHub repository sandeepmvl/rails-skills (21 stars, last pushed 3mo ago), licensed MIT. It adds 127 tokens to every session and 1,664 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

azure-resource-manager-postgresql-dotnet

Azure PostgreSQL Flexible Server SDK for .NET. Database management for PostgreSQL Flexible Server deployments. Use for creating servers, databases, firewall rules, configurations, backups, and high availability. Triggers: "PostgreSQL", "PostgreSqlFlexibleServer", "PostgreSQL Flexible Server", "Azure Database for…

microsoft/skills · 97 tokens

ecto-patterns

Ecto patterns — schemas, changesets, queries, migrations, Multi, associations, preloads, upserts. Use when editing Repo calls, Ecto.Query, or schema fields. Skip for Ash.

oliver-kriska/claude-elixir-phoenix · 45 tokens

kysely

Guidelines for developing with Kysely, a type-safe TypeScript SQL query builder with autocompletion support.

Mindrally/skills · 26 tokens

sqlsugar

Use when doing multi-database ORM operations in .NET — SQL Server, MySQL, PostgreSQL, SQLite, Oracle with fluent API, code-first, and LINQ. SqlSugar: high-performance .NET ORM supporting 10+ databases.

znlgis/opengis-skills · 53 tokens

activerecord

This skill should be used when the user asks to "write a migration", "add a column", "add column to table", "create an index", "add a foreign key", "set up associations", "fix N+1 queries", "optimize queries", "add validations", "create callbacks", "use eager loading", or mentions ActiveRecord, belongsto, hasmany…

hoblin/claude-ruby-marketplace · 180 tokens

code-conversion-only

Convert local source code to Snowflake SQL for code-conversion-only source systems such as Sybase IQ, Azure Synapse, Spark SQL, Databricks SQL, Greenplum, Netezza, Vertica, and Hive. Optionally repoints Power BI reports. Use when configure returns projecttype codeconversiononly for these sources.

sfc-gh-dflippo/snowflake-dbt-demo · 73 tokens