aboutsummaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2018-03-18 17:43:30 +0000
committerrubenwardy <rw@rubenwardy.com>2018-03-18 17:43:30 +0000
commit366a2302d092c12f388f0eb8efb4faaa3acd3303 (patch)
tree070f3ef21b04bd716b9136a827d9fe7b90c32e2c /setup.py
downloadcheatdb-366a2302d092c12f388f0eb8efb4faaa3acd3303.tar.xz
Initial commit
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..0ba2b5a
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,17 @@
+import os, datetime
+
+delete_db = False
+
+if delete_db and os.path.isfile("app/data.sqlite"):
+ os.remove("app/data.sqlite")
+
+if not os.path.isfile("app/data.sqlite"):
+ from app import models
+
+ print("Creating database tables...")
+ models.db.create_all()
+
+ print("Filling database...")
+ models.db.session.commit()
+else:
+ print("Database already exists")