Add option to download menus, make DB creation easier

This commit is contained in:
redfast00 2020-12-04 20:21:12 +01:00
parent ec7c8ed40b
commit fad23fbeda
No known key found for this signature in database
GPG key ID: 5946E0E34FD0553C
2 changed files with 15 additions and 9 deletions

View file

@ -31,14 +31,10 @@ def add_all() -> None:
def recreate_from_scratch() -> None:
"Recreate a completely new database"
confirmation = "Are you very very sure? (Will delete previous entries!) (y/N) "
if input(confirmation).lower() in yes:
print("Resetting the database!")
db.drop_all()
db.create_all()
add_to_current()
else:
print("You cancelled.")
print("Resetting the database!")
db.drop_all()
db.create_all()
add_to_current()
def add_to_current() -> None:
@ -75,7 +71,7 @@ def setup_database(): # type: None
"Start the database interaction script"
print("Database modification script!")
print("=============================\n\n")
if check_if_overwrite():
if (not db.engine.table_names()) or check_if_overwrite():
recreate_from_scratch()
else:
add_to_current()

View file

@ -40,4 +40,14 @@ fi
echo -e "${B} Seeding database ${E}"
./populate-db.sh
if [ ! -d "menus" ]; then
echo -en "${B} Do you want to use the Zeus HLDS menus? If not, you will have to clone your own menu repository. (Y/n) ${E}"
read confirm
if [ "$confirm" = n ]; then
echo "Not cloning the Zeus HLDS menus"
else
git clone https://git.zeus.gent/haldis/menus.git
fi
fi
echo -e "${B} Activate your venv using 'source venv/bin/activate'.\nThen run the development server with 'python app/app.py runserver' ${E}"