-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev-tools.sh
executable file
·60 lines (51 loc) · 1.17 KB
/
dev-tools.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
DATABASE_URL=sqlite:///.data.db
# Define the _make_migration function
_make_migration() {
if [ $# -lt 1 ]; then
echo "Usage: make_migration <migration message>"
exit 1
fi
# Call alembic revision command with the provided string
DATABASE_URL=$DATABASE_URL poetry run alembic revision --autogenerate -m "$1"
}
_migrate_up() {
DATABASE_URL=$DATABASE_URL poetry run alembic upgrade head
}
_run() {
(cd ./frontend && pnpm run build)
DATABASE_URL=$DATABASE_URL poetry run uvicorn app.main:app --reload
}
_clear_storage() {
rm -r storage/audio_samples/*
}
# Check if the argument count is less than 1
if [ $# -lt 1 ]; then
echo "Usage: $0 <command>"
exit 1
fi
# Retrieve the command from the second command-line argument
command="$1"
shift
case "$command" in
make_migration)
_make_migration "$@"
;;
migrate_up)
_migrate_up
;;
run)
_run
;;
clear_storage)
_clear_storage
;;
# # Add more commands here
# other_command)
# # Handle other_command
# ;;
*)
echo "Invalid command: $command"
exit 1
;;
esac