sql updates
Some checks are pending
CI / Lint (push) Waiting to run
CI / Test (push) Waiting to run
CI / End-to-End (push) Waiting to run
CI / Publish Docker (push) Blocked by required conditions
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-09-13 09:25:12 +10:00
parent 3f2a67cf7b
commit f0278388cb
6 changed files with 209 additions and 26 deletions

View File

@@ -28,13 +28,17 @@ A few different technologies are configured to help getting off the ground easie
- The script `upgrade_templ.sh` is available to make upgrading easier
- [HTMX](https://htmx.org/) for HTML interaction
- The script `upgrade_htmx.sh` is available to make upgrading easier
- [goose](https://github.com/pressly/goose) for DB migrations
- [golang migrate](https://github.com/golang-migrate/migrate) for DB migrations, TODO replace with [goose](https://github.com/pressly/goose)
Technologies we're no longer using:
- [golang migrate](https://github.com/golang-migrate/migrate) for DB migrations
- [playwright-go](https://github.com/playwright-community/playwright-go) for E2E testing.
Everything else uses the standard library.
## Structure
(Now out of date)
```text
.
@@ -97,28 +101,18 @@ This is where `templ` files live. Anything you want to render to the user goes h
This is the directory that `sqlc` generates to. Update `queries.sql` to build
your database operations.
Once `queries.sql` is updated, run `make generate-sql` to update the generated models
#### DB Migrations
This project now uses [goose](https://github.com/pressly/goose) for DB migrations.
Install via `brew install goose` on a mac, or install via golang with command `go install github.com/pressly/goose/v3/cmd/goose@latest`
Create a new up/down migration file with this command
```shell
goose -dir db/migrations sqlite3 ./db.sqlite3 create init sql
```
#### Deprecated
This project no longer uses [golang migrate](https://github.com/golang-migrate/migrate) for DB
migrations. `sqlc` uses the `db/migrations` directory to generating DB tables. Call
`db.Migrate(..)` to automatically migrate your database to the latest version. To add migration
call the following command,
```shell
migrate create -ext sql -dir db/migrations <name of migration>
```
This package can be easily update to use `sqlx` as well.
### Dist
This is where your assets live. Any Javascript, images, or styling needs to go in the