Browse Source

Merge pull request #78 from comit-network/prepare-db-script

Add script for preparing the DB for convenience
no-contract-setup-message
Daniel Karzel 3 years ago
committed by GitHub
parent
commit
ee5e20b1e7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      daemon/prepare_db.sh

18
daemon/prepare_db.sh

@ -0,0 +1,18 @@
#!/bin/bash
DAEMON_DIR=daemon
TEMPDB=tempdb
# make sure to fail early in case something goes wrong
set -e
# create temporary DB
DATABASE_URL=sqlite:$TEMPDB cargo sqlx database create
# make sure we remove the tempdb when exiting even if one of the following commands fails
trap 'rm -f $TEMPDB' EXIT
# run the migration scripts to create the tables
DATABASE_URL=sqlite:$TEMPDB cargo sqlx migrate run
# prepare the sqlx-data.json rust mappings
DATABASE_URL=sqlite:./$DAEMON_DIR/$TEMPDB cargo sqlx prepare -- --bin taker
Loading…
Cancel
Save