Add just prepare-sqlite to simplify sqlite dev

This commit is contained in:
Yuri Astrakhan 2023-06-01 13:07:13 -04:00
parent f401152770
commit 278f46f772
2 changed files with 9 additions and 7 deletions

View File

@ -187,3 +187,11 @@ git-pre-push: stop start
cargo --version
just lint
just test
# Update sqlite database schema. Install SQLX cli if not already installed.
prepare-sqlite:
if ! command -v cargo-sqlx &> /dev/null; then \
echo "SQLX could not be found. Installing..." ;\
cargo install sqlx-cli --no-default-features --features sqlite,native-tls ;\
fi
cd martin-mbtiles && cargo sqlx prepare --database-url sqlite://$PWD/../tests/fixtures/files/world_cities.mbtiles

View File

@ -1,9 +1,3 @@
# Development
```bash
# To update sqlx files, first install sqlx-cli:
cargo install sqlx-cli --no-default-features --features sqlite,native-tls
# Prepare DB schema (from the ./mbtiles dir)
cargo sqlx prepare --database-url sqlite://$PWD/fixtures/geography-class-jpg.mbtiles
```
Any changes to SQL commands require running of `just prepare-sqlite`. This will install `cargo sqlx` command if it is not already installed, and update the `./sqlx-data.json` file.