-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a script to reset the db (#80)
Co-authored-by: Nargis Sultani <[email protected]>
- Loading branch information
1 parent
219a8ae
commit bf8d7c5
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/sh | ||
|
||
if [[ $1 == "" ]] | ||
then | ||
echo "No arguments passed!" | ||
echo "The argument must be either reset or reset-then-seed" | ||
exit 0 | ||
fi | ||
|
||
ACTION=$1 | ||
|
||
if [ $ACTION == "reset" ] | ||
then | ||
#If only need to reset db | ||
poetry run alembic downgrade base | ||
elif [ $ACTION == "reset-then-seed" ] | ||
then | ||
#First reset the db | ||
poetry run alembic downgrade base | ||
#Then upgrade it to head | ||
poetry run alembic upgrade head | ||
fi |