Skip to content

Commit 324e5c3

Browse files
authored
Refactor README for clarity and add CLI tool section
Updated README to improve clarity and added optional installation instructions for the CLI tool.
1 parent 25ea464 commit 324e5c3

1 file changed

Lines changed: 25 additions & 8 deletions

File tree

README.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
</p>
88

99
<p align="center">
10-
<strong>
11-
A SQLite compiler, static analyzer and code generator for Swift ❤️
12-
</strong>
10+
<strong>A SQLite compiler, static analyzer and code generator for Swift ❤️</strong>
11+
</p>
12+
13+
<p align="center">
14+
<em>Just write SQL</em>
1315
</p>
1416

1517
# Overview
@@ -158,24 +160,39 @@ let package = Package(
158160
#### Xcode Project Plugin Setup
159161
For projects using an `xcodeproj` to setup the plugin it can be enabled by selecting the target and going to `Build Phases > Run Build Tool Plug-ins` and adding it to the list by selecting the plus.
160162

161-
## Install CLI tool
163+
## (Optional) Install CLI tool
162164
You can install the CLI tool via homebrew by executing:
163165
```
164166
brew tap wickwirew/wickwirew
165167
brew install puresql
166168
```
167169

168-
Once the project has been added it is time to setup the queries and migrations folders. In the root of the project where you want everything to live, in terminal run the following command
170+
## Create a puresql.yaml Configuration
171+
In the root of the project where you want everything to live, create an `puresql.yaml` file.
172+
```yaml
173+
# puresql.yaml
174+
175+
# The type name of the generated struct for the database
176+
databaseName: DB
177+
# Path to the directory containing the migrations
178+
migrations: Sources/Migrations
179+
# Path to the directory containing the queries
180+
queries: Sources/Queries
181+
# The path of the file to generate the Swift code into
182+
# ⚠️ This is not needed and ignored if using the plugin
183+
output: Sources/Queries.swift
184+
```
185+
186+
Optionally, this can be generated automatically via the cli by running the run the following command:
169187
```
170188
puresql init
171189
```
172190

173-
This will create an `puresql.yaml` configuration file. Here is where you can setup the project and define the directories of the migrations and queries and other project settings.
174-
175191
> [!TIP]
176192
> Follow the SQL standard and use singular table names. This will stop table structs from being named plural
177193
178-
### Adding a New Migration
194+
### Adding Your First Migration
195+
The build tool will error if it is unable to find the `/Migrations` folder defined in the `puresql.yaml` file. Make sure the folder exists and add your first migration `0.sql`.
179196
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
180197
```
181198
puresql migrations add

0 commit comments

Comments
 (0)