diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 114 |
1 files changed, 102 insertions, 12 deletions
@@ -5,22 +5,112 @@  [](https://builds.sr.ht/~eugenetriguba/bolt/commits/main?) -Bolt is a command-line tool designed to simplify and streamline your -database migration process. +Bolt is a command-line tool for database migrations. + +## Why Bolt? + +Bolt aims to be a simple and reliable tool that can work anywhere you need to +run database migrations. + +- 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. + +## What It Looks Like + +Migrations are separated by "up" and "down" comments to delineate what runs when +you apply the migration and what runs when you revert it. Additionally, +migrations have dependencies which are what determine the execution order. + +```sql +-- depends: 20240316145038 +-- migrate:up +CREATE TABLE posts ( + id SERIAL PRIMARY KEY, + user_id INTEGER NOT NULL REFERENCES users(id), + title VARCHAR(255) NOT NULL, + content TEXT NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT NOW() +); + +-- migrate:down +DROP TABLE posts; +``` + +```bash +$ bolt status +Version Message Applied +20240316145038 create_users_table X +20240317120000 create_posts_table X +20240318093000 add_email_index +``` + +## Installation + +### From Source + +Clone the repository: + +``` +git clone https://git.sr.ht/~eugenetriguba/bolt +``` + +Build the binary: + +``` +cd bolt +make +``` + +Install the binary and man pages: + +``` +sudo make install +``` + +### Homebrew + +If you're on macOS (or Linux and use Homebrew), you can install Bolt from the tap: + +```bash +brew tap eugenetriguba/bolt https://git.sr.ht/~eugenetriguba/homebrew-bolt +brew install bolt +``` ## Documentation -For the full documentation, visit **[bolt.eugenetriguba.com](https://bolt.eugenetriguba.com/)** +After installation, documentation is available via man pages. -- [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](https://bolt.eugenetriguba.com/contributing/) +### Commands -## License +| Page | Description | +|------|-------------| +| bolt(1) | Main command overview | +| bolt-new(1) | Create a new migration | +| bolt-up(1) | Apply migrations | +| bolt-down(1) | Revert migrations | +| bolt-status(1) | List migration statuses | +| bolt-version(1) | Print version | +| bolt-help(1) | Show manual pages | + +### File Formats + +| Page | Description | +|------|-------------| +| bolt.toml(5) | Configuration file and environment variables | +| bolt-migration(5) | Migration script format | -MIT License +### Concepts + +| Page | Description | +|------|-------------| +| bolt-tutorial(7) | Getting started tutorial | +| bolt-databases(7) | Database drivers and DSN formats | +| bolt-dependencies(7) | Migration dependency system | +| bolt-execution(7) | How migrations are executed | + +## License -See [LICENSE](./LICENSE) file for details. +MIT License. See [LICENSE](./LICENSE) for details. |