mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-14 17:03:29 +03:00
If .migration_info values are missing, prompt user for them (#637)
This commit is contained in:
parent
fc76f9d466
commit
76d409fbec
14
migration.sh
14
migration.sh
@ -6,10 +6,22 @@ run_sql_file() {
|
||||
PGPASSWORD=${DB_PASSWORD} psql -h "${DB_HOST}" -p "${DB_PORT}" -d "${DB_NAME}" -U "${DB_USER}" -f "$file"
|
||||
}
|
||||
|
||||
# Check if .migration_info exists and source it, otherwise ask user for inputs
|
||||
# Flag to indicate whether to prompt for DB info
|
||||
prompt_for_db_info=false
|
||||
|
||||
# Check if .migration_info exists and source it
|
||||
if [ -f .migration_info ]; then
|
||||
source .migration_info
|
||||
# Check if any of the variables are empty
|
||||
if [ -z "$DB_HOST" ] || [ -z "$DB_NAME" ] || [ -z "$DB_PORT" ] || [ -z "$DB_USER" ] || [ -z "$DB_PASSWORD" ]; then
|
||||
prompt_for_db_info=true # Some values are empty, so prompt user for values
|
||||
fi
|
||||
else
|
||||
prompt_for_db_info=true # No .migration_info file, so prompt user for values
|
||||
fi
|
||||
|
||||
# If .migration_info doesn't exist or any of the variables are empty, prompt for DB info
|
||||
if $prompt_for_db_info ; then
|
||||
echo "Please enter the following database connection information that can be found in Supabase in Settings -> database:"
|
||||
DB_HOST=$(gum input --placeholder "Host")
|
||||
DB_NAME=$(gum input --placeholder "Database name")
|
||||
|
Loading…
Reference in New Issue
Block a user