Add recommended build options for drift postgres

This commit is contained in:
Simon Binder 2024-02-25 00:06:12 +01:00
parent 417c2c1207
commit 98fd6a0ef0
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
2 changed files with 26 additions and 0 deletions

View File

@ -4,8 +4,10 @@ talking to PostgreSQL databases by using the `postgres` package.
## Using this
For general notes on using drift, see [this guide](https://drift.simonbinder.eu/getting-started/).
Detailed docs on getting started with `drift_postgres` are available [here](https://drift.simonbinder.eu/docs/platforms/postgres/#setup).
To use drift_postgres, add this to your `pubspec.yaml`
```yaml
dependencies:
drift: "$latest version"
@ -25,6 +27,21 @@ final database = AppDatabase(PgDatabase(
));
```
Also, consider adding builder options to make drift generate postgres-specific code:
```yaml
# build.yaml
targets:
$default:
builders:
drift_dev:
options:
sql:
dialects:
- sqlite # remove this line if you only need postgres
- postgres
```
## Running tests
To test this package, first run

View File

@ -0,0 +1,9 @@
targets:
$default:
builders:
drift_dev:
options:
sql:
dialects:
- sqlite # remove this line if you only need postgres
- postgres