aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: bf43aecfce6e67466c6c26fe17c825a9b3f4f732 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Bolt

[![GoDoc](https://godoc.org/git.sr.ht/~eugenetriguba/bolt?status.svg)](https://godoc.org/git.sr.ht/~eugenetriguba/bolt)
[![Go Report Card](https://goreportcard.com/badge/git.sr.ht/~eugenetriguba/bolt)](https://goreportcard.com/report/git.sr.ht/~eugenetriguba/bolt)
![Version](https://img.shields.io/badge/version-0.11.0-blue)
[![Build Status](https://builds.sr.ht/~eugenetriguba/bolt/commits/main.svg)](https://builds.sr.ht/~eugenetriguba/bolt/commits/main?)

Bolt is a command-line tool designed to simplify and streamline your database migration process.

It is distributed as a standalone binary, making it easy to run anywhere without having to setup any tooling, and it is language independent. It doesn't matter what programming language you're using, you can use Bolt for any project you have.

## Features

- Schema migrations are written in plain SQL
- Migrations can be versioned sequentially or by creation timestamp
- All migrations run in transactions by default
- Supports up and down migrations and jumping to any particular schema version
- Supports PostgreSQL, MySQL, SQL Server, and SQLite3

## Quick Start

### Install

```bash
# Using Go
go install git.sr.ht/~eugenetriguba/bolt/cmd/bolt@v0.11.0

# Using Homebrew
brew tap eugenetriguba/bolt https://git.sr.ht/~eugenetriguba/homebrew-bolt
brew install bolt
```

### Create a migration

```bash
bolt new -m "create users table"
```

### Write your migration

Edit the generated SQL file in `migrations/`:

```sql
-- migrate:up
CREATE TABLE users (
    id SERIAL PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    email VARCHAR(255) NOT NULL,
    created_at TIMESTAMP NOT NULL DEFAULT NOW()
);

-- migrate:down
DROP TABLE users;
```

### Configure and apply

Create `bolt.toml`:

```toml
[database]
dsn = "postgresql://user:password@localhost:5432/mydb?sslmode=disable"
driver = "postgresql"
```

Apply the migration:

```bash
bolt up
```

## Documentation

For complete documentation, visit **[bolt.eugenetriguba.com](https://bolt.eugenetriguba.com/)**

- [Installation Guide](https://bolt.eugenetriguba.com/installation/)
- [Tutorial](https://bolt.eugenetriguba.com/tutorial/)
- [How-To Guides](https://bolt.eugenetriguba.com/how-to/)
- [Reference](https://bolt.eugenetriguba.com/reference/)
- [Explanation](https://bolt.eugenetriguba.com/explanation/)

## Contributing

For information on how to contribute to Bolt, see the [Contributing Guide](https://bolt.eugenetriguba.com/contributing/).

## License

MIT License - see [LICENSE](LICENSE) file for details.