2022-11-30 06:39:20 -05:00
|
|
|
#!/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
|
2021-09-20 19:14:33 -04:00
|
|
|
DATABASE_URL=sqlite:tempdb cargo sqlx database create
|
|
|
|
DATABASE_URL=sqlite:tempdb cargo sqlx migrate run
|
2022-11-30 06:39:20 -05:00
|
|
|
# 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
|