# Migrate from another tool

Convert a migration directory written by another tool, or keep running the commands you have through the Atlas-compatible binary.

Source: https://docs.ptah.run/v0.8.0/migrate-from/overview/

import { LinkCard, CardGrid } from '@astrojs/starlight/components';

Nothing here asks you to rewrite applied history. Each page starts from a
directory the other tool wrote, converts it, and shows the state afterwards.
Every command on every page runs in this repository's continuous integration
against the version of Ptah the page was published with.

## Pick the tool you are coming from

<CardGrid>
  <LinkCard title="golang-migrate" href="../golang-migrate/" description="Convert NNN_name.up.sql and .down.sql pairs, including a migration whose down file was never written." />
  <LinkCard title="Goose" href="../goose/" description="Convert annotated single files, including a statement block and a migration that must run outside a transaction." />
  <LinkCard title="dbmate" href="../dbmate/" description="Convert timestamped single files, and read what the conversion did to their version numbers." />
  <LinkCard title="Flyway" href="../flyway/" description="Convert versioned, undo and repeatable scripts, and learn what a repeatable becomes." />
  <LinkCard title="Liquibase" href="../liquibase/" description="Convert the changesets that carry SQL, and read the refusal that names the ones that do not." />
  <LinkCard title="Atlas" href="../atlas/" description="Keep the atlas.hcl, the directory and the commands, and run them through ptah-compat." />
</CardGrid>

More tools are being added here one at a time. Until a tool has its own page,
[Import an existing migration directory](../../versioned/import/) covers the
conversion and carries the format table for every source Ptah reads.

## Two different moves

Converting a directory and keeping your commands are separate decisions, and
you do not have to make both.

**Convert the directory.** `ptah migrations import` reads the other tool's
layout and writes Ptah's, sealed with `ptah.sum`. The source directory is left
untouched. This is what the pages above walk through.

**Keep the commands.** If you run Atlas today, `ptah-compat` reads the
`atlas.hcl` you have and answers the commands you already run, with no
conversion at all. [Run an Atlas project on ptah-compat](../atlas/) is the
first mile, command by command; [Migrate from Atlas](../../atlas/adoption/)
carries on from there for readers who want to go native.

## What a conversion does not do

A converted directory is a set of files. It says nothing about the databases
that already ran the old tool, and applying it to one of them would replay
migrations those databases already have.

Record that history as applied first. [Adopt an existing
database](../../start/adopt-an-existing-database/) is the procedure, and it is
the step people skip.
