Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 21 additions & 50 deletions docs/src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@
title: goway
description: A version-based database schema migration library for Go, modeled on Flyway, for PostgreSQL and SQLite.
template: splash
# The landing page omits the "Edit page" link and the prev/next pagination footer.
editUrl: false
prev: false
next: false
hero:
tagline: A version-based database schema migration library for Go, modeled on Flyway. Discover SQL migrations, record them in a schema history table, and bring PostgreSQL or SQLite up to date — with a zero-dependency core.
title: Database Migrations for Go
tagline: A version-based database schema migration library for Go, modeled on Flyway, for PostgreSQL and SQLite.
image:
file: ../../assets/sql-file.png
alt: goway
actions:
- text: Get Started
link: /goway/getting-started/
icon: right-arrow
variant: primary
- text: View on GitHub
link: https://github.com/cgardev/goway
icon: external
Expand All @@ -18,67 +25,31 @@ hero:

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

## Why goway?

goway brings Flyway's proven migration model to Go: immutable, ordered,
checksummed SQL migrations recorded in a schema history table. It runs inside
your own application using the connection pool you already own, so there is no
external binary to install and no heavyweight framework to adopt.
## Why goway

<CardGrid stagger>
<Card title="Zero-Dependency Core" icon="rocket">
The library depends only on the standard library. Database access goes
<Card title="Zero dependencies" icon="seti:lock">
The core library uses only the Go standard library; database access goes
through `database/sql`, so you bring your own driver.
</Card>
<Card title="PostgreSQL & SQLite" icon="seti:db">
<Card title="PostgreSQL and SQLite" icon="seti:db">
First-class support for both, with SQLite handled by the pure-Go
`modernc.org/sqlite` driver no cgo required.
`modernc.org/sqlite` driver, so no cgo is required.
</Card>
<Card title="Flyway-Compatible" icon="approve-check">
<Card title="Flyway-compatible" icon="approve-check">
The same `V`/`R` naming, the same CRC32 checksums, and the same
`flyway_schema_history` table, so existing migration sets just work.
</Card>
<Card title="Embeddable" icon="document">
Read migrations from the file system or embed them into your binary with
`go:embed`. Run migrate at startup, in tests, or from the CLI.
`go:embed`, and run migrate at startup, in tests, or from the CLI.
</Card>
</CardGrid>

## Installation

```sh
go get github.com/cgardev/goway
```

## A Quick Taste

```go
migrator, err := goway.Configure().
DataSource(database).
Locations("filesystem:db/migration").
Schemas("public").
Load()
if err != nil {
log.Fatal(err)
}

result, err := migrator.Migrate(context.Background())
// applied N migration(s); schema is now at version X
```

[Get Started →](/goway/getting-started/)

## What's Next?

<CardGrid>
<Card title="Guides" icon="open-book">
Learn the core concepts step-by-step, from writing your first migration to
callbacks and dialects.
<Card title="The full command set" icon="list-format">
`migrate`, `info`, `validate`, `baseline`, `repair`, and `clean` cover the
complete migration workflow.
</Card>
<Card title="Reference" icon="list-format">
Detailed documentation for every part of the API, from the configuration
builder to the schema history table.
<Card title="Callbacks and hooks" icon="random">
Run SQL or Go callbacks around migrations, and mark scripts to run outside
a transaction when a statement requires it.
</Card>
</CardGrid>

[Browse the Guides →](/goway/guides/writing-migrations/)
Loading