Skip to content

Commit 1b7f060

Browse files
committed
Update badges
1 parent 96cde33 commit 1b7f060

1 file changed

Lines changed: 42 additions & 34 deletions

File tree

README.md

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
> SQL Schema migration tool for [Go](https://golang.org/). Based on [gorp](https://github.com/go-gorp/gorp) and [goose](https://bitbucket.org/liamstask/goose).
44
5-
[![Build Status](https://travis-ci.org/rubenv/sql-migrate.svg?branch=master)](https://travis-ci.org/rubenv/sql-migrate) [![GoDoc](https://godoc.org/github.com/rubenv/sql-migrate?status.svg)](https://godoc.org/github.com/rubenv/sql-migrate)
5+
[![Test](https://github.com/rubenv/sql-migrate/actions/workflows/test.yml/badge.svg)](https://github.com/rubenv/sql-migrate/actions/workflows/test.yml) [![Go Reference](https://pkg.go.dev/badge/github.com/rubenv/sql-migrate.svg)](https://pkg.go.dev/github.com/rubenv/sql-migrate)
66

77
## Features
88

9-
* Usable as a CLI tool or as a library
10-
* Supports SQLite, PostgreSQL, MySQL, MSSQL and Oracle databases (through [gorp](https://github.com/go-gorp/gorp))
11-
* Can embed migrations into your application
12-
* Migrations are defined with SQL for full flexibility
13-
* Atomic migrations
14-
* Up/down migrations to allow rollback
15-
* Supports multiple database types in one project
16-
* Works great with other libraries such as [sqlx](https://jmoiron.github.io/sqlx/)
17-
* Supported on go1.13+
9+
- Usable as a CLI tool or as a library
10+
- Supports SQLite, PostgreSQL, MySQL, MSSQL and Oracle databases (through [gorp](https://github.com/go-gorp/gorp))
11+
- Can embed migrations into your application
12+
- Migrations are defined with SQL for full flexibility
13+
- Atomic migrations
14+
- Up/down migrations to allow rollback
15+
- Supports multiple database types in one project
16+
- Works great with other libraries such as [sqlx](https://jmoiron.github.io/sqlx/)
17+
- Supported on go1.13+
1818

1919
## Installation
2020

@@ -23,7 +23,9 @@ To install the library and command line program, use the following:
2323
```bash
2424
go get -v github.com/rubenv/sql-migrate/...
2525
```
26+
2627
For Go version from 1.18, use:
28+
2729
```bash
2830
go install github.com/rubenv/sql-migrate/...@latest
2931
```
@@ -48,15 +50,15 @@ Each command requires a configuration file (which defaults to `dbconfig.yml`, bu
4850

4951
```yml
5052
development:
51-
dialect: sqlite3
52-
datasource: test.db
53-
dir: migrations/sqlite3
53+
dialect: sqlite3
54+
datasource: test.db
55+
dir: migrations/sqlite3
5456

5557
production:
56-
dialect: postgres
57-
datasource: dbname=myapp sslmode=disable
58-
dir: migrations/postgres
59-
table: migrations
58+
dialect: postgres
59+
datasource: dbname=myapp sslmode=disable
60+
dir: migrations/postgres
61+
table: migrations
6062
```
6163
6264
(See more examples for different set ups [here](test-integration/dbconfig.yml))
@@ -66,10 +68,10 @@ This may be useful if one doesn't want to store credentials in file:
6668

6769
```yml
6870
production:
69-
dialect: postgres
70-
datasource: host=prodhost dbname=proddb user=${DB_USER} password=${DB_PASSWORD} sslmode=require
71-
dir: migrations
72-
table: migrations
71+
dialect: postgres
72+
datasource: host=prodhost dbname=proddb user=${DB_USER} password=${DB_PASSWORD} sslmode=require
73+
dir: migrations
74+
table: migrations
7375
```
7476

7577
The `table` setting is optional and will default to `gorp_migrations`.
@@ -112,6 +114,7 @@ $ sql-migrate status
112114
```
113115

114116
#### Running Test Integrations
117+
115118
You can see how to run setups for different setups by executing the `.sh` files in [test-integration](test-integration/)
116119

117120
```bash
@@ -126,15 +129,16 @@ If you are using MySQL, you must append `?parseTime=true` to the `datasource` co
126129

127130
```yml
128131
production:
129-
dialect: mysql
130-
datasource: root@/dbname?parseTime=true
131-
dir: migrations/mysql
132-
table: migrations
132+
dialect: mysql
133+
datasource: root@/dbname?parseTime=true
134+
dir: migrations/mysql
135+
table: migrations
133136
```
134137

135138
See [here](https://github.com/go-sql-driver/mysql#parsetime) for more information.
136139

137140
### Oracle (oci8)
141+
138142
Oracle Driver is [oci8](https://github.com/mattn/go-oci8), it is not pure Go code and relies on Oracle Office Client ([Instant Client](https://www.oracle.com/database/technologies/instant-client/downloads.html)), more detailed information is in the [oci8 repo](https://github.com/mattn/go-oci8).
139143

140144
#### Install with Oracle support
@@ -147,43 +151,46 @@ go get -tags oracle -v github.com/rubenv/sql-migrate/...
147151

148152
```yml
149153
development:
150-
dialect: oci8
151-
datasource: user/password@localhost:1521/sid
152-
dir: migrations/oracle
153-
table: migrations
154+
dialect: oci8
155+
datasource: user/password@localhost:1521/sid
156+
dir: migrations/oracle
157+
table: migrations
154158
```
155159

156160
### Oracle (godror)
161+
157162
Oracle Driver is [godror](https://github.com/godror/godror), it is not pure Go code and relies on Oracle Office Client ([Instant Client](https://www.oracle.com/database/technologies/instant-client/downloads.html)), more detailed information is in the [godror repository](https://github.com/godror/godror).
158163

159164
#### Install with Oracle support
160165

161166
To install the library and command line program, use the following:
162167

163168
1. Install sql-migrate
169+
164170
```bash
165171
go get -tags godror -v github.com/rubenv/sql-migrate/...
166172
```
167173

168174
2. Download Oracle Office Client(e.g. macos, click [Instant Client](https://www.oracle.com/database/technologies/instant-client/downloads.html) if you are other system)
175+
169176
```bash
170177
wget https://download.oracle.com/otn_software/mac/instantclient/193000/instantclient-basic-macos.x64-19.3.0.0.0dbru.zip
171178
```
172179

173180
3. Configure environment variables `LD_LIBRARY_PATH`
181+
174182
```
175183
export LD_LIBRARY_PATH=your_oracle_office_path/instantclient_19_3
176184
```
177185
178186
```yml
179187
development:
180-
dialect: godror
181-
datasource: user/password@localhost:1521/sid
182-
dir: migrations/oracle
183-
table: migrations
188+
dialect: godror
189+
datasource: user/password@localhost:1521/sid
190+
dir: migrations/oracle
191+
table: migrations
184192
```
185193

186-
187194
### As a library
188195

189196
Import sql-migrate into your application:
@@ -254,6 +261,7 @@ Note that `n` can be greater than `0` even if there is an error: any migration t
254261
Check [the GoDoc reference](https://godoc.org/github.com/rubenv/sql-migrate) for the full documentation.
255262

256263
## Writing migrations
264+
257265
Migrations are defined in SQL files, which contain a set of SQL statements. Special comments are used to distinguish up and down migrations.
258266

259267
```sql

0 commit comments

Comments
 (0)