From 111944619f016b996f7d94f172bb3d20b8b5d40a Mon Sep 17 00:00:00 2001 From: Wout Schellaert Date: Wed, 13 May 2015 13:34:32 +0200 Subject: [PATCH] Package restructure and small create_database changes --- {database => app/database}/add_admins.py | 3 --- {database => app/database}/add_oceans_garden.py | 0 {database => app/database}/add_simpizza.py | 0 {database => app/database}/create_database.py | 9 ++++++--- {database => app/database}/muhscheme | 0 5 files changed, 6 insertions(+), 6 deletions(-) rename {database => app/database}/add_admins.py (90%) rename {database => app/database}/add_oceans_garden.py (100%) rename {database => app/database}/add_simpizza.py (100%) rename {database => app/database}/create_database.py (90%) rename {database => app/database}/muhscheme (100%) diff --git a/database/add_admins.py b/app/database/add_admins.py similarity index 90% rename from database/add_admins.py rename to app/database/add_admins.py index 70602bc..e84a010 100644 --- a/database/add_admins.py +++ b/app/database/add_admins.py @@ -3,9 +3,6 @@ from models import User def add(): - db.drop_all() - db.create_all() - feli = User() feli.configure("feliciaan", True, 0) db.session.add(feli) diff --git a/database/add_oceans_garden.py b/app/database/add_oceans_garden.py similarity index 100% rename from database/add_oceans_garden.py rename to app/database/add_oceans_garden.py diff --git a/database/add_simpizza.py b/app/database/add_simpizza.py similarity index 100% rename from database/add_simpizza.py rename to app/database/add_simpizza.py diff --git a/database/create_database.py b/app/database/create_database.py similarity index 90% rename from database/create_database.py rename to app/database/create_database.py index eac5fbf..e8d238f 100644 --- a/database/create_database.py +++ b/app/database/create_database.py @@ -1,5 +1,5 @@ from app import db -from database import add_oceans_garden, add_admins, add_simpizza +import add_oceans_garden, add_admins, add_simpizza entry_sets = {"Admins": add_admins.add, "Ocean's Garden": add_oceans_garden.add, "SimPizza": add_simpizza.add} @@ -28,8 +28,10 @@ def recreate_from_scratch(): confirmation = "Are you very very sure? (Will delete previous entry's!) (y/N) " check = "I acknowledge any repercussions!" if input(confirmation) in yes and input("Type: '{}' ".format(check)) == check: - print("Overwriting the database!") - add_all() + print("Resetting the database!") + db.drop_all() + db.create_all() + add_to_current() def add_to_current(): @@ -43,6 +45,7 @@ def add_to_current(): answer = input("Available: {} : ".format(add_numbers())) if answer == "A": add_all() + available = [] elif answer == "C": pass elif answer in [str(x) for x in range(len(available))]: diff --git a/database/muhscheme b/app/database/muhscheme similarity index 100% rename from database/muhscheme rename to app/database/muhscheme