summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-02-19 10:11:45 +0100
committeremkael <emkael@tlen.pl>2016-02-19 10:11:45 +0100
commitc5676bc2f1175b32ff703065f049e299a546bccd (patch)
treea39df816fbfbd7b2d8a27ec9534ceb9de153ce77
parent76ec3917c701b1f7ade19dde277d49f88ec423d4 (diff)
* DB initialization script
-rw-r--r--init_db.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/init_db.py b/init_db.py
new file mode 100644
index 0000000..f6d2b92
--- /dev/null
+++ b/init_db.py
@@ -0,0 +1,10 @@
+from rcal.db import Session
+from rcal.model import Base
+import sys
+
+session = Session()
+
+if len(sys.argv) > 1 and sys.argv[1] == 'force':
+ Base.metadata.drop_all(session.get_bind())
+
+Base.metadata.create_all(session.get_bind())