Skip to content

Commit e9f8951

Browse files
committed
Update readme
1 parent 13dbce9 commit e9f8951

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

README.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,21 @@ Otter supports Swift Package Manager. To install add the following to your `Pack
129129
let package = Package(
130130
[...]
131131
dependencies: [
132-
.Package(url: "https://github.com/wickwirew/Otter.git", from: "...")
132+
.package(url: "https://github.com/wickwirew/Otter.git", from: "...")
133+
],
134+
targets: [
135+
.target(
136+
name: "MyProject",
137+
dependencies: ["Otter"],
138+
// ⚠️ Plugin is optional, can just use the CLI if desired
139+
plugins: [.plugin(name: "OtterPlugin", package: "Otter")]
140+
),
133141
]
134142
)
135143
```
136144

137-
Also the cli tool will be needed to be installed.
145+
## Install CLI tool
146+
You can install the CLI tool via homebrew by executing:
138147
```
139148
brew tap wickwirew/wickwirew
140149
brew install otter
@@ -150,19 +159,22 @@ This will create an `otter.yaml` configuration file. Here is where you can setup
150159
> [!TIP]
151160
> Follow the SQL standard and use singular table names. This will stop table structs from being named plural
152161
153-
#### Generating the Database
162+
### Adding a New Migration
163+
When a new migration is needed, you can simply add a new file with a number 1 higher than the previous. To automatically do this the cli tool can do it for you by running
164+
```
165+
otter migrations add
166+
```
167+
168+
#### Generating the Database - Without Plugin
154169
Once you have your first migration in and the project setup you can now generate the database. In the same directory where `init` was run, you run the `gen` command.
155170
```
156-
otter gen --output Queries.swift
171+
otter generate
157172
```
158173

159174
This will compile and check all migrations and queries, then generate all Swift required to talk to the database.
160175

161-
### Adding a New Migration
162-
When a new migration is needed, you can simply add a new file with a number 1 higher than the previous. To automatically do this the cli tool can do it for you by running
163-
```
164-
otter migrations add
165-
```
176+
> [!WARNING]
177+
> Plugin requires a clean build any time a new `sql` file is added so the input file list can be updated.
166178
167179
# Opening a Connection
168180
Once you have your database being generated, you can now open a connection to it. Each database will automatically have a few initializers at hand to choose from. Each are listed below. When the connection is opened, all migrations are run instantly.

0 commit comments

Comments
 (0)