From 73f471ab9809dcac2105e045b44191eacf9564c0 Mon Sep 17 00:00:00 2001 From: rashad Date: Mon, 5 Dec 2022 18:13:36 -0500 Subject: [PATCH] add sqlite migration script (#399) Co-authored-by: Rashad Alston --- scripts/utils/refresh_test_db.bash | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/utils/refresh_test_db.bash b/scripts/utils/refresh_test_db.bash index 7cc56ecde..2f7ce4c91 100644 --- a/scripts/utils/refresh_test_db.bash +++ b/scripts/utils/refresh_test_db.bash @@ -7,8 +7,18 @@ set -x -dropdb postgres -createdb postgres -DATABASE_URL=postgres://postgres@127.0.0.1 bash scripts/run_migrations.bash +db_type="${1}" + +if [ $db_type == "postgres" ]; then + dropdb postgres + createdb postgres + DATABASE_URL=postgres://postgres@127.0.0.1 bash scripts/run_migrations.bash +elif [ $db_type == "sqlite" ]; then + rm -fv $PWD/packages/fuel-indexer-tests/test.db + DATABASE_URL=sqlite://$PWD/packages/fuel-indexer-tests/test.db bash scripts/run_migrations.bash +else + echo "Invalid db param. Expected 'sqlite' or 'postgres'. Found '$db_type'" + exit 1 +fi set +x