feat: Tortoise ORM migrations
This commit is contained in:
1 parent
50cd677515
commit
25b5fbd22a
6 files changed
+184
-184
No files matched your search
@@ -10,23 +10,24 @@ else
|
||||
echo "Write a .env file with the variables: REPLICATE_API_TOKEN"
|
||||
fi
|
||||
|
||||
export HORDE_DATA_DIR=$(realpath ./local-data)
|
||||
|
||||
case "$1" in
|
||||
"")
|
||||
data_dir=$(realpath ./local-data)
|
||||
mkdir -p $data_dir
|
||||
python backend/src/app.py $data_dir
|
||||
mkdir -p $HORDE_DATA_DIR
|
||||
python backend/src/app.py
|
||||
;;
|
||||
"cli")
|
||||
# deprecated lol
|
||||
node cli/main.js "$2"
|
||||
;;
|
||||
"test")
|
||||
# Setup test data directory
|
||||
data_dir=$(realpath ./test-data)
|
||||
mkdir -p $data_dir
|
||||
rm -rf $data_dir/*
|
||||
export HORDE_DATA_DIR=$(realpath ./test-data)
|
||||
mkdir -p $HORDE_DATA_DIR
|
||||
rm -rf $HORDE_DATA_DIR/*
|
||||
|
||||
# Start backend in the background
|
||||
python backend/src/app.py $data_dir &
|
||||
python backend/src/app.py &
|
||||
BACKEND_PID=$!
|
||||
echo "Started backend: $BACKEND_PID"
|
||||
sleep 5
|
||||
@@ -47,10 +48,18 @@ case "$1" in
|
||||
flutter build web
|
||||
done
|
||||
;;
|
||||
|
||||
# Create migrations based on the current schema in database.py
|
||||
"migration")
|
||||
cd backend/src
|
||||
tortoise -c database.TORTOISE_ORM makemigrations
|
||||
;;
|
||||
|
||||
# Execute with custom home directory if it exists
|
||||
*)
|
||||
if [ -d "$1" ]; then
|
||||
data_dir=$(realpath $1)
|
||||
python backend/src/app.py $data_dir
|
||||
export HORDE_DATA_DIR=$(realpath $1)
|
||||
python backend/src/app.py
|
||||
else
|
||||
echo "Error: unknown command or directory '$1'"
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user