diff options
author | Joris | 2025-02-07 08:25:28 +0100 |
---|---|---|
committer | Joris | 2025-02-07 08:25:28 +0100 |
commit | bfe4aa78d882b9d95bd1f954371136f3aa5c38c9 (patch) | |
tree | 597f20035a42f4603d4a1c693a4c070ef00e112e /bin | |
parent | fedb4e7c7ebf21619f89c29d011e288363a978e9 (diff) |
Migrate database at startup
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/db | 26 |
1 files changed, 0 insertions, 26 deletions
@@ -1,26 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail -cd $(dirname "$0")/.. - -DB_PATH="database.db" - -if [ "$1" == "init" ]; then - - if [ -f "$DB_PATH" ]; then - rm "$DB_PATH" - fi - - for MIGRATION in $(ls sql/migrations/*.sql); do - printf "\n- Applying $MIGRATION\n\n" - sqlite3 database.db < "$MIGRATION" - done - - printf "\n- Applying sql/fixtures.sql\n\n" - sqlite3 database.db < sql/fixtures.sql - -else - - echo "Usage: $0 init" - exit 1 - -fi |