You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-15
Original file line number
Diff line number
Diff line change
@@ -19,33 +19,33 @@
19
19
-**Embed migration folders** containing your SQL scripts
20
20
- Hardcoded SQL statements
21
21
- 🟢 **Branching and merging compatible:**_adapt_ automatically catches up with missing migrations ("holes")
22
-
- 🟢 **Zero** external dependencies*
23
-
24
-
<sub>* <i>adapt</i> includes <ahref="https://pkg.go.dev/github.com/harwoeck/liblog/contract">liblog/contract</a> (a public contract - Go <code>interface</code> - for logging backends, so you can provide your own structured, leveled logging)
22
+
- 🟢 **Zero** external dependencies
23
+
- 🟢 **Customizable Logging:**_adapt_ uses [`slog`](https://pkg.go.dev/log/slog)[included with Go 1.21+](https://go.dev/blog/slog) so that you can provide your own logging backend.
25
24
26
25
#### Supported Storage `Driver`
27
26
28
-
-[File](https://pkg.go.dev/github.com/harwoeck/adapt/core#NewFileDriver) - Basic driver that stores migration meta-data in a local JSON file (demonstrates how a `Driver` without any reliance or dependency on `database/sql` can be written.)
-[File](https://pkg.go.dev/github.com/harwoeck/adapt#NewFileDriver) - Basic driver that stores migration meta-data in a local JSON file (demonstrates how a `Driver` without any reliance or dependency on `database/sql` can be written.)
**Any other storage backend** by providing your own [`Driver`](https://pkg.go.dev/github.com/harwoeck/adapt/core#Driver), [`DatabaseDriver`](https://pkg.go.dev/github.com/harwoeck/adapt/core#DatabaseDriver) or [`SqlStatementsDriver`](https://pkg.go.dev/github.com/harwoeck/adapt/core#SqlStatementsDriver). Unlike most other migration tools, with _adapt_ there is no reliance on `database/sql` (such a case can be seen with the included `FileDriver`)
33
+
**Any other storage backend** by providing your own [`Driver`](https://pkg.go.dev/github.com/harwoeck/adapt#Driver), [`DatabaseDriver`](https://pkg.go.dev/github.com/harwoeck/adapt#DatabaseDriver) or [`SqlStatementsDriver`](https://pkg.go.dev/github.com/harwoeck/adapt#SqlStatementsDriver). Unlike most other migration tools, with _adapt_ there is no reliance on `database/sql` (such a case can be seen with the included `FileDriver`)
-[Embedded Filesystem](https://pkg.go.dev/github.com/harwoeck/adapt#NewEmbedFSSource) - Using Go 1.16+ [go:embed](https://pkg.go.dev/embed)
42
41
42
+
> [!NOTE]
43
43
> Please support this project and provide additional sources that could be useful for other people
44
44
45
45
### Install
46
46
47
47
```bash
48
-
$ go get github.com/harwoeck/adapt/core
48
+
$ go get github.com/harwoeck/adapt
49
49
```
50
50
51
51
## Usage
@@ -61,13 +61,14 @@ err := adapt.Migrate(
61
61
})
62
62
```
63
63
64
-
**Next example:** Due to compliance rules you decide encrypt the email address of your users inside your database. Using _adapt_ you simply provide one of [`adapt.Hook`](https://pkg.go.dev/github.com/harwoeck/adapt/core#Hook)'s callback functions and during your next deployment _adapt_ will notice that this migration hasn't been applied and therefore call your migration hook. When no error is returned _adapt_ will commit the transaction and update the schema table with the relevant meta information.
64
+
> [!NOTE]
65
+
> **Next example:** Due to compliance rules you decide to encrypt your users email addresses inside your database. Since this requires actual Go code (and not just SQL statements), you could implement one of the [`adapt.Hook`](https://pkg.go.dev/github.com/harwoeck/adapt#Hook) functions and during your next deployment _adapt_ will notice this new unapplied migration and execute your hook. When no error is returned _adapt_ will commit the transaction and update the schema table with the relevant meta information.
0 commit comments