mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-07 07:55:16 +02:00
Add alembic and start services scripts
This commit is contained in:
parent
44232b37f8
commit
443490b2dd
9 changed files with 761 additions and 1 deletions
27
scripts/migrate.sh
Normal file
27
scripts/migrate.sh
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e # Exit immediately if a command exits with a non-zero status
|
||||
|
||||
# Set PYTHONPATH to the parent directory of the script's location
|
||||
export PYTHONPATH="$(dirname "$(dirname "$(dirname "$(realpath "$0")")")")"
|
||||
|
||||
# Define color codes
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
env_file="api/.env"
|
||||
|
||||
# Check if environment file exists
|
||||
if [ ! -f "$env_file" ]; then
|
||||
echo -e "${RED}Error: Environment file $env_file not found.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Load environment variables
|
||||
export $(grep -v '^#' "$env_file" | xargs)
|
||||
|
||||
# Run migrations
|
||||
alembic -c api/alembic.ini upgrade head
|
||||
|
||||
# Create initial data in DB
|
||||
# python api/initial_data.py
|
||||
Loading…
Add table
Add a link
Reference in a new issue