Add option to download menus, make DB creation easier
This commit is contained in:
parent
ec7c8ed40b
commit
fad23fbeda
2 changed files with 15 additions and 9 deletions
|
@ -31,14 +31,10 @@ def add_all() -> None:
|
||||||
|
|
||||||
def recreate_from_scratch() -> None:
|
def recreate_from_scratch() -> None:
|
||||||
"Recreate a completely new database"
|
"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!")
|
print("Resetting the database!")
|
||||||
db.drop_all()
|
db.drop_all()
|
||||||
db.create_all()
|
db.create_all()
|
||||||
add_to_current()
|
add_to_current()
|
||||||
else:
|
|
||||||
print("You cancelled.")
|
|
||||||
|
|
||||||
|
|
||||||
def add_to_current() -> None:
|
def add_to_current() -> None:
|
||||||
|
@ -75,7 +71,7 @@ def setup_database(): # type: None
|
||||||
"Start the database interaction script"
|
"Start the database interaction script"
|
||||||
print("Database modification script!")
|
print("Database modification script!")
|
||||||
print("=============================\n\n")
|
print("=============================\n\n")
|
||||||
if check_if_overwrite():
|
if (not db.engine.table_names()) or check_if_overwrite():
|
||||||
recreate_from_scratch()
|
recreate_from_scratch()
|
||||||
else:
|
else:
|
||||||
add_to_current()
|
add_to_current()
|
||||||
|
|
|
@ -40,4 +40,14 @@ fi
|
||||||
echo -e "${B} Seeding database ${E}"
|
echo -e "${B} Seeding database ${E}"
|
||||||
./populate-db.sh
|
./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}"
|
echo -e "${B} Activate your venv using 'source venv/bin/activate'.\nThen run the development server with 'python app/app.py runserver' ${E}"
|
||||||
|
|
Loading…
Reference in a new issue