summaryrefslogtreecommitdiff
path: root/app/python/init_db.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/python/init_db.py')
-rw-r--r--app/python/init_db.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/python/init_db.py b/app/python/init_db.py
new file mode 100644
index 0000000..7d48e80
--- /dev/null
+++ b/app/python/init_db.py
@@ -0,0 +1,16 @@
+import sys
+
+from rcal.db import Session
+from rcal.model import BASE
+
+
+def main():
+ session = Session.create()
+
+ if len(sys.argv) > 1 and sys.argv[1] == 'force':
+ BASE.metadata.drop_all(session.get_bind())
+
+ BASE.metadata.create_all(session.get_bind())
+
+if __name__ == '__main__':
+ main()