docs: update sqlx script and add ci

- upgrades sqlx to 0.6
- fixes sqlite_dev_setup.sh script
- adds ci to test the script
This commit is contained in:
Byron Hambly 2022-11-30 13:39:20 +02:00
parent f0e28b1bc6
commit f0e059c814
No known key found for this signature in database
GPG key ID: DE8F6EA20A661697
7 changed files with 166 additions and 114 deletions

16
swap/sqlite_dev_setup.sh Normal file → Executable file
View file

@ -1,6 +1,14 @@
# crated temporary DB
# run the migration scripts to create the tables
# prepare the sqlx-data.json rust mappings
#!/bin/bash
# run this script from the swap dir
# make sure you have sqlx-cli installed: cargo install sqlx-cli
# this script creates a temporary sqlite database
# then runs the migration scripts to create the tables (migrations folder)
# then it prepares the offline sqlx-data.json rust mappings
DATABASE_URL=sqlite:tempdb cargo sqlx database create
DATABASE_URL=sqlite:tempdb cargo sqlx migrate run
DATABASE_URL=sqlite:./swap/tempdb cargo sqlx prepare -- --bin swap
# needs the absolute path here
# https://github.com/launchbadge/sqlx/issues/1399
DB_PATH=$(readlink -f tempdb)
DATABASE_URL="sqlite:$DB_PATH" cargo sqlx prepare -- --bin swap